feat: implemented /users/{id} api route
This commit is contained in:
parent
71e2661fb9
commit
948e036e8c
10 changed files with 381 additions and 982 deletions
298
api/openapi.yaml
298
api/openapi.yaml
|
|
@ -5,40 +5,40 @@ info:
|
|||
servers:
|
||||
- url: https://api.example.com
|
||||
paths:
|
||||
/title:
|
||||
get:
|
||||
summary: Get titles
|
||||
parameters:
|
||||
- in: query
|
||||
name: query
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: limit
|
||||
schema:
|
||||
type: integer
|
||||
default: 10
|
||||
- in: query
|
||||
name: offset
|
||||
schema:
|
||||
type: integer
|
||||
default: 0
|
||||
- in: query
|
||||
name: fields
|
||||
schema:
|
||||
type: string
|
||||
default: all
|
||||
responses:
|
||||
'200':
|
||||
description: List of titles
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Title'
|
||||
'204':
|
||||
description: No titles found
|
||||
# /title:
|
||||
# get:
|
||||
# summary: Get titles
|
||||
# parameters:
|
||||
# - in: query
|
||||
# name: query
|
||||
# schema:
|
||||
# type: string
|
||||
# - in: query
|
||||
# name: limit
|
||||
# schema:
|
||||
# type: integer
|
||||
# default: 10
|
||||
# - in: query
|
||||
# name: offset
|
||||
# schema:
|
||||
# type: integer
|
||||
# default: 0
|
||||
# - in: query
|
||||
# name: fields
|
||||
# schema:
|
||||
# type: string
|
||||
# default: all
|
||||
# responses:
|
||||
# '200':
|
||||
# description: List of titles
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: array
|
||||
# items:
|
||||
# $ref: '#/components/schemas/Title'
|
||||
# '204':
|
||||
# description: No titles found
|
||||
|
||||
# /title/{title_id}:
|
||||
# get:
|
||||
|
|
@ -124,122 +124,122 @@ paths:
|
|||
# '204':
|
||||
# description: No reviews found
|
||||
|
||||
# /users/{user_id}:
|
||||
# get:
|
||||
# summary: Get user info
|
||||
# parameters:
|
||||
# - in: path
|
||||
# name: user_id
|
||||
# required: true
|
||||
# schema:
|
||||
# type: string
|
||||
# - in: query
|
||||
# name: fields
|
||||
# schema:
|
||||
# type: string
|
||||
# default: all
|
||||
# responses:
|
||||
# '200':
|
||||
# description: User info
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# '404':
|
||||
# description: User not found
|
||||
/users/{user_id}:
|
||||
get:
|
||||
summary: Get user info
|
||||
parameters:
|
||||
- in: path
|
||||
name: user_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: fields
|
||||
schema:
|
||||
type: string
|
||||
default: all
|
||||
responses:
|
||||
'200':
|
||||
description: User info
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'404':
|
||||
description: User not found
|
||||
|
||||
# patch:
|
||||
# summary: Update user
|
||||
# parameters:
|
||||
# - in: path
|
||||
# name: user_id
|
||||
# required: true
|
||||
# schema:
|
||||
# type: string
|
||||
# requestBody:
|
||||
# required: true
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# responses:
|
||||
# '200':
|
||||
# description: Update result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# success:
|
||||
# type: boolean
|
||||
# error:
|
||||
# type: string
|
||||
# patch:
|
||||
# summary: Update user
|
||||
# parameters:
|
||||
# - in: path
|
||||
# name: user_id
|
||||
# required: true
|
||||
# schema:
|
||||
# type: string
|
||||
# requestBody:
|
||||
# required: true
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# responses:
|
||||
# '200':
|
||||
# description: Update result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# success:
|
||||
# type: boolean
|
||||
# error:
|
||||
# type: string
|
||||
|
||||
# delete:
|
||||
# summary: Delete user
|
||||
# parameters:
|
||||
# - in: path
|
||||
# name: user_id
|
||||
# required: true
|
||||
# schema:
|
||||
# type: string
|
||||
# responses:
|
||||
# '200':
|
||||
# description: Delete result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# success:
|
||||
# type: boolean
|
||||
# error:
|
||||
# type: string
|
||||
# delete:
|
||||
# summary: Delete user
|
||||
# parameters:
|
||||
# - in: path
|
||||
# name: user_id
|
||||
# required: true
|
||||
# schema:
|
||||
# type: string
|
||||
# responses:
|
||||
# '200':
|
||||
# description: Delete result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# success:
|
||||
# type: boolean
|
||||
# error:
|
||||
# type: string
|
||||
|
||||
# /users:
|
||||
# get:
|
||||
# summary: Search user
|
||||
# parameters:
|
||||
# - in: query
|
||||
# name: query
|
||||
# schema:
|
||||
# type: string
|
||||
# - in: query
|
||||
# name: fields
|
||||
# schema:
|
||||
# type: string
|
||||
# responses:
|
||||
# '200':
|
||||
# description: List of users
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: array
|
||||
# items:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# /users:
|
||||
# get:
|
||||
# summary: Search user
|
||||
# parameters:
|
||||
# - in: query
|
||||
# name: query
|
||||
# schema:
|
||||
# type: string
|
||||
# - in: query
|
||||
# name: fields
|
||||
# schema:
|
||||
# type: string
|
||||
# responses:
|
||||
# '200':
|
||||
# description: List of users
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: array
|
||||
# items:
|
||||
# $ref: '#/components/schemas/User'
|
||||
|
||||
# post:
|
||||
# summary: Add new user
|
||||
# requestBody:
|
||||
# required: true
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# responses:
|
||||
# '200':
|
||||
# description: Add result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# success:
|
||||
# type: boolean
|
||||
# error:
|
||||
# type: string
|
||||
# user_json:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# post:
|
||||
# summary: Add new user
|
||||
# requestBody:
|
||||
# required: true
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# $ref: '#/components/schemas/User'
|
||||
# responses:
|
||||
# '200':
|
||||
# description: Add result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# success:
|
||||
# type: boolean
|
||||
# error:
|
||||
# type: string
|
||||
# user_json:
|
||||
# $ref: '#/components/schemas/User'
|
||||
|
||||
# /users/{user_id}/titles:
|
||||
# get:
|
||||
|
|
@ -541,14 +541,14 @@ components:
|
|||
User:
|
||||
type: object
|
||||
properties:
|
||||
user_id:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
description: Unique user ID (primary key)
|
||||
example: 1
|
||||
avatar_id:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
description: ID of the user avatar (references images table)
|
||||
nullable: true
|
||||
example: null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue