mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 08:34:55 +00:00
feat: money requests
This commit is contained in:
@ -0,0 +1,41 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { JuniorResponseDto } from '~/junior/dtos/response';
|
||||
import { MoneyRequest } from '~/money-request/entities/money-request.entity';
|
||||
import { MoneyRequestStatus } from '~/money-request/enums';
|
||||
|
||||
export class MoneyRequestResponseDto {
|
||||
@ApiProperty({ example: '123e4567-e89b-12d3-a456-426614174000' })
|
||||
id!: string;
|
||||
|
||||
@ApiProperty({ example: 300.42 })
|
||||
amount!: number;
|
||||
|
||||
@ApiProperty({ example: 'For school supplies' })
|
||||
reason!: string;
|
||||
|
||||
@ApiProperty({ enum: MoneyRequestStatus, example: MoneyRequestStatus.PENDING })
|
||||
status!: MoneyRequestStatus;
|
||||
|
||||
@ApiProperty({ example: null })
|
||||
rejectionReason!: string | null;
|
||||
|
||||
@ApiProperty({ type: JuniorResponseDto })
|
||||
junior!: JuniorResponseDto;
|
||||
|
||||
@ApiProperty({ example: '2024-01-01T00:00:00.000Z' })
|
||||
createdAt!: Date;
|
||||
|
||||
@ApiProperty({ example: '2024-01-02T00:00:00.000Z' })
|
||||
updatedAt!: Date;
|
||||
|
||||
constructor(data: MoneyRequest) {
|
||||
this.id = data.id;
|
||||
this.amount = Number(data.amount);
|
||||
this.reason = data.reason;
|
||||
this.status = data.status;
|
||||
this.rejectionReason = data.rejectionReason;
|
||||
this.junior = new JuniorResponseDto(data.junior);
|
||||
this.createdAt = data.createdAt;
|
||||
this.updatedAt = data.updatedAt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user