Added authorization
This commit is contained in:
parent
c3c3d65d32
commit
b96dd39795
50 changed files with 685 additions and 410 deletions
|
|
@ -2,6 +2,8 @@ basePath: /api/v1
|
|||
definitions:
|
||||
requests.CreatePostRequest:
|
||||
properties:
|
||||
category:
|
||||
type: string
|
||||
content:
|
||||
minLength: 36
|
||||
type: string
|
||||
|
|
@ -9,6 +11,10 @@ definitions:
|
|||
maxLength: 255
|
||||
minLength: 8
|
||||
type: string
|
||||
tags:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title:
|
||||
maxLength: 255
|
||||
minLength: 8
|
||||
|
|
@ -35,6 +41,20 @@ definitions:
|
|||
- password
|
||||
- username
|
||||
type: object
|
||||
requests.LoginUserRequest:
|
||||
properties:
|
||||
password:
|
||||
maxLength: 32
|
||||
minLength: 6
|
||||
type: string
|
||||
username:
|
||||
maxLength: 32
|
||||
minLength: 3
|
||||
type: string
|
||||
required:
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
requests.PutPostRequest:
|
||||
properties:
|
||||
content:
|
||||
|
|
@ -67,15 +87,36 @@ definitions:
|
|||
type: object
|
||||
responses.GetListPostResponseItem:
|
||||
properties:
|
||||
category:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
tags:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
userId:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
responses.ImageResponse:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
path:
|
||||
type: string
|
||||
type: object
|
||||
responses.PostResponse:
|
||||
properties:
|
||||
category:
|
||||
type: string
|
||||
content:
|
||||
type: string
|
||||
createdAt:
|
||||
|
|
@ -84,12 +125,18 @@ definitions:
|
|||
type: string
|
||||
id:
|
||||
type: string
|
||||
tags:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
userId:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
responses.UserResponse:
|
||||
properties:
|
||||
|
|
@ -112,13 +159,36 @@ info:
|
|||
title: 58team blog backend
|
||||
version: "1.0"
|
||||
paths:
|
||||
/images/:
|
||||
post:
|
||||
description: Upload new image and returns uploaded image json object
|
||||
parameters:
|
||||
- description: image file
|
||||
in: formData
|
||||
name: file
|
||||
required: true
|
||||
type: file
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ImageResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Upload new image
|
||||
tags:
|
||||
- images
|
||||
/images/{path}:
|
||||
get:
|
||||
description: get image by path
|
||||
delete:
|
||||
description: Delete image from server by given path
|
||||
parameters:
|
||||
- description: Path to image
|
||||
in: query
|
||||
name: path
|
||||
in: path
|
||||
name: filename
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
|
|
@ -127,7 +197,103 @@ paths:
|
|||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Delete image by path
|
||||
tags:
|
||||
- images
|
||||
get:
|
||||
description: get image by path
|
||||
parameters:
|
||||
- description: Path to image
|
||||
in: path
|
||||
name: path
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/octet-stream
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: file
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Get an image by path
|
||||
tags:
|
||||
- images
|
||||
/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Login user into system
|
||||
parameters:
|
||||
- description: User login data
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/requests.LoginUserRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Login
|
||||
tags:
|
||||
- user
|
||||
/logout:
|
||||
get:
|
||||
description: Creates new user in system
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Create new user
|
||||
tags:
|
||||
- user
|
||||
/post:
|
||||
get:
|
||||
description: Return first 5 posts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue