| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2022-11-16 22:04:18 |
| 4 | * @LastEditTime: 2024-11-27 13:01:10 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: banner Banner |
| 7 | */ |
| 8 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; |
| 9 | import { TimeTemp } from './time.tamp'; |
| 10 | import { ONOFF } from 'src/global/enum/all.enum'; |
| 11 | |
| 12 | export enum BannerTag { |
| 13 | HOME = 'home', |
| 14 | } |
| 15 | |
| 16 | @Schema({ |
| 17 | collection: 'banner', |
| 18 | versionKey: false, |
| 19 | toJSON: { virtuals: true }, |
| 20 | toObject: { virtuals: true }, |
| 21 | }) |
| 22 | export class Banner extends TimeTemp { |
| 23 | id: string; |
| 24 | |
| 25 | @Prop({ required: false, comment: '数据ID' }) |
| 26 | dataId: string; |
| 27 | |
| 28 | @Prop({ required: false, comment: '描述' }) |
| 29 | desc: string; |
| 30 | |
| 31 | @Prop({ required: false, comment: '链接' }) |
| 32 | url: string; |
| 33 | |
| 34 | @Prop({ required: true, comment: '图片链接' }) |
| 35 | imgUrl: string; |
| 36 | |
| 37 | @Prop({ required: true, comment: '标识', enum: BannerTag }) |
| 38 | tag: BannerTag; |
| 39 | |
| 40 | @Prop({ |
| 41 | required: true, |
| 42 | comments: '是否发布', |
| 43 | enum: ONOFF, |
| 44 | }) |
| 45 | isPublish: ONOFF; |
| 46 | } |
| 47 | |
| 48 | export const BannerSchema = SchemaFactory.createForClass(Banner); |
| 49 |