patch: fix schemas

This commit is contained in:
Николай Вигдоров
2025-05-05 16:23:49 +03:00
parent 6546225e4f
commit 1526e52d60
4 changed files with 37 additions and 10 deletions

30
.http
View File

@ -1,8 +1,8 @@
### use REST Client plugin for VSCode https://marketplace.visualstudio.com/items?itemName=humao.rest-client
@host = http://localhost:4005
@host = https://simple-storage.vigdorov.ru
@user = test_user
@auth = 7b5da8a1-b64c-43ea-90f3-cdd3da507504
@storage_id = 67c420ab38fafe445411e76a
@auth = 6d4c2f3e-e9ae-4a57-8a10-91656e4902eb
@storage_id = 6817ac44687546864fb1f5ac
### Auth
POST {{host}}/auth HTTP/1.1
@ -28,10 +28,9 @@ Authorization: {{auth}}
{
"data": {
"users": ["ivan", "maria"],
"count": 2
"tasks": []
},
"storageName": "users"
"storageName": "tasks"
}
### Get storage
@ -46,8 +45,23 @@ Authorization: {{auth}}
{
"data": {
"users": ["ivan", "maria", "fedor"],
"count": 3
"tasks": [
{
"title": "task #1"
},
{
"title": "task #1"
},
{
"title": "task #1"
},
{
"title": "task #1"
},
{
"title": "task #1"
}
]
}
}

View File

@ -32,7 +32,11 @@ import {
MANIPULATE_STORAGE_SUCCESS,
GET_STORAGES_LIST_SUCCESS,
} from './api.responses';
import { AuthRequest, StorageCreateRequest } from './schemas';
import {
AuthRequest,
StorageCreateRequest,
StorageUpdateRequest,
} from './schemas';
import { Storage, StorageCreate, StorageList, StorageUpdate } from './types';
@Controller()
@ -107,6 +111,10 @@ export class AppController {
name: 'id',
description: 'id storage',
})
@ApiBody({
type: StorageUpdateRequest,
description: 'Объект обновления storage',
})
@Header(...ALLOW_ORIGIN_ALL)
@ApiResponse(MANIPULATE_STORAGE_SUCCESS)
@ApiResponse(AUTH_ERROR)

View File

@ -68,3 +68,8 @@ export class StorageCreateRequest implements StorageCreate {
@ApiProperty()
storageName: string;
}
export class StorageUpdateRequest {
@ApiProperty()
data: object;
}

View File

@ -23,5 +23,5 @@ export type StorageCreate = {
export type StorageUpdate = {
data: object;
storageName?: string;
storageName: string;
};