diff --git a/README.md b/README.md index 376cb06..0407560 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Sistema bus kuriama naudojant modernias technologijas, o diegimas bus supaprasti ### Funkciniai reikalavimai #### Bendrieji reikalavimai -- Sistema privalo turėti vartotojo sąsają, kuri leistų peržiūrėti, įkelti, ir tvarkyti nuotraukas bei komentarus. +- Sistema privalo turėti naudotojo sąsają, kuri leistų peržiūrėti, įkelti, ir tvarkyti nuotraukas bei komentarus. - Duomenų bazė turi būti lengvai keičiama dėl pasirinkto _ORM_ (angl. Object-Relational Mapping) sluoksnio. - Serverio ir klientinės dalys turi būti supakuotos į vieną diegimo vienetą (binary), siekiant supaprastinti diegiamosios sistemos procesą. @@ -81,7 +81,5 @@ Automatiškai bus sukurta administratoriaus paskyra: ## API dokumentacija -API dokumentacija yra pasiekiama naudojant `Development` versiją šia nuoroda: +API dokumentacija yra pasiekiama OpenAPI 3 JSON formatu naudojant `Development` versiją per šią nuorodą: http://localhost:5259/swagger/v1/swagger.json - -Failo kopija yra pateikiama repozitorijoje pavadinta `swagger.json`. Nebūtinai naujausia versija. diff --git a/T120B165-ImgBoard/Controllers/PostController.cs b/T120B165-ImgBoard/Controllers/PostController.cs index 3e81bed..9824752 100644 --- a/T120B165-ImgBoard/Controllers/PostController.cs +++ b/T120B165-ImgBoard/Controllers/PostController.cs @@ -22,7 +22,8 @@ public class PostController( ITagService tagService, ICommentService commentService, IFileService fileService, - IWebHostEnvironment env + IWebHostEnvironment env, + ILogger logger ): ControllerBase { @@ -117,6 +118,7 @@ public class PostController( /// If request is malformed /// If authentication is missing /// If authorization is missing + /// If data provided does not fit constraints [HttpPost] [Authorize(Roles = UserRoles.Regular)] [ProducesResponseType(StatusCodes.Status201Created)] @@ -129,6 +131,11 @@ public class PostController( var userId = HttpContext.User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value; var user = await userService.GetUserById(userId); if (user == null) return Unauthorized(); + + if (dto.FileSize.Value > 10*1024*1024) return Problem("File cannot exceed 10MB", statusCode: StatusCodes.Status422UnprocessableEntity); + + if (dto.FileMimeType != "image/png" && dto.FileMimeType != "image/jpeg") + return Problem("File must be image", statusCode: StatusCodes.Status422UnprocessableEntity); var maybeTags = await TagNamesToTags(dto.Tags); List tags; @@ -164,6 +171,7 @@ public class PostController( /// If authentication is missing /// If authorization is missing /// If post or file is not found + /// If a chunk was already uploaded /// If finished upload mime does not match provided [HttpPatch("{postId:int}/files/{fileId:int}")] [Authorize(Roles = UserRoles.Regular)] @@ -214,11 +222,18 @@ public class PostController( // Append the chunk to the temporary file var tempFilePath = fileRecord.FilePath; - await using (var stream = new FileStream(tempFilePath, FileMode.Append, FileAccess.Write, FileShare.None, bufferSize: 4096, useAsync: true)) + try { + await using var stream = new FileStream(tempFilePath, FileMode.Append, FileAccess.Write, FileShare.None, + bufferSize: 4096, useAsync: true); stream.Seek(start, SeekOrigin.Begin); await Request.Body.CopyToAsync(stream); } + catch (Exception e) + { + logger.LogCritical(e.ToString()); + return Problem("Chunk has already been uploaded", statusCode: StatusCodes.Status409Conflict); + } // Check if the upload is complete // Return 202 Accepted for a successful intermediate chunk diff --git a/swagger.json b/swagger.json deleted file mode 100644 index 26e6f05..0000000 --- a/swagger.json +++ /dev/null @@ -1,1482 +0,0 @@ -{ - "x-generator": "NSwag v14.5.0.0 (NJsonSchema v11.4.0.0 (Newtonsoft.Json v13.0.0.0))", - "openapi": "3.0.0", - "info": { - "title": "My Title", - "version": "1.0.0" - }, - "servers": [ - { - "url": "http://localhost:5259" - } - ], - "paths": { - "/api/auth/register": { - "post": { - "tags": [ - "Auth" - ], - "operationId": "Auth_Register", - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegisterDto" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - } - } - } - }, - "/api/auth/login": { - "post": { - "tags": [ - "Auth" - ], - "operationId": "Auth_Login", - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoginDto" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TokenDto" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/auth/refresh": { - "post": { - "tags": [ - "Auth" - ], - "operationId": "Auth_Refresh", - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RefreshDto" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TokenDto" - } - } - } - }, - "401": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/posts": { - "post": { - "tags": [ - "Post" - ], - "operationId": "Post_Create", - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreatePostDto" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PostDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "409": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "get": { - "tags": [ - "Post" - ], - "operationId": "Post_GetAll", - "parameters": [ - { - "name": "pageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32", - "default": 1, - "maximum": 2147483647.0, - "minimum": 1.0 - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedListOfPostDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/posts/{postId}/files/{fileId}": { - "patch": { - "tags": [ - "Post" - ], - "operationId": "Post_PatchFileContent", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - }, - { - "name": "fileId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 2 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - } - } - }, - "get": { - "tags": [ - "Post" - ], - "operationId": "Post_GetFileContent", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - }, - { - "name": "fileId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 2 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/octet-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - } - } - } - }, - "/api/posts/{id}": { - "get": { - "tags": [ - "Post" - ], - "operationId": "Post_Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PostDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Post" - ], - "operationId": "Post_Delete", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "patch": { - "tags": [ - "Post" - ], - "operationId": "Post_Update", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EditPostDto" - } - } - }, - "required": true, - "x-position": 2 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PostDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/posts/{postId}/comments": { - "post": { - "tags": [ - "Post" - ], - "operationId": "Post_CreateComment", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - } - ], - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateCommentDto" - } - } - }, - "required": true, - "x-position": 2 - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PostDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "409": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "get": { - "tags": [ - "Post" - ], - "operationId": "Post_GetAllComments", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - }, - { - "name": "pageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32", - "default": 1, - "maximum": 2147483647.0, - "minimum": 1.0 - }, - "x-position": 2 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedListOfCommentDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/posts/{postId}/comments/{commentId}": { - "get": { - "tags": [ - "Post" - ], - "operationId": "Post_GetComment", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - }, - { - "name": "commentId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 2 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CommentDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Post" - ], - "operationId": "Post_DeleteComment", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - }, - { - "name": "commentId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 2 - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "patch": { - "tags": [ - "Post" - ], - "operationId": "Post_Update2", - "parameters": [ - { - "name": "postId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 1 - }, - { - "name": "commentId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - }, - "x-position": 2 - } - ], - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EditCommentDto" - } - } - }, - "required": true, - "x-position": 3 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CommentDto" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/tags": { - "post": { - "tags": [ - "Tag" - ], - "operationId": "Tag_Create", - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateTagDto" - } - } - }, - "required": true, - "x-position": 1 - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Tag" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "409": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "get": { - "tags": [ - "Tag" - ], - "operationId": "Tag_GetAll", - "parameters": [ - { - "name": "pageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedListOfTag" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/tags/{name}": { - "get": { - "tags": [ - "Tag" - ], - "operationId": "Tag_Get", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Tag" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Tag" - ], - "operationId": "Tag_Delete", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "responses": { - "204": { - "description": "" - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - }, - "patch": { - "tags": [ - "Tag" - ], - "operationId": "Tag_Update", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "x-position": 1 - } - ], - "requestBody": { - "x-name": "dto", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EditTagDto" - } - } - }, - "required": true, - "x-position": 2 - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Tag" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "User": { - "allOf": [ - { - "$ref": "#/components/schemas/IdentityUser" - }, - { - "type": "object", - "additionalProperties": false - } - ] - }, - "IdentityUser": { - "allOf": [ - { - "$ref": "#/components/schemas/IdentityUserOfString" - }, - { - "type": "object", - "description": "The default implementation of IdentityUser`1 which uses a string as a primary key.", - "additionalProperties": false - } - ] - }, - "IdentityUserOfString": { - "type": "object", - "description": "Represents a user in the identity system", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "description": "Gets or sets the primary key for this user.", - "nullable": true - }, - "userName": { - "type": "string", - "description": "Gets or sets the user name for this user.", - "nullable": true - }, - "normalizedUserName": { - "type": "string", - "description": "Gets or sets the normalized user name for this user.", - "nullable": true - }, - "email": { - "type": "string", - "description": "Gets or sets the email address for this user.", - "nullable": true - }, - "normalizedEmail": { - "type": "string", - "description": "Gets or sets the normalized email address for this user.", - "nullable": true - }, - "emailConfirmed": { - "type": "boolean", - "description": "Gets or sets a flag indicating if a user has confirmed their email address." - }, - "passwordHash": { - "type": "string", - "description": "Gets or sets a salted and hashed representation of the password for this user.", - "nullable": true - }, - "securityStamp": { - "type": "string", - "description": "A random value that must change whenever a users credentials change (password changed, login removed)", - "nullable": true - }, - "concurrencyStamp": { - "type": "string", - "description": "A random value that must change whenever a user is persisted to the store", - "nullable": true - }, - "phoneNumber": { - "type": "string", - "description": "Gets or sets a telephone number for the user.", - "nullable": true - }, - "phoneNumberConfirmed": { - "type": "boolean", - "description": "Gets or sets a flag indicating if a user has confirmed their telephone address." - }, - "twoFactorEnabled": { - "type": "boolean", - "description": "Gets or sets a flag indicating if two factor authentication is enabled for this user." - }, - "lockoutEnd": { - "type": "string", - "description": "Gets or sets the date and time, in UTC, when any user lockout ends.", - "format": "date-time", - "nullable": true - }, - "lockoutEnabled": { - "type": "boolean", - "description": "Gets or sets a flag indicating if the user could be locked out." - }, - "accessFailedCount": { - "type": "integer", - "description": "Gets or sets the number of failed login attempts for the current user.", - "format": "int32" - } - } - }, - "RegisterDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "userName": { - "type": "string" - }, - "email": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "TokenDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "accessToken": { - "type": "string" - }, - "refreshToken": { - "type": "string" - } - } - }, - "ProblemDetails": { - "type": "object", - "additionalProperties": { - "nullable": true - }, - "properties": { - "type": { - "type": "string", - "nullable": true - }, - "title": { - "type": "string", - "nullable": true - }, - "status": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "detail": { - "type": "string", - "nullable": true - }, - "instance": { - "type": "string", - "nullable": true - }, - "extensions": { - "type": "object", - "additionalProperties": {} - } - } - }, - "LoginDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "email": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "RefreshDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "refreshToken": { - "type": "string" - } - } - }, - "PostDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "author": { - "$ref": "#/components/schemas/SlimUserDto" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Tag" - } - }, - "fileUrl": { - "type": "string", - "nullable": true - } - } - }, - "SlimUserDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "userId": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "Tag": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/TagType" - } - } - }, - "TagType": { - "type": "string", - "description": "", - "x-enum-names": [ - "General", - "Copyright" - ], - "x-enum-varnames": [ - "General", - "Copyright" - ], - "x-enumNames": [ - "General", - "Copyright" - ], - "x-enum-descriptions": [ - null, - null - ], - "x-enumDescriptions": [ - null, - null - ], - "enum": [ - "General", - "Copyright" - ] - }, - "CreatePostDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "fileName": { - "type": "string" - }, - "fileMimeType": { - "type": "string" - }, - "fileSize": { - "type": "integer", - "format": "int64", - "nullable": true - } - } - }, - "PagedListOfPostDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "currentPage": { - "type": "integer", - "format": "int32" - }, - "pageSize": { - "type": "integer", - "format": "int32" - }, - "totalCount": { - "type": "integer", - "format": "int32" - }, - "totalPages": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PostDto" - } - } - } - }, - "EditPostDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "string", - "nullable": true - }, - "description": { - "type": "string", - "nullable": true - }, - "tags": { - "type": "array", - "nullable": true, - "items": { - "type": "string" - } - } - } - }, - "CreateCommentDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "text": { - "type": "string" - } - } - }, - "CommentDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "text": { - "type": "string" - }, - "author": { - "$ref": "#/components/schemas/SlimUserDto" - } - } - }, - "PagedListOfCommentDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "currentPage": { - "type": "integer", - "format": "int32" - }, - "pageSize": { - "type": "integer", - "format": "int32" - }, - "totalCount": { - "type": "integer", - "format": "int32" - }, - "totalPages": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CommentDto" - } - } - } - }, - "EditCommentDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "text": { - "type": "string" - } - } - }, - "CreateTagDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "$ref": "#/components/schemas/TagType" - }, - "name": { - "type": "string" - } - } - }, - "PagedListOfTag": { - "type": "object", - "additionalProperties": false, - "properties": { - "currentPage": { - "type": "integer", - "format": "int32" - }, - "pageSize": { - "type": "integer", - "format": "int32" - }, - "totalCount": { - "type": "integer", - "format": "int32" - }, - "totalPages": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Tag" - } - } - } - }, - "EditTagDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "$ref": "#/components/schemas/TagType" - } - } - } - } - } -} \ No newline at end of file