Skip to content

Commit b0c34cf

Browse files
committed
refactor: add comment about mongoose default timestamp fields
1 parent 41753fb commit b0c34cf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/song/entity/song.entity.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import type {
99
} from '@shared/validation/song/dto/types';
1010
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
1111

12+
import { User } from '@server/user/entity/user.entity';
13+
1214
@Schema({
1315
timestamps: true,
1416
versionKey: false,
@@ -24,13 +26,13 @@ export class Song {
2426
publicId: string;
2527

2628
@Prop({ type: MongooseSchema.Types.Date, required: true, default: Date.now })
27-
createdAt: Date;
29+
createdAt: Date; // Added automatically by Mongoose: https://mongoosejs.com/docs/timestamps.html
2830

2931
@Prop({ type: MongooseSchema.Types.Date, required: true, default: Date.now })
30-
updatedAt: Date;
32+
updatedAt: Date; // Added automatically by Mongoose: https://mongoosejs.com/docs/timestamps.html
3133

3234
@Prop({ type: MongooseSchema.Types.ObjectId, required: true, ref: 'User' })
33-
uploader: Types.ObjectId;
35+
uploader: Types.ObjectId | User; // Populated with the uploader's user document
3436

3537
@Prop({ type: String, required: true })
3638
thumbnailUrl: string;

0 commit comments

Comments
 (0)