|
|
@@ -43,6 +43,20 @@ export class VideoMediaService {
|
|
|
where.listStatus = query.listStatus;
|
|
|
}
|
|
|
|
|
|
+ // filter by editedFrom and editedTo
|
|
|
+ if (
|
|
|
+ typeof query.editedFrom === 'number' ||
|
|
|
+ typeof query.editedTo === 'number'
|
|
|
+ ) {
|
|
|
+ where.editedAt = {};
|
|
|
+ if (typeof query.editedFrom === 'number') {
|
|
|
+ where.editedAt.gte = BigInt(query.editedFrom);
|
|
|
+ }
|
|
|
+ if (typeof query.editedTo === 'number') {
|
|
|
+ where.editedAt.lte = BigInt(query.editedTo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const [total, rows] = await Promise.all([
|
|
|
this.prisma.videoMedia.count({ where }),
|
|
|
this.prisma.videoMedia.findMany({
|
|
|
@@ -67,7 +81,7 @@ export class VideoMediaService {
|
|
|
categoryId: row.categoryId ?? null,
|
|
|
tagIds: row.tagIds ?? [],
|
|
|
listStatus: row.listStatus ?? 0,
|
|
|
- editedAt: row.editedAt?.toString?.() ?? '0',
|
|
|
+ editedAt: row.editedAt ?? 0,
|
|
|
// NOTE: We keep list DTO backward compatible.
|
|
|
// If you later want to show tag names in list, we can add e.g. `tagsFlat` or `tagNames` here.
|
|
|
})),
|
|
|
@@ -113,10 +127,10 @@ export class VideoMediaService {
|
|
|
categoryId: video.categoryId ?? null,
|
|
|
tagIds: video.tagIds ?? [],
|
|
|
listStatus: video.listStatus ?? 0,
|
|
|
- editedAt: video.editedAt?.toString?.() ?? '0',
|
|
|
+ editedAt: Number(video.editedAt ?? 0),
|
|
|
categoryName: category?.name ?? null,
|
|
|
// Existing DTO: tags as {id, name}[]
|
|
|
- tags: tags.map((t) => ({ id: t.id, name: t.name })),
|
|
|
+ tags: tags.map((t: any) => ({ id: t.id, name: t.name })),
|
|
|
};
|
|
|
}
|
|
|
|