Skip to content

Commit e891863

Browse files
committed
feat: add description to date properties
1 parent c26f62d commit e891863

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/movie/schemas/movie.schema.ts

+7-16
Original file line numberDiff line numberDiff line change
@@ -196,31 +196,31 @@ export class Distributor {
196196
}
197197

198198
export class Premiere {
199-
@ApiPropertyOptional()
199+
@ApiPropertyOptional({ example: 'США' })
200200
@Prop()
201201
country: string;
202202

203-
@ApiPropertyOptional()
203+
@ApiPropertyOptional({ example: '01.02.2023', type: Date })
204204
@Prop({ type: () => Date, index: true })
205205
world: string;
206206

207-
@ApiPropertyOptional()
207+
@ApiPropertyOptional({ example: '01.02.2023', type: Date })
208208
@Prop({ type: () => Date, index: true })
209209
russia: string;
210210

211211
@ApiPropertyOptional()
212212
@Prop({ type: () => Date, index: true })
213213
digital: string;
214214

215-
@ApiPropertyOptional()
215+
@ApiPropertyOptional({ example: '01.02.2023', type: Date })
216216
@Prop({ type: () => Date })
217217
cinema: string;
218218

219-
@ApiPropertyOptional()
219+
@ApiPropertyOptional({ example: '01.02.2023', type: Date })
220220
@Prop({ type: () => Date })
221221
bluray: string;
222222

223-
@ApiPropertyOptional()
223+
@ApiPropertyOptional({ example: '01.02.2023', type: Date })
224224
@Prop({ type: () => Date })
225225
dvd: string;
226226
}
@@ -360,16 +360,7 @@ export class YearRange {
360360
export type MovieDocument = HydratedDocument<Movie>;
361361
@Schema({
362362
timestamps: true,
363-
toJSON: {
364-
virtuals: true,
365-
transform: (doc, ret) => {
366-
if (ret?.__v) delete ret.__v;
367-
if (ret?._id) delete ret._id;
368-
if (ret?.externalId?._id) delete ret.externalId._id;
369-
if (ret?.videos?._id) delete ret.videos._id;
370-
if (ret?.videos?.trailers) ret?.videos?.trailers.forEach((i) => delete i._id);
371-
},
372-
},
363+
toJSON: { virtuals: true },
373364
toObject: { virtuals: true },
374365
})
375366
export class Movie {

0 commit comments

Comments
 (0)