tsk-18: Create service user (#22)

Closes #18

Reviewed-on: phoenix/textsender-auth#22
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-11-20 19:11:36 +00:00
committed by phoenix
parent 8a90448854
commit c340693b24
17 changed files with 531 additions and 26 deletions
+93
View File
@@ -110,6 +110,57 @@
}
}
}
},
"/service/register": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a service user that can send texts (requires JWT)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"service users"
],
"summary": "Register service user",
"parameters": [
{
"description": "Data to add user",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.ServiceCreationRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.ServiceCreationResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handler.ServiceCreationResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handler.ServiceCreationResponse"
}
}
}
}
}
},
"definitions": {
@@ -180,6 +231,31 @@
}
}
},
"handler.ServiceCreationRequest": {
"type": "object",
"properties": {
"passphrase": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handler.ServiceCreationResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/user.ServiceUser"
}
},
"message": {
"type": "string"
}
}
},
"token.Login": {
"type": "object",
"properties": {
@@ -193,6 +269,23 @@
"type": "string"
}
}
},
"user.ServiceUser": {
"type": "object",
"properties": {
"date_created": {
"type": "string"
},
"id": {
"type": "string"
},
"passphrase": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
},
"securityDefinitions": {