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 ### 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 @user = test_user
@auth = 7b5da8a1-b64c-43ea-90f3-cdd3da507504 @auth = 6d4c2f3e-e9ae-4a57-8a10-91656e4902eb
@storage_id = 67c420ab38fafe445411e76a @storage_id = 6817ac44687546864fb1f5ac
### Auth ### Auth
POST {{host}}/auth HTTP/1.1 POST {{host}}/auth HTTP/1.1
@ -28,10 +28,9 @@ Authorization: {{auth}}
{ {
"data": { "data": {
"users": ["ivan", "maria"], "tasks": []
"count": 2
}, },
"storageName": "users" "storageName": "tasks"
} }
### Get storage ### Get storage
@ -46,8 +45,23 @@ Authorization: {{auth}}
{ {
"data": { "data": {
"users": ["ivan", "maria", "fedor"], "tasks": [
"count": 3 {
"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, MANIPULATE_STORAGE_SUCCESS,
GET_STORAGES_LIST_SUCCESS, GET_STORAGES_LIST_SUCCESS,
} from './api.responses'; } from './api.responses';
import { AuthRequest, StorageCreateRequest } from './schemas'; import {
AuthRequest,
StorageCreateRequest,
StorageUpdateRequest,
} from './schemas';
import { Storage, StorageCreate, StorageList, StorageUpdate } from './types'; import { Storage, StorageCreate, StorageList, StorageUpdate } from './types';
@Controller() @Controller()
@ -107,6 +111,10 @@ export class AppController {
name: 'id', name: 'id',
description: 'id storage', description: 'id storage',
}) })
@ApiBody({
type: StorageUpdateRequest,
description: 'Объект обновления storage',
})
@Header(...ALLOW_ORIGIN_ALL) @Header(...ALLOW_ORIGIN_ALL)
@ApiResponse(MANIPULATE_STORAGE_SUCCESS) @ApiResponse(MANIPULATE_STORAGE_SUCCESS)
@ApiResponse(AUTH_ERROR) @ApiResponse(AUTH_ERROR)

View File

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

View File

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