Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { prop, modelOptions } from '@typegoose/typegoose'
import { ApiProperty } from '@nestjs/swagger'
@modelOptions({
schemaOptions: {
timestamps: true
}
})
export class User {
@ApiProperty({ description: '用户名', example: 'user1' })
@prop()
username: string
@ApiProperty({ description: '密码', example: 'pass1' })
@prop()
password: string
}
import { prop, modelOptions, arrayProp, Ref } from '@typegoose/typegoose';
import { ApiProperty } from '@nestjs/swagger';
import { Episode } from './episode.model';
@modelOptions({
schemaOptions: {
timestamps: true,
toJSON: { virtuals: true },
},
})
export class Course {
@ApiProperty({ description: '课程名称' })
@prop()
name: string;
@ApiProperty({ description: '封面图' })
@prop()
cover: string;
@arrayProp({
ref: 'Episode',
import { prop, modelOptions, Ref } from "@typegoose/typegoose";
import { Course } from "./course.model";
@modelOptions({
schemaOptions: {
timestamps: true
}
})
export class Episode {
@prop()
name: string
@prop()
file: string
@prop({ ref: 'Course' })
course: Ref
}