update:add ci cd files ==> do not edit those file
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsMongoId, IsNotEmpty } from 'class-validator';
|
||||
import {
|
||||
DetailsAdminDiscountDto,
|
||||
detailsAdminDiscountObj,
|
||||
} from './discount.dto';
|
||||
import { UserMidDto, userMidObj } from './user.dto';
|
||||
|
||||
// OBJ *******************
|
||||
|
||||
export function listUserDiscountObj(userDiscount) {
|
||||
const user = userMidObj(userDiscount.user);
|
||||
const discount = detailsAdminDiscountObj(userDiscount.discount);
|
||||
|
||||
return {
|
||||
id: userDiscount.id,
|
||||
user,
|
||||
discount,
|
||||
updatedAt: userDiscount.updatedAt,
|
||||
createdAt: userDiscount.createdAt,
|
||||
};
|
||||
}
|
||||
|
||||
// CLASS *******************
|
||||
|
||||
export class ListUserDiscountDto {
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: Number })
|
||||
id: number;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: UserMidDto })
|
||||
user: UserMidDto;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: DetailsAdminDiscountDto })
|
||||
discount: DetailsAdminDiscountDto;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: Date })
|
||||
createdAt: Date;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: Date })
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export class CreateUserDiscountDto {
|
||||
@IsNotEmpty()
|
||||
@IsMongoId({ message: 'آیدی نامعتبر است.' })
|
||||
@ApiProperty({ type: String })
|
||||
user: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsMongoId({ message: 'آیدی نامعتبر است.' })
|
||||
@ApiProperty({ type: String })
|
||||
discount: string;
|
||||
}
|
||||
Reference in New Issue
Block a user