diff --git a/.http b/.http index c721d93..e8281bc 100644 --- a/.http +++ b/.http @@ -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" + } + ] } } diff --git a/src/app.controller.ts b/src/app.controller.ts index 3baf36a..8423d37 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -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) diff --git a/src/schemas.ts b/src/schemas.ts index e3db43b..94205b0 100644 --- a/src/schemas.ts +++ b/src/schemas.ts @@ -68,3 +68,8 @@ export class StorageCreateRequest implements StorageCreate { @ApiProperty() storageName: string; } + +export class StorageUpdateRequest { + @ApiProperty() + data: object; +} diff --git a/src/types.ts b/src/types.ts index e4b6727..639f912 100644 --- a/src/types.ts +++ b/src/types.ts @@ -23,5 +23,5 @@ export type StorageCreate = { export type StorageUpdate = { data: object; - storageName?: string; + storageName: string; };