Files
auth-service/src/users/users.responses.ts

81 lines
2.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {ApiResponseOptions, ApiProperty} from '@nestjs/swagger';
import {UserResponse, UpdateUserRequest} from './users.schema';
class Error {
@ApiProperty()
statusCode: number;
@ApiProperty()
message: string;
@ApiProperty()
error: string;
}
export const FIND_ALL_SUCCESS: ApiResponseOptions = {
status: 200,
description: 'Список всех пользователей',
type: UserResponse,
isArray: true
};
export const FIND_ONE_SUCCESS: ApiResponseOptions = {
status: 200,
description: 'Пользователь найденный по логину',
type: UserResponse,
};
export const FIND_ONE_NOT_FOUND: ApiResponseOptions = {
status: 404,
description: 'Ошибка при попытке получить несуществующего пользователя',
type: Error,
};
export const CREATE_SUCCESS: ApiResponseOptions = {
status: 201,
description: 'Создает пользователя в системе',
type: UserResponse,
};
export const CREATE_CONFLICT: ApiResponseOptions = {
status: 409,
description: 'Объект вновь созданного пользователя',
type: Error,
};
export const CREATE_NOT_VALID: ApiResponseOptions = {
status: 400,
description: 'Ошибка при попытке создания пользователя с уже существующим логином',
type: Error,
};
export const UPDATE_SUCCESS: ApiResponseOptions = {
status: 200,
description: 'Объект для обновления пользователя',
type: UpdateUserRequest,
};
export const UPDATE_NOT_FOUND: ApiResponseOptions = {
status: 404,
description: 'Ошибка при попытке обновить пользователя с несуществующим логином',
type: Error,
};
export const UPDATE_NOT_VALID: ApiResponseOptions = {
status: 400,
description: 'Ошибка при попытке обновить пользователя с невалидными полями',
type: Error,
};
export const REMOVE_SUCCESS: ApiResponseOptions = {
status: 200,
description: 'Объект удаленного пользователя',
type: UpdateUserRequest,
};
export const REMOVE_NOT_FOUND: ApiResponseOptions = {
status: 404,
description: 'Ошибка при попытке удалить пользователя с несуществующим логином',
type: Error,
};