feat: fully implement profile controller;

feat: implement file upload handling in controller with size and type validation;
feat: add custom validation rules for bio and color hex fields;
refactor: enhance request handling with dedicated client info extraction;
chore: update profile DTOs with validation tags;
docs: profile controller swagger
This commit is contained in:
2025-07-19 22:57:44 +03:00
parent fc0c73aa5b
commit f65439fb50
11 changed files with 975 additions and 12 deletions

View File

@@ -1,5 +1,39 @@
basePath: /api/
definitions:
dto.ProfileDto:
properties:
avatar_url:
type: string
bio:
type: string
birthday:
type: integer
color:
type: string
color_grad:
type: string
name:
type: string
required:
- name
type: object
dto.ProfileSettingsDto:
properties:
captcha:
type: boolean
followers_only_interaction:
type: boolean
hide_birthday:
type: boolean
hide_dates:
type: boolean
hide_for_unauthenticated:
type: boolean
hide_fulfilled:
type: boolean
hide_profile_details:
type: boolean
type: object
models.ChangePasswordRequest:
properties:
old_password:
@@ -285,6 +319,130 @@ paths:
summary: Confirm with code, finish creating the account
tags:
- Auth
/profile:
get:
consumes:
- application/json
produces:
- application/json
responses:
"200":
description: ' '
schema:
$ref: '#/definitions/dto.ProfileDto'
security:
- JWT: []
summary: Get your profile
tags:
- Profile
patch:
consumes:
- application/json
parameters:
- description: ' '
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.ProfileDto'
produces:
- application/json
responses:
"200":
description: ' '
schema:
type: boolean
security:
- JWT: []
summary: Update your profile
tags:
- Profile
/profile/{username}:
get:
consumes:
- application/json
parameters:
- description: ' '
in: path
name: username
required: true
type: string
produces:
- application/json
responses:
"200":
description: ' '
schema:
$ref: '#/definitions/dto.ProfileDto'
"403":
description: Restricted profile
"404":
description: Profile not found
security:
- JWT: []
summary: Get profile by username
tags:
- Profile
/profile/avatar:
post:
consumes:
- multipart/form-data
parameters:
- description: Avatar image file
in: formData
name: file
required: true
type: file
produces:
- text/plain
responses:
"200":
description: Uploaded image url
schema:
type: string
security:
- JWT: []
summary: Upload an avatar
tags:
- Profile
/profile/settings:
get:
consumes:
- application/json
produces:
- application/json
responses:
"200":
description: ' '
schema:
$ref: '#/definitions/dto.ProfileSettingsDto'
security:
- JWT: []
summary: Get your profile settings
tags:
- Profile
patch:
consumes:
- application/json
parameters:
- description: ' '
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.ProfileSettingsDto'
produces:
- application/json
responses:
"200":
description: ' '
schema:
type: boolean
security:
- JWT: []
summary: Update your profile's settings
tags:
- Profile
/service/health:
get:
consumes: