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
469 lines
10 KiB
YAML
469 lines
10 KiB
YAML
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:
|
|
type: string
|
|
password:
|
|
type: string
|
|
totp:
|
|
type: string
|
|
required:
|
|
- old_password
|
|
- password
|
|
type: object
|
|
models.HealthStatusResponse:
|
|
properties:
|
|
healthy:
|
|
type: boolean
|
|
type: object
|
|
models.LoginRequest:
|
|
properties:
|
|
password:
|
|
maxLength: 100
|
|
type: string
|
|
totp:
|
|
type: string
|
|
username:
|
|
maxLength: 20
|
|
minLength: 3
|
|
type: string
|
|
required:
|
|
- password
|
|
- username
|
|
type: object
|
|
models.LoginResponse:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
refresh_token:
|
|
type: string
|
|
type: object
|
|
models.PasswordResetBeginRequest:
|
|
properties:
|
|
email:
|
|
type: string
|
|
required:
|
|
- email
|
|
type: object
|
|
models.PasswordResetCompleteRequest:
|
|
properties:
|
|
email:
|
|
type: string
|
|
log_out_sessions:
|
|
type: boolean
|
|
password:
|
|
type: string
|
|
verification_code:
|
|
type: string
|
|
required:
|
|
- email
|
|
- password
|
|
- verification_code
|
|
type: object
|
|
models.PasswordResetCompleteResponse:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
refresh_token:
|
|
type: string
|
|
type: object
|
|
models.RefreshRequest:
|
|
properties:
|
|
refresh_token:
|
|
maxLength: 2000
|
|
type: string
|
|
required:
|
|
- refresh_token
|
|
type: object
|
|
models.RefreshResponse:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
refresh_token:
|
|
type: string
|
|
type: object
|
|
models.RegistrationBeginRequest:
|
|
properties:
|
|
email:
|
|
type: string
|
|
password:
|
|
type: string
|
|
username:
|
|
type: string
|
|
required:
|
|
- email
|
|
- password
|
|
- username
|
|
type: object
|
|
models.RegistrationCompleteRequest:
|
|
properties:
|
|
birthday:
|
|
type: string
|
|
name:
|
|
type: string
|
|
username:
|
|
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
|
|
title: Easywish client API
|
|
version: "1.0"
|
|
paths:
|
|
/auth/changePassword:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.ChangePasswordRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: Password successfully changed
|
|
"403":
|
|
description: Invalid old password
|
|
security:
|
|
- JWT: []
|
|
summary: Set new password using the old password
|
|
tags:
|
|
- Auth
|
|
/auth/login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.LoginRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: ' '
|
|
schema:
|
|
$ref: '#/definitions/models.LoginResponse'
|
|
"403":
|
|
description: Invalid login credentials
|
|
summary: Acquire tokens via login credentials (and 2FA code if needed)
|
|
tags:
|
|
- Auth
|
|
/auth/passwordResetBegin:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.PasswordResetBeginRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: Reset code sent to the email if it is attached to an account
|
|
"429":
|
|
description: Too many recent requests for this email
|
|
summary: Request password reset email
|
|
tags:
|
|
- Auth
|
|
/auth/passwordResetComplete:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.PasswordResetCompleteRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: ' '
|
|
schema:
|
|
$ref: '#/definitions/models.PasswordResetCompleteResponse'
|
|
"403":
|
|
description: Wrong verification code or username
|
|
summary: Complete password reset via email code
|
|
tags:
|
|
- Auth
|
|
/auth/refresh:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.RefreshRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: ' '
|
|
schema:
|
|
$ref: '#/definitions/models.RefreshResponse'
|
|
"401":
|
|
description: Invalid refresh token
|
|
summary: Receive new tokens via refresh token
|
|
tags:
|
|
- Auth
|
|
/auth/registrationBegin:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.RegistrationBeginRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: Account is created and awaiting verification
|
|
"409":
|
|
description: Username or email is already taken
|
|
"429":
|
|
description: Too many recent registration attempts for this email
|
|
summary: Register an account
|
|
tags:
|
|
- Auth
|
|
/auth/registrationComplete:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: ' '
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/models.RegistrationCompleteRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: ' '
|
|
schema:
|
|
$ref: '#/definitions/models.RegistrationCompleteResponse'
|
|
"403":
|
|
description: Invalid email or verification code
|
|
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:
|
|
- application/json
|
|
description: Used internally for checking service health
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: Says whether it's healthy or not
|
|
schema:
|
|
$ref: '#/definitions/models.HealthStatusResponse'
|
|
summary: Get health status
|
|
tags:
|
|
- Service
|
|
schemes:
|
|
- http
|
|
securityDefinitions:
|
|
JWT:
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
swagger: "2.0"
|