/* * @author gs * @date 2020/10/15 11:34 */ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document } from 'mongoose'; import { MongoDBCollection } from '../../../constant'; import { LocalizationContents } from '../../../type/database'; @Schema({ collection: MongoDBCollection.Kit }) export class Kit extends Document { @Prop() name!: LocalizationContents; @Prop() description?: LocalizationContents; @Prop() authorId?: string; @Prop() type!: string; // iconKit, fontKit, etc. @Prop() originalCover?: string; // 图片fileKey @Prop() cover?: string; // 图片url @Prop() thumb?: string; // 图片url @Prop() banner?: string; // 图片url @Prop({ default: 0 }) purchaseCount!: number; // 购买次数 @Prop({ default: 0 }) price!: number; // 价格 @Prop({ default: 0 }) discount!: number; // 折扣 @Prop({ default: 0 }) memberDiscount!: number; // 会员折扣 @Prop({ default: true }) isEnabled!: boolean; @Prop() createdAt!: Date; @Prop() updatedAt!: Date; @Prop() svgPackageFileKey?: string; @Prop() svgPackageFileSize?: number; } export const kitSchema = SchemaFactory.createForClass(Kit);