refactor: updated swagger;

feat: helper function in errors for checking postgres error types;
feat: sql query method for finding users by their email;
feat: registration begin/complete with checking existing username/email;
refactor: error handling in controller
This commit is contained in:
2025-07-03 04:33:25 +03:00
parent d08db300fc
commit 0a51727af8
12 changed files with 348 additions and 31 deletions

View File

@@ -8,7 +8,7 @@
"title": "Easywish client API",
"contact": {},
"license": {
"name": "GPL 3.0"
"name": "GPL-3.0"
},
"version": "1.0"
},
@@ -135,7 +135,11 @@
}
}
],
"responses": {}
"responses": {
"200": {
"description": "desc"
}
}
}
},
"/auth/registrationComplete": {
@@ -150,7 +154,25 @@
"Auth"
],
"summary": "Confirm with code, finish creating the account",
"responses": {}
"parameters": [
{
"description": "desc",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.RegistrationCompleteRequest"
}
}
],
"responses": {
"200": {
"description": "desc",
"schema": {
"$ref": "#/definitions/models.RegistrationCompleteResponse"
}
}
}
}
},
"/profile": {
@@ -301,13 +323,16 @@
],
"properties": {
"password": {
"type": "string"
"type": "string",
"maxLength": 100
},
"totp": {
"type": "string"
},
"username": {
"type": "string"
"type": "string",
"maxLength": 20,
"minLength": 3
}
}
},
@@ -342,6 +367,46 @@
"minLength": 3
}
}
},
"models.RegistrationCompleteRequest": {
"type": "object",
"required": [
"name",
"username",
"verification_code"
],
"properties": {
"avatar_url": {
"type": "string",
"maxLength": 255
},
"birthday": {
"type": "string"
},
"name": {
"type": "string",
"maxLength": 75
},
"username": {
"type": "string",
"maxLength": 20,
"minLength": 3
},
"verification_code": {
"type": "string"
}
}
},
"models.RegistrationCompleteResponse": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"refresh_token": {
"type": "string"
}
}
}
},
"securityDefinitions": {