LBA/catalog-service/src/schemas/file.schema.ts

63 lines
1.0 KiB
TypeScript

// src/schemas/file.schema.ts
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
import { v4 as uuidv4 } from 'uuid';
export type FileDocument = File & Document;
/*
@Schema()
export class File {
@Prop({ default: () => uuidv4(), unique: true })
ID: string; // UUID
@Prop()
Title: string;
@Prop()
Description: string;
@Prop()
Format: string;
@Prop()
Url: string;
@Prop({ type: Types.ObjectId, ref: 'Album' })
Album: Types.ObjectId; // آلبوم مربوطه
@Prop({ default: 'active' })
Status: string;
@Prop({ type: Date, default: Date.now })
createdAt: Date;
@Prop({ type: Date, default: Date.now })
updatedAt: Date;
}
*/
@Schema({ timestamps: true })
export class File {
@Prop()
FileType: string;
@Prop({required:false})
Title:string
@Prop({required:false})
Description:string
@Prop({required:false})
Format:string
@Prop({required:false})
Url:string
@Prop({required:true,unique:true})
ID:string
}
export const FileSchema = SchemaFactory.createForClass(File);