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,10 +8,13 @@ definitions:
models.LoginRequest:
properties:
password:
maxLength: 100
type: string
totp:
type: string
username:
maxLength: 20
minLength: 3
type: string
required:
- password
@@ -39,11 +42,39 @@ definitions:
- password
- username
type: object
models.RegistrationCompleteRequest:
properties:
avatar_url:
maxLength: 255
type: string
birthday:
type: string
name:
maxLength: 75
type: string
username:
maxLength: 20
minLength: 3
type: string
verification_code:
type: string
required:
- name
- username
- verification_code
type: object
models.RegistrationCompleteResponse:
properties:
access_token:
type: string
refresh_token:
type: string
type: object
info:
contact: {}
description: Easy and feature-rich wishlist.
license:
name: GPL 3.0
name: GPL-3.0
title: Easywish client API
version: "1.0"
paths:
@@ -124,7 +155,9 @@ paths:
$ref: '#/definitions/models.RegistrationBeginRequest'
produces:
- application/json
responses: {}
responses:
"200":
description: desc
summary: Register an account
tags:
- Auth
@@ -132,9 +165,20 @@ paths:
post:
consumes:
- application/json
parameters:
- description: desc
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.RegistrationCompleteRequest'
produces:
- application/json
responses: {}
responses:
"200":
description: desc
schema:
$ref: '#/definitions/models.RegistrationCompleteResponse'
summary: Confirm with code, finish creating the account
tags:
- Auth