feat: delete usertitle described
This commit is contained in:
parent
cb9fba6fbc
commit
e0a68d7d0f
6 changed files with 526 additions and 228 deletions
|
|
@ -11,52 +11,52 @@ paths:
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: '#/components/parameters/cursor'
|
- $ref: '#/components/parameters/cursor'
|
||||||
- $ref: '#/components/parameters/title_sort'
|
- $ref: '#/components/parameters/title_sort'
|
||||||
- in: query
|
- name: sort_forward
|
||||||
name: sort_forward
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
- in: query
|
- name: word
|
||||||
name: word
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- name: status
|
||||||
name: status
|
in: query
|
||||||
|
description: List of title statuses to filter
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/TitleStatus'
|
$ref: '#/components/schemas/TitleStatus'
|
||||||
description: List of title statuses to filter
|
|
||||||
style: form
|
|
||||||
explode: false
|
explode: false
|
||||||
- in: query
|
style: form
|
||||||
name: rating
|
- name: rating
|
||||||
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: number
|
type: number
|
||||||
format: double
|
format: double
|
||||||
- in: query
|
- name: release_year
|
||||||
name: release_year
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
- in: query
|
- name: release_season
|
||||||
name: release_season
|
in: query
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ReleaseSeason'
|
$ref: '#/components/schemas/ReleaseSeason'
|
||||||
- in: query
|
- name: limit
|
||||||
name: limit
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
default: 10
|
default: 10
|
||||||
- in: query
|
- name: offset
|
||||||
name: offset
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
default: 0
|
default: 0
|
||||||
- in: query
|
- name: fields
|
||||||
name: fields
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: all
|
default: all
|
||||||
|
|
@ -69,10 +69,10 @@ paths:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
|
description: List of titles
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Title'
|
$ref: '#/components/schemas/Title'
|
||||||
description: List of titles
|
|
||||||
cursor:
|
cursor:
|
||||||
$ref: '#/components/schemas/CursorObj'
|
$ref: '#/components/schemas/CursorObj'
|
||||||
required:
|
required:
|
||||||
|
|
@ -88,14 +88,14 @@ paths:
|
||||||
get:
|
get:
|
||||||
summary: Get title description
|
summary: Get title description
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- name: title_id
|
||||||
name: title_id
|
in: path
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
- in: query
|
- name: fields
|
||||||
name: fields
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: all
|
default: all
|
||||||
|
|
@ -118,13 +118,13 @@ paths:
|
||||||
get:
|
get:
|
||||||
summary: Get user info
|
summary: Get user info
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- name: user_id
|
||||||
name: user_id
|
in: path
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- name: fields
|
||||||
name: fields
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: all
|
default: all
|
||||||
|
|
@ -142,59 +142,59 @@ paths:
|
||||||
'500':
|
'500':
|
||||||
description: Unknown server error
|
description: Unknown server error
|
||||||
patch:
|
patch:
|
||||||
|
operationId: updateUser
|
||||||
summary: Partially update a user account
|
summary: Partially update a user account
|
||||||
description: |
|
description: |
|
||||||
Update selected user profile fields (excluding password).
|
Update selected user profile fields (excluding password).
|
||||||
Password updates must be done via the dedicated auth-service (`/auth/`).
|
Password updates must be done via the dedicated auth-service (`/auth/`).
|
||||||
Fields not provided in the request body remain unchanged.
|
Fields not provided in the request body remain unchanged.
|
||||||
operationId: updateUser
|
|
||||||
parameters:
|
parameters:
|
||||||
- name: user_id
|
- name: user_id
|
||||||
in: path
|
in: path
|
||||||
|
description: User ID (primary key)
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
description: User ID (primary key)
|
|
||||||
example: 123
|
example: 123
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
|
description: Only provided fields are updated. Omitted fields remain unchanged.
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
avatar_id:
|
avatar_id:
|
||||||
|
description: ID of the user avatar (references `images.id`); set to `null` to remove avatar
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
nullable: true
|
|
||||||
description: ID of the user avatar (references `images.id`); set to `null` to remove avatar
|
|
||||||
example: 42
|
example: 42
|
||||||
|
nullable: true
|
||||||
mail:
|
mail:
|
||||||
|
description: User email (must be unique and valid)
|
||||||
type: string
|
type: string
|
||||||
format: email
|
format: email
|
||||||
pattern: '^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+$'
|
|
||||||
description: User email (must be unique and valid)
|
|
||||||
example: john.doe.updated@example.com
|
example: john.doe.updated@example.com
|
||||||
|
pattern: '^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+$'
|
||||||
nickname:
|
nickname:
|
||||||
type: string
|
|
||||||
pattern: '^[a-zA-Z0-9_-]{3,16}$'
|
|
||||||
description: 'Username (alphanumeric + `_` or `-`, 3–16 chars)'
|
description: 'Username (alphanumeric + `_` or `-`, 3–16 chars)'
|
||||||
|
type: string
|
||||||
|
example: john_doe_43
|
||||||
maxLength: 16
|
maxLength: 16
|
||||||
minLength: 3
|
minLength: 3
|
||||||
example: john_doe_43
|
pattern: '^[a-zA-Z0-9_-]{3,16}$'
|
||||||
disp_name:
|
disp_name:
|
||||||
type: string
|
|
||||||
description: Display name
|
description: Display name
|
||||||
maxLength: 32
|
|
||||||
example: John Smith
|
|
||||||
user_desc:
|
|
||||||
type: string
|
type: string
|
||||||
|
example: John Smith
|
||||||
|
maxLength: 32
|
||||||
|
user_desc:
|
||||||
description: User description / bio
|
description: User description / bio
|
||||||
maxLength: 512
|
type: string
|
||||||
example: Just a curious developer.
|
example: Just a curious developer.
|
||||||
|
maxLength: 512
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
description: Only provided fields are updated. Omitted fields remain unchanged.
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: User updated successfully. Returns updated user representation (excluding sensitive fields).
|
description: User updated successfully. Returns updated user representation (excluding sensitive fields).
|
||||||
|
|
@ -222,64 +222,64 @@ paths:
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: '#/components/parameters/cursor'
|
- $ref: '#/components/parameters/cursor'
|
||||||
- $ref: '#/components/parameters/title_sort'
|
- $ref: '#/components/parameters/title_sort'
|
||||||
- in: path
|
- name: user_id
|
||||||
name: user_id
|
in: path
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- name: sort_forward
|
||||||
name: sort_forward
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
- in: query
|
- name: word
|
||||||
name: word
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- name: status
|
||||||
name: status
|
in: query
|
||||||
|
description: List of title statuses to filter
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/TitleStatus'
|
$ref: '#/components/schemas/TitleStatus'
|
||||||
description: List of title statuses to filter
|
|
||||||
style: form
|
|
||||||
explode: false
|
explode: false
|
||||||
- in: query
|
style: form
|
||||||
name: watch_status
|
- name: watch_status
|
||||||
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/UserTitleStatus'
|
$ref: '#/components/schemas/UserTitleStatus'
|
||||||
style: form
|
|
||||||
explode: false
|
explode: false
|
||||||
- in: query
|
style: form
|
||||||
name: rating
|
- name: rating
|
||||||
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: number
|
type: number
|
||||||
format: double
|
format: double
|
||||||
- in: query
|
- name: my_rate
|
||||||
name: my_rate
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
- in: query
|
- name: release_year
|
||||||
name: release_year
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
- in: query
|
- name: release_season
|
||||||
name: release_season
|
in: query
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ReleaseSeason'
|
$ref: '#/components/schemas/ReleaseSeason'
|
||||||
- in: query
|
- name: limit
|
||||||
name: limit
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
default: 10
|
default: 10
|
||||||
- in: query
|
- name: fields
|
||||||
name: fields
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: all
|
default: all
|
||||||
|
|
@ -309,17 +309,17 @@ paths:
|
||||||
'500':
|
'500':
|
||||||
description: Unknown server error
|
description: Unknown server error
|
||||||
post:
|
post:
|
||||||
|
operationId: addUserTitle
|
||||||
summary: Add a title to a user
|
summary: Add a title to a user
|
||||||
description: 'User adding title to list af watched, status required'
|
description: 'User adding title to list af watched, status required'
|
||||||
operationId: addUserTitle
|
|
||||||
parameters:
|
parameters:
|
||||||
- name: user_id
|
- name: user_id
|
||||||
in: path
|
in: path
|
||||||
|
description: ID of the user to assign the title to
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
description: ID of the user to assign the title to
|
|
||||||
example: 123
|
example: 123
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
|
|
@ -327,9 +327,6 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
required:
|
|
||||||
- title_id
|
|
||||||
- status
|
|
||||||
properties:
|
properties:
|
||||||
title_id:
|
title_id:
|
||||||
type: integer
|
type: integer
|
||||||
|
|
@ -339,36 +336,16 @@ paths:
|
||||||
rate:
|
rate:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
|
required:
|
||||||
|
- title_id
|
||||||
|
- status
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Title successfully added to user
|
description: Title successfully added to user
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/UserTitleMini'
|
||||||
required:
|
|
||||||
- user_id
|
|
||||||
- title_id
|
|
||||||
- status
|
|
||||||
properties:
|
|
||||||
user_id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
title_id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
status:
|
|
||||||
$ref: '#/components/schemas/UserTitleStatus'
|
|
||||||
rate:
|
|
||||||
type: integer
|
|
||||||
format: int32
|
|
||||||
review_id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
ctime:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
additionalProperties: false
|
|
||||||
'400':
|
'400':
|
||||||
description: 'Invalid request body (missing fields, invalid types, etc.)'
|
description: 'Invalid request body (missing fields, invalid types, etc.)'
|
||||||
'401':
|
'401':
|
||||||
|
|
@ -382,17 +359,17 @@ paths:
|
||||||
'500':
|
'500':
|
||||||
description: Internal server error
|
description: Internal server error
|
||||||
patch:
|
patch:
|
||||||
|
operationId: updateUserTitle
|
||||||
summary: Update a usertitle
|
summary: Update a usertitle
|
||||||
description: User updating title list of watched
|
description: User updating title list of watched
|
||||||
operationId: updateUserTitle
|
|
||||||
parameters:
|
parameters:
|
||||||
- name: user_id
|
- name: user_id
|
||||||
in: path
|
in: path
|
||||||
|
description: ID of the user to assign the title to
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
description: ID of the user to assign the title to
|
|
||||||
example: 123
|
example: 123
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
|
|
@ -400,8 +377,6 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
required:
|
|
||||||
- title_id
|
|
||||||
properties:
|
properties:
|
||||||
title_id:
|
title_id:
|
||||||
type: integer
|
type: integer
|
||||||
|
|
@ -411,13 +386,15 @@ paths:
|
||||||
rate:
|
rate:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
|
required:
|
||||||
|
- title_id
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Title successfully updated
|
description: Title successfully updated
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/paths/~1users~1%7Buser_id%7D~1titles/post/responses/200/content/application~1json/schema'
|
$ref: '#/components/schemas/UserTitleMini'
|
||||||
'400':
|
'400':
|
||||||
description: 'Invalid request body (missing fields, invalid types, etc.)'
|
description: 'Invalid request body (missing fields, invalid types, etc.)'
|
||||||
'401':
|
'401':
|
||||||
|
|
@ -428,6 +405,30 @@ paths:
|
||||||
description: User or Title not found
|
description: User or Title not found
|
||||||
'500':
|
'500':
|
||||||
description: Internal server error
|
description: Internal server error
|
||||||
|
delete:
|
||||||
|
operationId: deleteUserTitle
|
||||||
|
summary: Delete a usertitle
|
||||||
|
description: User deleting title from list of watched
|
||||||
|
parameters:
|
||||||
|
- name: user_id
|
||||||
|
in: path
|
||||||
|
description: ID of the user to assign the title to
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
example: 123
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Title successfully deleted
|
||||||
|
'401':
|
||||||
|
description: Unauthorized — missing or invalid auth token
|
||||||
|
'403':
|
||||||
|
description: Forbidden — user not allowed to delete title
|
||||||
|
'404':
|
||||||
|
description: User or Title not found
|
||||||
|
'500':
|
||||||
|
description: Internal server error
|
||||||
components:
|
components:
|
||||||
parameters:
|
parameters:
|
||||||
cursor:
|
cursor:
|
||||||
|
|
@ -443,25 +444,36 @@ components:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/TitleSort'
|
$ref: '#/components/schemas/TitleSort'
|
||||||
schemas:
|
schemas:
|
||||||
CursorObj:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- id
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
param:
|
|
||||||
type: string
|
|
||||||
TitleSort:
|
TitleSort:
|
||||||
type: string
|
|
||||||
description: Title sort order
|
description: Title sort order
|
||||||
|
type: string
|
||||||
default: id
|
default: id
|
||||||
enum:
|
enum:
|
||||||
- id
|
- id
|
||||||
- year
|
- year
|
||||||
- rating
|
- rating
|
||||||
- views
|
- views
|
||||||
|
TitleStatus:
|
||||||
|
description: Title status
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- finished
|
||||||
|
- ongoing
|
||||||
|
- planned
|
||||||
|
ReleaseSeason:
|
||||||
|
description: Title release season
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- winter
|
||||||
|
- spring
|
||||||
|
- summer
|
||||||
|
- fall
|
||||||
|
StorageType:
|
||||||
|
description: Image storage type
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- s3
|
||||||
|
- local
|
||||||
Image:
|
Image:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -469,65 +481,11 @@ components:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
storage_type:
|
storage_type:
|
||||||
type: string
|
$ref: '#/components/schemas/StorageType'
|
||||||
description: Image storage type
|
|
||||||
enum:
|
|
||||||
- s3
|
|
||||||
- local
|
|
||||||
image_path:
|
image_path:
|
||||||
type: string
|
type: string
|
||||||
TitleStatus:
|
|
||||||
type: string
|
|
||||||
description: Title status
|
|
||||||
enum:
|
|
||||||
- finished
|
|
||||||
- ongoing
|
|
||||||
- planned
|
|
||||||
ReleaseSeason:
|
|
||||||
type: string
|
|
||||||
description: Title release season
|
|
||||||
enum:
|
|
||||||
- winter
|
|
||||||
- spring
|
|
||||||
- summer
|
|
||||||
- fall
|
|
||||||
UserTitleStatus:
|
|
||||||
type: string
|
|
||||||
description: User's title status
|
|
||||||
enum:
|
|
||||||
- finished
|
|
||||||
- planned
|
|
||||||
- dropped
|
|
||||||
- in-progress
|
|
||||||
Review:
|
|
||||||
type: object
|
|
||||||
additionalProperties: true
|
|
||||||
Tag:
|
|
||||||
type: object
|
|
||||||
description: 'A localized tag: keys are language codes (ISO 639-1), values are tag names'
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
example:
|
|
||||||
en: Shojo
|
|
||||||
ru: Сёдзё
|
|
||||||
ja: 少女
|
|
||||||
Tags:
|
|
||||||
type: array
|
|
||||||
description: Array of localized tags
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/Tag'
|
|
||||||
example:
|
|
||||||
- en: Shojo
|
|
||||||
ru: Сёдзё
|
|
||||||
ja: 少女
|
|
||||||
- en: Shounen
|
|
||||||
ru: Сёнен
|
|
||||||
ja: 少年
|
|
||||||
Studio:
|
Studio:
|
||||||
type: object
|
type: object
|
||||||
required:
|
|
||||||
- id
|
|
||||||
- name
|
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
|
|
@ -538,30 +496,41 @@ components:
|
||||||
$ref: '#/components/schemas/Image'
|
$ref: '#/components/schemas/Image'
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
Title:
|
|
||||||
type: object
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- title_names
|
- name
|
||||||
- tags
|
Tag:
|
||||||
properties:
|
description: 'A localized tag: keys are language codes (ISO 639-1), values are tag names'
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Unique title ID (primary key)
|
|
||||||
example: 1
|
|
||||||
title_names:
|
|
||||||
type: object
|
type: object
|
||||||
description: 'Localized titles. Key = language (ISO 639-1), value = list of names'
|
example:
|
||||||
|
en: Shojo
|
||||||
|
ru: Сёдзё
|
||||||
|
ja: 少女
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
|
type: string
|
||||||
|
Tags:
|
||||||
|
description: Array of localized tags
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
$ref: '#/components/schemas/Tag'
|
||||||
example: Attack on Titan
|
|
||||||
minItems: 1
|
|
||||||
example:
|
example:
|
||||||
- Attack on Titan
|
- en: Shojo
|
||||||
- AoT
|
ru: Сёдзё
|
||||||
|
ja: 少女
|
||||||
|
- en: Shounen
|
||||||
|
ru: Сёнен
|
||||||
|
ja: 少年
|
||||||
|
Title:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
description: Unique title ID (primary key)
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
example: 1
|
||||||
|
title_names:
|
||||||
|
description: 'Localized titles. Key = language (ISO 639-1), value = list of names'
|
||||||
|
type: object
|
||||||
example:
|
example:
|
||||||
en:
|
en:
|
||||||
- Attack on Titan
|
- Attack on Titan
|
||||||
|
|
@ -571,6 +540,15 @@ components:
|
||||||
- Титаны
|
- Титаны
|
||||||
ja:
|
ja:
|
||||||
- 進撃の巨人
|
- 進撃の巨人
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
example: Attack on Titan
|
||||||
|
minItems: 1
|
||||||
|
example:
|
||||||
|
- Attack on Titan
|
||||||
|
- AoT
|
||||||
studio:
|
studio:
|
||||||
$ref: '#/components/schemas/Studio'
|
$ref: '#/components/schemas/Studio'
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -602,50 +580,68 @@ components:
|
||||||
type: number
|
type: number
|
||||||
format: double
|
format: double
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
User:
|
required:
|
||||||
|
- id
|
||||||
|
- title_names
|
||||||
|
- tags
|
||||||
|
CursorObj:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
|
param:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
User:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
description: Unique user ID (primary key)
|
description: Unique user ID (primary key)
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
example: 1
|
example: 1
|
||||||
image:
|
image:
|
||||||
$ref: '#/components/schemas/Image'
|
$ref: '#/components/schemas/Image'
|
||||||
mail:
|
mail:
|
||||||
|
description: User email
|
||||||
type: string
|
type: string
|
||||||
format: email
|
format: email
|
||||||
description: User email
|
|
||||||
example: john.doe@example.com
|
example: john.doe@example.com
|
||||||
nickname:
|
nickname:
|
||||||
type: string
|
|
||||||
description: Username (alphanumeric + _ or -)
|
description: Username (alphanumeric + _ or -)
|
||||||
maxLength: 16
|
type: string
|
||||||
example: john_doe_42
|
example: john_doe_42
|
||||||
|
maxLength: 16
|
||||||
disp_name:
|
disp_name:
|
||||||
type: string
|
|
||||||
description: Display name
|
description: Display name
|
||||||
maxLength: 32
|
|
||||||
example: John Doe
|
|
||||||
user_desc:
|
|
||||||
type: string
|
type: string
|
||||||
|
example: John Doe
|
||||||
|
maxLength: 32
|
||||||
|
user_desc:
|
||||||
description: User description
|
description: User description
|
||||||
maxLength: 512
|
type: string
|
||||||
example: Just a regular user.
|
example: Just a regular user.
|
||||||
|
maxLength: 512
|
||||||
creation_date:
|
creation_date:
|
||||||
|
description: Timestamp when the user was created
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
description: Timestamp when the user was created
|
|
||||||
example: '2025-10-10T23:45:47.908073Z'
|
example: '2025-10-10T23:45:47.908073Z'
|
||||||
required:
|
required:
|
||||||
- user_id
|
- user_id
|
||||||
- nickname
|
- nickname
|
||||||
|
UserTitleStatus:
|
||||||
|
description: User's title status
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- finished
|
||||||
|
- planned
|
||||||
|
- dropped
|
||||||
|
- in-progress
|
||||||
UserTitle:
|
UserTitle:
|
||||||
type: object
|
type: object
|
||||||
required:
|
|
||||||
- user_id
|
|
||||||
- title_id
|
|
||||||
- status
|
|
||||||
properties:
|
properties:
|
||||||
user_id:
|
user_id:
|
||||||
type: integer
|
type: integer
|
||||||
|
|
@ -663,3 +659,34 @@ components:
|
||||||
ctime:
|
ctime:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
|
required:
|
||||||
|
- user_id
|
||||||
|
- title_id
|
||||||
|
- status
|
||||||
|
UserTitleMini:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
user_id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
title_id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
status:
|
||||||
|
$ref: '#/components/schemas/UserTitleStatus'
|
||||||
|
rate:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
review_id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
ctime:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
required:
|
||||||
|
- user_id
|
||||||
|
- title_id
|
||||||
|
- status
|
||||||
|
Review:
|
||||||
|
type: object
|
||||||
|
additionalProperties: true
|
||||||
|
|
|
||||||
288
api/api.gen.go
288
api/api.gen.go
|
|
@ -16,12 +16,6 @@ import (
|
||||||
openapi_types "github.com/oapi-codegen/runtime/types"
|
openapi_types "github.com/oapi-codegen/runtime/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Defines values for ImageStorageType.
|
|
||||||
const (
|
|
||||||
Local ImageStorageType = "local"
|
|
||||||
S3 ImageStorageType = "s3"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Defines values for ReleaseSeason.
|
// Defines values for ReleaseSeason.
|
||||||
const (
|
const (
|
||||||
Fall ReleaseSeason = "fall"
|
Fall ReleaseSeason = "fall"
|
||||||
|
|
@ -30,6 +24,12 @@ const (
|
||||||
Winter ReleaseSeason = "winter"
|
Winter ReleaseSeason = "winter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Defines values for StorageType.
|
||||||
|
const (
|
||||||
|
Local StorageType = "local"
|
||||||
|
S3 StorageType = "s3"
|
||||||
|
)
|
||||||
|
|
||||||
// Defines values for TitleSort.
|
// Defines values for TitleSort.
|
||||||
const (
|
const (
|
||||||
Id TitleSort = "id"
|
Id TitleSort = "id"
|
||||||
|
|
@ -65,15 +65,15 @@ type Image struct {
|
||||||
ImagePath *string `json:"image_path,omitempty"`
|
ImagePath *string `json:"image_path,omitempty"`
|
||||||
|
|
||||||
// StorageType Image storage type
|
// StorageType Image storage type
|
||||||
StorageType *ImageStorageType `json:"storage_type,omitempty"`
|
StorageType *StorageType `json:"storage_type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageStorageType Image storage type
|
|
||||||
type ImageStorageType string
|
|
||||||
|
|
||||||
// ReleaseSeason Title release season
|
// ReleaseSeason Title release season
|
||||||
type ReleaseSeason string
|
type ReleaseSeason string
|
||||||
|
|
||||||
|
// StorageType Image storage type
|
||||||
|
type StorageType string
|
||||||
|
|
||||||
// Studio defines model for Studio.
|
// Studio defines model for Studio.
|
||||||
type Studio struct {
|
type Studio struct {
|
||||||
Description *string `json:"description,omitempty"`
|
Description *string `json:"description,omitempty"`
|
||||||
|
|
@ -156,6 +156,18 @@ type UserTitle struct {
|
||||||
UserId int64 `json:"user_id"`
|
UserId int64 `json:"user_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserTitleMini defines model for UserTitleMini.
|
||||||
|
type UserTitleMini struct {
|
||||||
|
Ctime *time.Time `json:"ctime,omitempty"`
|
||||||
|
Rate *int32 `json:"rate,omitempty"`
|
||||||
|
ReviewId *int64 `json:"review_id,omitempty"`
|
||||||
|
|
||||||
|
// Status User's title status
|
||||||
|
Status UserTitleStatus `json:"status"`
|
||||||
|
TitleId int64 `json:"title_id"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
}
|
||||||
|
|
||||||
// UserTitleStatus User's title status
|
// UserTitleStatus User's title status
|
||||||
type UserTitleStatus string
|
type UserTitleStatus string
|
||||||
|
|
||||||
|
|
@ -225,21 +237,30 @@ type GetUsersUserIdTitlesParams struct {
|
||||||
Fields *string `form:"fields,omitempty" json:"fields,omitempty"`
|
Fields *string `form:"fields,omitempty" json:"fields,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateUserTitleJSONBody defines parameters for UpdateUserTitle.
|
||||||
|
type UpdateUserTitleJSONBody struct {
|
||||||
|
Rate *int32 `json:"rate,omitempty"`
|
||||||
|
|
||||||
|
// Status User's title status
|
||||||
|
Status *UserTitleStatus `json:"status,omitempty"`
|
||||||
|
TitleId int64 `json:"title_id"`
|
||||||
|
}
|
||||||
|
|
||||||
// AddUserTitleJSONBody defines parameters for AddUserTitle.
|
// AddUserTitleJSONBody defines parameters for AddUserTitle.
|
||||||
type AddUserTitleJSONBody struct {
|
type AddUserTitleJSONBody struct {
|
||||||
Ctime *time.Time `json:"ctime,omitempty"`
|
|
||||||
Rate *int32 `json:"rate,omitempty"`
|
Rate *int32 `json:"rate,omitempty"`
|
||||||
ReviewId *int64 `json:"review_id,omitempty"`
|
|
||||||
|
|
||||||
// Status User's title status
|
// Status User's title status
|
||||||
Status UserTitleStatus `json:"status"`
|
Status UserTitleStatus `json:"status"`
|
||||||
TitleId int64 `json:"title_id"`
|
TitleId int64 `json:"title_id"`
|
||||||
UserId int64 `json:"user_id"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.
|
// UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.
|
||||||
type UpdateUserJSONRequestBody UpdateUserJSONBody
|
type UpdateUserJSONRequestBody UpdateUserJSONBody
|
||||||
|
|
||||||
|
// UpdateUserTitleJSONRequestBody defines body for UpdateUserTitle for application/json ContentType.
|
||||||
|
type UpdateUserTitleJSONRequestBody UpdateUserTitleJSONBody
|
||||||
|
|
||||||
// AddUserTitleJSONRequestBody defines body for AddUserTitle for application/json ContentType.
|
// AddUserTitleJSONRequestBody defines body for AddUserTitle for application/json ContentType.
|
||||||
type AddUserTitleJSONRequestBody AddUserTitleJSONBody
|
type AddUserTitleJSONRequestBody AddUserTitleJSONBody
|
||||||
|
|
||||||
|
|
@ -499,9 +520,15 @@ type ServerInterface interface {
|
||||||
// Partially update a user account
|
// Partially update a user account
|
||||||
// (PATCH /users/{user_id})
|
// (PATCH /users/{user_id})
|
||||||
UpdateUser(c *gin.Context, userId int64)
|
UpdateUser(c *gin.Context, userId int64)
|
||||||
|
// Delete a usertitle
|
||||||
|
// (DELETE /users/{user_id}/titles)
|
||||||
|
DeleteUserTitle(c *gin.Context, userId int64)
|
||||||
// Get user titles
|
// Get user titles
|
||||||
// (GET /users/{user_id}/titles)
|
// (GET /users/{user_id}/titles)
|
||||||
GetUsersUserIdTitles(c *gin.Context, userId string, params GetUsersUserIdTitlesParams)
|
GetUsersUserIdTitles(c *gin.Context, userId string, params GetUsersUserIdTitlesParams)
|
||||||
|
// Update a usertitle
|
||||||
|
// (PATCH /users/{user_id}/titles)
|
||||||
|
UpdateUserTitle(c *gin.Context, userId int64)
|
||||||
// Add a title to a user
|
// Add a title to a user
|
||||||
// (POST /users/{user_id}/titles)
|
// (POST /users/{user_id}/titles)
|
||||||
AddUserTitle(c *gin.Context, userId int64)
|
AddUserTitle(c *gin.Context, userId int64)
|
||||||
|
|
@ -716,6 +743,30 @@ func (siw *ServerInterfaceWrapper) UpdateUser(c *gin.Context) {
|
||||||
siw.Handler.UpdateUser(c, userId)
|
siw.Handler.UpdateUser(c, userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteUserTitle operation middleware
|
||||||
|
func (siw *ServerInterfaceWrapper) DeleteUserTitle(c *gin.Context) {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
// ------------- Path parameter "user_id" -------------
|
||||||
|
var userId int64
|
||||||
|
|
||||||
|
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||||
|
if err != nil {
|
||||||
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, middleware := range siw.HandlerMiddlewares {
|
||||||
|
middleware(c)
|
||||||
|
if c.IsAborted() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
siw.Handler.DeleteUserTitle(c, userId)
|
||||||
|
}
|
||||||
|
|
||||||
// GetUsersUserIdTitles operation middleware
|
// GetUsersUserIdTitles operation middleware
|
||||||
func (siw *ServerInterfaceWrapper) GetUsersUserIdTitles(c *gin.Context) {
|
func (siw *ServerInterfaceWrapper) GetUsersUserIdTitles(c *gin.Context) {
|
||||||
|
|
||||||
|
|
@ -839,6 +890,30 @@ func (siw *ServerInterfaceWrapper) GetUsersUserIdTitles(c *gin.Context) {
|
||||||
siw.Handler.GetUsersUserIdTitles(c, userId, params)
|
siw.Handler.GetUsersUserIdTitles(c, userId, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateUserTitle operation middleware
|
||||||
|
func (siw *ServerInterfaceWrapper) UpdateUserTitle(c *gin.Context) {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
// ------------- Path parameter "user_id" -------------
|
||||||
|
var userId int64
|
||||||
|
|
||||||
|
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||||
|
if err != nil {
|
||||||
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, middleware := range siw.HandlerMiddlewares {
|
||||||
|
middleware(c)
|
||||||
|
if c.IsAborted() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
siw.Handler.UpdateUserTitle(c, userId)
|
||||||
|
}
|
||||||
|
|
||||||
// AddUserTitle operation middleware
|
// AddUserTitle operation middleware
|
||||||
func (siw *ServerInterfaceWrapper) AddUserTitle(c *gin.Context) {
|
func (siw *ServerInterfaceWrapper) AddUserTitle(c *gin.Context) {
|
||||||
|
|
||||||
|
|
@ -894,7 +969,9 @@ func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options
|
||||||
router.GET(options.BaseURL+"/titles/:title_id", wrapper.GetTitlesTitleId)
|
router.GET(options.BaseURL+"/titles/:title_id", wrapper.GetTitlesTitleId)
|
||||||
router.GET(options.BaseURL+"/users/:user_id", wrapper.GetUsersUserId)
|
router.GET(options.BaseURL+"/users/:user_id", wrapper.GetUsersUserId)
|
||||||
router.PATCH(options.BaseURL+"/users/:user_id", wrapper.UpdateUser)
|
router.PATCH(options.BaseURL+"/users/:user_id", wrapper.UpdateUser)
|
||||||
|
router.DELETE(options.BaseURL+"/users/:user_id/titles", wrapper.DeleteUserTitle)
|
||||||
router.GET(options.BaseURL+"/users/:user_id/titles", wrapper.GetUsersUserIdTitles)
|
router.GET(options.BaseURL+"/users/:user_id/titles", wrapper.GetUsersUserIdTitles)
|
||||||
|
router.PATCH(options.BaseURL+"/users/:user_id/titles", wrapper.UpdateUserTitle)
|
||||||
router.POST(options.BaseURL+"/users/:user_id/titles", wrapper.AddUserTitle)
|
router.POST(options.BaseURL+"/users/:user_id/titles", wrapper.AddUserTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1110,6 +1187,54 @@ func (response UpdateUser500Response) VisitUpdateUserResponse(w http.ResponseWri
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitleRequestObject struct {
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitleResponseObject interface {
|
||||||
|
VisitDeleteUserTitleResponse(w http.ResponseWriter) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitle200Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response DeleteUserTitle200Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(200)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitle401Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response DeleteUserTitle401Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(401)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitle403Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response DeleteUserTitle403Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(403)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitle404Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response DeleteUserTitle404Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(404)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserTitle500Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response DeleteUserTitle500Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(500)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type GetUsersUserIdTitlesRequestObject struct {
|
type GetUsersUserIdTitlesRequestObject struct {
|
||||||
UserId string `json:"user_id"`
|
UserId string `json:"user_id"`
|
||||||
Params GetUsersUserIdTitlesParams
|
Params GetUsersUserIdTitlesParams
|
||||||
|
|
@ -1163,6 +1288,64 @@ func (response GetUsersUserIdTitles500Response) VisitGetUsersUserIdTitlesRespons
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitleRequestObject struct {
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Body *UpdateUserTitleJSONRequestBody
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitleResponseObject interface {
|
||||||
|
VisitUpdateUserTitleResponse(w http.ResponseWriter) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitle200JSONResponse UserTitleMini
|
||||||
|
|
||||||
|
func (response UpdateUserTitle200JSONResponse) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(200)
|
||||||
|
|
||||||
|
return json.NewEncoder(w).Encode(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitle400Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response UpdateUserTitle400Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(400)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitle401Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response UpdateUserTitle401Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(401)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitle403Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response UpdateUserTitle403Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(403)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitle404Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response UpdateUserTitle404Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(404)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateUserTitle500Response struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response UpdateUserTitle500Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||||
|
w.WriteHeader(500)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type AddUserTitleRequestObject struct {
|
type AddUserTitleRequestObject struct {
|
||||||
UserId int64 `json:"user_id"`
|
UserId int64 `json:"user_id"`
|
||||||
Body *AddUserTitleJSONRequestBody
|
Body *AddUserTitleJSONRequestBody
|
||||||
|
|
@ -1172,16 +1355,7 @@ type AddUserTitleResponseObject interface {
|
||||||
VisitAddUserTitleResponse(w http.ResponseWriter) error
|
VisitAddUserTitleResponse(w http.ResponseWriter) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddUserTitle200JSONResponse struct {
|
type AddUserTitle200JSONResponse UserTitleMini
|
||||||
Ctime *time.Time `json:"ctime,omitempty"`
|
|
||||||
Rate *int32 `json:"rate,omitempty"`
|
|
||||||
ReviewId *int64 `json:"review_id,omitempty"`
|
|
||||||
|
|
||||||
// Status User's title status
|
|
||||||
Status UserTitleStatus `json:"status"`
|
|
||||||
TitleId int64 `json:"title_id"`
|
|
||||||
UserId int64 `json:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (response AddUserTitle200JSONResponse) VisitAddUserTitleResponse(w http.ResponseWriter) error {
|
func (response AddUserTitle200JSONResponse) VisitAddUserTitleResponse(w http.ResponseWriter) error {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
@ -1252,9 +1426,15 @@ type StrictServerInterface interface {
|
||||||
// Partially update a user account
|
// Partially update a user account
|
||||||
// (PATCH /users/{user_id})
|
// (PATCH /users/{user_id})
|
||||||
UpdateUser(ctx context.Context, request UpdateUserRequestObject) (UpdateUserResponseObject, error)
|
UpdateUser(ctx context.Context, request UpdateUserRequestObject) (UpdateUserResponseObject, error)
|
||||||
|
// Delete a usertitle
|
||||||
|
// (DELETE /users/{user_id}/titles)
|
||||||
|
DeleteUserTitle(ctx context.Context, request DeleteUserTitleRequestObject) (DeleteUserTitleResponseObject, error)
|
||||||
// Get user titles
|
// Get user titles
|
||||||
// (GET /users/{user_id}/titles)
|
// (GET /users/{user_id}/titles)
|
||||||
GetUsersUserIdTitles(ctx context.Context, request GetUsersUserIdTitlesRequestObject) (GetUsersUserIdTitlesResponseObject, error)
|
GetUsersUserIdTitles(ctx context.Context, request GetUsersUserIdTitlesRequestObject) (GetUsersUserIdTitlesResponseObject, error)
|
||||||
|
// Update a usertitle
|
||||||
|
// (PATCH /users/{user_id}/titles)
|
||||||
|
UpdateUserTitle(ctx context.Context, request UpdateUserTitleRequestObject) (UpdateUserTitleResponseObject, error)
|
||||||
// Add a title to a user
|
// Add a title to a user
|
||||||
// (POST /users/{user_id}/titles)
|
// (POST /users/{user_id}/titles)
|
||||||
AddUserTitle(ctx context.Context, request AddUserTitleRequestObject) (AddUserTitleResponseObject, error)
|
AddUserTitle(ctx context.Context, request AddUserTitleRequestObject) (AddUserTitleResponseObject, error)
|
||||||
|
|
@ -1390,6 +1570,33 @@ func (sh *strictHandler) UpdateUser(ctx *gin.Context, userId int64) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteUserTitle operation middleware
|
||||||
|
func (sh *strictHandler) DeleteUserTitle(ctx *gin.Context, userId int64) {
|
||||||
|
var request DeleteUserTitleRequestObject
|
||||||
|
|
||||||
|
request.UserId = userId
|
||||||
|
|
||||||
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||||
|
return sh.ssi.DeleteUserTitle(ctx, request.(DeleteUserTitleRequestObject))
|
||||||
|
}
|
||||||
|
for _, middleware := range sh.middlewares {
|
||||||
|
handler = middleware(handler, "DeleteUserTitle")
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := handler(ctx, request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
ctx.Error(err)
|
||||||
|
ctx.Status(http.StatusInternalServerError)
|
||||||
|
} else if validResponse, ok := response.(DeleteUserTitleResponseObject); ok {
|
||||||
|
if err := validResponse.VisitDeleteUserTitleResponse(ctx.Writer); err != nil {
|
||||||
|
ctx.Error(err)
|
||||||
|
}
|
||||||
|
} else if response != nil {
|
||||||
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// GetUsersUserIdTitles operation middleware
|
// GetUsersUserIdTitles operation middleware
|
||||||
func (sh *strictHandler) GetUsersUserIdTitles(ctx *gin.Context, userId string, params GetUsersUserIdTitlesParams) {
|
func (sh *strictHandler) GetUsersUserIdTitles(ctx *gin.Context, userId string, params GetUsersUserIdTitlesParams) {
|
||||||
var request GetUsersUserIdTitlesRequestObject
|
var request GetUsersUserIdTitlesRequestObject
|
||||||
|
|
@ -1418,6 +1625,41 @@ func (sh *strictHandler) GetUsersUserIdTitles(ctx *gin.Context, userId string, p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateUserTitle operation middleware
|
||||||
|
func (sh *strictHandler) UpdateUserTitle(ctx *gin.Context, userId int64) {
|
||||||
|
var request UpdateUserTitleRequestObject
|
||||||
|
|
||||||
|
request.UserId = userId
|
||||||
|
|
||||||
|
var body UpdateUserTitleJSONRequestBody
|
||||||
|
if err := ctx.ShouldBindJSON(&body); err != nil {
|
||||||
|
ctx.Status(http.StatusBadRequest)
|
||||||
|
ctx.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
request.Body = &body
|
||||||
|
|
||||||
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||||
|
return sh.ssi.UpdateUserTitle(ctx, request.(UpdateUserTitleRequestObject))
|
||||||
|
}
|
||||||
|
for _, middleware := range sh.middlewares {
|
||||||
|
handler = middleware(handler, "UpdateUserTitle")
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := handler(ctx, request)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
ctx.Error(err)
|
||||||
|
ctx.Status(http.StatusInternalServerError)
|
||||||
|
} else if validResponse, ok := response.(UpdateUserTitleResponseObject); ok {
|
||||||
|
if err := validResponse.VisitUpdateUserTitleResponse(ctx.Writer); err != nil {
|
||||||
|
ctx.Error(err)
|
||||||
|
}
|
||||||
|
} else if response != nil {
|
||||||
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// AddUserTitle operation middleware
|
// AddUserTitle operation middleware
|
||||||
func (sh *strictHandler) AddUserTitle(ctx *gin.Context, userId int64) {
|
func (sh *strictHandler) AddUserTitle(ctx *gin.Context, userId int64) {
|
||||||
var request AddUserTitleRequestObject
|
var request AddUserTitleRequestObject
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,3 @@ components:
|
||||||
$ref: "./parameters/_index.yaml"
|
$ref: "./parameters/_index.yaml"
|
||||||
schemas:
|
schemas:
|
||||||
$ref: "./schemas/_index.yaml"
|
$ref: "./schemas/_index.yaml"
|
||||||
|
|
||||||
|
|
@ -117,11 +117,10 @@ post:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
status:
|
status:
|
||||||
$ref: ../schemas/enums/UserTitleStatus.yaml
|
$ref: '../schemas/enums/UserTitleStatus.yaml'
|
||||||
rate:
|
rate:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Title successfully added to user
|
description: Title successfully added to user
|
||||||
|
|
@ -169,7 +168,7 @@ patch:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
status:
|
status:
|
||||||
$ref: ../schemas/enums/UserTitleStatus.yaml
|
$ref: '../schemas/enums/UserTitleStatus.yaml'
|
||||||
rate:
|
rate:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
|
|
@ -192,3 +191,31 @@ patch:
|
||||||
description: User or Title not found
|
description: User or Title not found
|
||||||
'500':
|
'500':
|
||||||
description: Internal server error
|
description: Internal server error
|
||||||
|
|
||||||
|
delete:
|
||||||
|
summary: Delete a usertitle
|
||||||
|
description: User deleting title from list of watched
|
||||||
|
operationId: deleteUserTitle
|
||||||
|
parameters:
|
||||||
|
- name: user_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
description: ID of the user to assign the title to
|
||||||
|
example: 123
|
||||||
|
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Title successfully deleted
|
||||||
|
# '400':
|
||||||
|
# description: Invalid request body (missing fields, invalid types, etc.)
|
||||||
|
'401':
|
||||||
|
description: Unauthorized — missing or invalid auth token
|
||||||
|
'403':
|
||||||
|
description: Forbidden — user not allowed to delete title
|
||||||
|
'404':
|
||||||
|
description: User or Title not found
|
||||||
|
'500':
|
||||||
|
description: Internal server error
|
||||||
|
|
@ -21,4 +21,3 @@ properties:
|
||||||
ctime:
|
ctime:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
additionalProperties: false
|
|
||||||
|
|
|
||||||
4
deploy/api_gen.ps1
Normal file
4
deploy/api_gen.ps1
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
cd ./api
|
||||||
|
openapi-format .\openapi.yaml --output .\_build\openapi.yaml --yaml
|
||||||
|
cd ..
|
||||||
|
oapi-codegen --config=api\oapi-codegen.yaml api\_build\openapi.yaml
|
||||||
Loading…
Add table
Add a link
Reference in a new issue