fix: remove 500 error responses from upload endpoints; fix: return validation error strings instead of error lists; fix: handle invalid avatar upload IDs with 400 Bad Request response; fix: add missing S3Controller to controller initialization; fix: change avatar_upload_id to string type and update validation rules; chore: add license header to smtp.go; refactor: replace manual proxy implementation with httputil.ReverseProxy; fix: inject S3Service dependency into ProfileService; fix: set color and color_grad fields during profile update; fix: correct DTO mapping for profile and settings; fix: check object existence before copying in SaveUpload; fix: adjust profile DTO mapping function for proper pointer handling
779 lines
23 KiB
JSON
779 lines
23 KiB
JSON
{
|
|
"schemes": [
|
|
"http"
|
|
],
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "Easy and feature-rich wishlist.",
|
|
"title": "Easywish client API",
|
|
"contact": {},
|
|
"license": {
|
|
"name": "GPL-3.0"
|
|
},
|
|
"version": "1.0"
|
|
},
|
|
"basePath": "/api/",
|
|
"paths": {
|
|
"/auth/changePassword": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Set new password using the old password",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.ChangePasswordRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Password successfully changed"
|
|
},
|
|
"403": {
|
|
"description": "Invalid old password"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/login": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Acquire tokens via login credentials (and 2FA code if needed)",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.LoginRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.LoginResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Invalid login credentials"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/passwordResetBegin": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Request password reset email",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.PasswordResetBeginRequest"
|
|
}
|
|
}
|
|
],
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/passwordResetComplete": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Complete password reset via email code",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.PasswordResetCompleteRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.PasswordResetCompleteResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Wrong verification code or username"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/refresh": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Receive new tokens via refresh token",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.RefreshRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.RefreshResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Invalid refresh token"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/registrationBegin": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Register an account",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.RegistrationBeginRequest"
|
|
}
|
|
}
|
|
],
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/registrationComplete": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Auth"
|
|
],
|
|
"summary": "Confirm with code, finish creating the account",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/models.RegistrationCompleteRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.RegistrationCompleteResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Invalid email or verification code"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/profile": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Profile"
|
|
],
|
|
"summary": "Get your profile",
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/dto.ProfileDto"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Profile"
|
|
],
|
|
"summary": "Update your profile",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/dto.NewProfileDto"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/profile/settings": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Profile"
|
|
],
|
|
"summary": "Get your profile settings",
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/dto.ProfileSettingsDto"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Profile"
|
|
],
|
|
"summary": "Update your profile's settings",
|
|
"parameters": [
|
|
{
|
|
"description": " ",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/dto.ProfileSettingsDto"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/profile/{username}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Profile"
|
|
],
|
|
"summary": "Get profile by username",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": " ",
|
|
"name": "username",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": " ",
|
|
"schema": {
|
|
"$ref": "#/definitions/dto.ProfileDto"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Restricted profile"
|
|
},
|
|
"404": {
|
|
"description": "Profile not found"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/service/health": {
|
|
"get": {
|
|
"description": "Used internally for checking service health",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Service"
|
|
],
|
|
"summary": "Get health status",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Says whether it's healthy or not",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.HealthStatusResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/upload/avatar": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Upload"
|
|
],
|
|
"summary": "Get presigned URL for avatar upload",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Presigned URL and form data",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.PresignedUploadResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/upload/image": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Upload"
|
|
],
|
|
"summary": "Get presigned URL for image upload",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Presigned URL and form data",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.PresignedUploadResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"dto.NewProfileDto": {
|
|
"type": "object",
|
|
"required": [
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"avatar_upload_id": {
|
|
"type": "string"
|
|
},
|
|
"bio": {
|
|
"type": "string"
|
|
},
|
|
"birthday": {
|
|
"type": "integer"
|
|
},
|
|
"color": {
|
|
"type": "string"
|
|
},
|
|
"color_grad": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"dto.ProfileDto": {
|
|
"type": "object",
|
|
"properties": {
|
|
"avatar_url": {
|
|
"type": "string"
|
|
},
|
|
"bio": {
|
|
"type": "string"
|
|
},
|
|
"birthday": {
|
|
"type": "integer"
|
|
},
|
|
"color": {
|
|
"type": "string"
|
|
},
|
|
"color_grad": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"dto.ProfileSettingsDto": {
|
|
"type": "object",
|
|
"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"
|
|
}
|
|
}
|
|
},
|
|
"models.ChangePasswordRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"old_password",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"old_password": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"totp": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.HealthStatusResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"healthy": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"models.LoginRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"password",
|
|
"username"
|
|
],
|
|
"properties": {
|
|
"password": {
|
|
"type": "string",
|
|
"maxLength": 100
|
|
},
|
|
"totp": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string",
|
|
"maxLength": 20,
|
|
"minLength": 3
|
|
}
|
|
}
|
|
},
|
|
"models.LoginResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"access_token": {
|
|
"type": "string"
|
|
},
|
|
"refresh_token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.PasswordResetBeginRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"email"
|
|
],
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.PasswordResetCompleteRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"email",
|
|
"password",
|
|
"verification_code"
|
|
],
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"log_out_sessions": {
|
|
"type": "boolean"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"verification_code": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.PasswordResetCompleteResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"access_token": {
|
|
"type": "string"
|
|
},
|
|
"refresh_token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.PresignedUploadResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fields": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"url": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.RefreshRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"refresh_token"
|
|
],
|
|
"properties": {
|
|
"refresh_token": {
|
|
"type": "string",
|
|
"maxLength": 2000
|
|
}
|
|
}
|
|
},
|
|
"models.RefreshResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"access_token": {
|
|
"type": "string"
|
|
},
|
|
"refresh_token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.RegistrationBeginRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"email",
|
|
"password",
|
|
"username"
|
|
],
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.RegistrationCompleteRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"name",
|
|
"username",
|
|
"verification_code"
|
|
],
|
|
"properties": {
|
|
"birthday": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"verification_code": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.RegistrationCompleteResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"access_token": {
|
|
"type": "string"
|
|
},
|
|
"refresh_token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"JWT": {
|
|
"type": "apiKey",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
}
|
|
} |