chore: coded post req for create posts on db
All checks were successful
Backend ci / build (push) Successful in 7m43s

This commit is contained in:
d3m0k1d
2026-02-03 23:21:01 +03:00
parent 44406b02d3
commit 9b9d45e0a6
14 changed files with 254 additions and 67 deletions

View File

@@ -4,7 +4,7 @@
"contact": {}
},
"paths": {
"/api/v1/posts": {
"/posts": {
"get": {
"description": "Get all posts",
"consumes": [
@@ -23,14 +23,14 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/storage.Post"
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq"
}
}
}
}
},
"post": {
"description": "Create post",
"description": "Create new post",
"consumes": [
"application/json"
],
@@ -41,17 +41,34 @@
"posts"
],
"summary": "Create post",
"parameters": [
{
"description": "Post data",
"name": "post",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/storage.Post"
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/gin.H"
}
}
}
}
},
"/api/v1/posts/{id}": {
"/posts/{id}": {
"get": {
"description": "Get post by id",
"consumes": [
@@ -68,7 +85,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/storage.Post"
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq"
}
}
}
@@ -89,7 +106,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/storage.Post"
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.Post"
}
}
}
@@ -110,7 +127,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/storage.Post"
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.Post"
}
}
}
@@ -118,7 +135,11 @@
}
},
"definitions": {
"storage.Post": {
"gin.H": {
"type": "object",
"additionalProperties": {}
},
"gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.Post": {
"type": "object",
"properties": {
"content": {
@@ -134,6 +155,28 @@
"type": "string"
}
}
},
"gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostCreate": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"title": {
"type": "string"
}
}
}
}
}