Skip to content

Commit

Permalink
add: implement voucher schema
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaqc committed Dec 21, 2024
1 parent fbc30aa commit e5d8a03
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Empty file removed backend/src/schemas/.gitkeep
Empty file.
37 changes: 37 additions & 0 deletions backend/src/schemas/voucher.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Types } from 'mongoose';

@Schema({ timestamps: true })
export class Voucher {
@Prop({ type: Types.ObjectId, ref: 'User', required: true })
user: Types.ObjectId;

@Prop({ required: true, unique: true })
code: string;

@Prop({ required: true })
title: string;

@Prop({ required: true })
description: string;

@Prop({ required: true })
value: number;

@Prop({ required: true })
start: Date;

@Prop({ required: true })
end: Date;

@Prop({ required: true })
maxUses: number;

@Prop({ required: true })
usedCount: number;

@Prop({ default: false })
isDeleted: boolean;
}

export const VoucherSchema = SchemaFactory.createForClass(Voucher);

0 comments on commit e5d8a03

Please sign in to comment.