104 lines
2.1 KiB
TypeScript

// eslint-disable-next-line max-classes-per-file
import { ApiProperty } from '@nestjs/swagger';
import { ExpenseItem, ExpenseItemFromType, ExpenseList } from '@prisma/client';
import { Type } from 'class-transformer';
class ExpensePaymentDto {
@ApiProperty({
description: 'Способ оплаты',
example: 'CASH',
enum: ExpenseItemFromType,
nullable: true,
})
type: ExpenseItemFromType | null;
@ApiProperty({
description: 'ID карты или наличных ',
example: '123',
type: String,
nullable: true,
})
id: string | null;
}
export class ExpenseListItemDto {
@ApiProperty({
description: 'ID',
type: String,
})
id: ExpenseItem['id'];
@ApiProperty({
description: 'ID списка',
type: String,
})
expenseListId: ExpenseList['id'];
@ApiProperty({
description: 'Заголовок расхода',
example: 'Кофе',
type: String,
})
title: ExpenseItem['title'];
@ApiProperty({
description: 'Описание',
example: 'Перед работой',
type: String,
nullable: true,
})
description: ExpenseItem['description'];
@ApiProperty({
description: 'Дата',
example: '2025-08-22T04:12:03.726Z',
type: Date,
})
date: ExpenseItem['date'];
@ApiProperty({
description: 'Сумма расхода',
example: 175.50,
type: Number,
})
amount: ExpenseItem['amount'];
@ApiProperty({
description: 'Валюта расхода',
example: 'RUB',
type: String,
default: 'RUB',
nullable: true,
})
currency: ExpenseItem['currency'];
@ApiProperty({
description: 'Количество',
example: 2,
type: Number,
default: 1,
nullable: true,
})
count: ExpenseItem['count'];
@ApiProperty({
description: 'Оплата',
type: ExpensePaymentDto,
nullable: true,
})
@Type(() => ExpensePaymentDto)
payment?: ExpensePaymentDto;
@ApiProperty({
description: 'Дата создания',
type: Date,
})
createdAt: Date;
@ApiProperty({
description: 'Дата обновления',
type: Date,
})
updatedAt: Date;
}