| 1 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose' |
| 2 | import { DEFAULT_SCHEMA_OPTIONS } from '../mongodb.constants' |
| 3 | import { WithTimestampSchema } from './timestamp.schema' |
| 4 | |
| 5 | @Schema({ ...DEFAULT_SCHEMA_OPTIONS, collection: 'blog' }) |
| 6 | export class Blog extends WithTimestampSchema { |
| 7 | id: string |
| 8 | |
| 9 | @Prop({ |
| 10 | comment: '内容', |
| 11 | default: '', |
| 12 | }) |
| 13 | content: string |
| 14 | } |
| 15 | |
| 16 | export const BlogSchema = SchemaFactory.createForClass(Blog) |
| 17 |