This commit is contained in:
ditiqi 2025-02-24 12:19:09 +08:00
parent e4f8cd3ef8
commit 8cb8de8fa9
1 changed files with 34 additions and 11 deletions

View File

@ -49,7 +49,7 @@ export class PostService extends BaseTreeService<Prisma.PostDelegate> {
meta: { meta: {
type: type, type: type,
}, },
}, } as any,
}, },
{ tx }, { tx },
); );
@ -71,7 +71,7 @@ export class PostService extends BaseTreeService<Prisma.PostDelegate> {
parentId: courseId, parentId: courseId,
title: title, title: title,
authorId: staff?.id, authorId: staff?.id,
}, } as any,
}, },
{ tx }, { tx },
); );
@ -216,15 +216,38 @@ export class PostService extends BaseTreeService<Prisma.PostDelegate> {
return { ...result, items }; return { ...result, items };
}); });
} }
async findManyWithPagination(args: async findManyWithPagination(args: {
{ page?: number; page?: number;
pageSize?: number; pageSize?: number;
where?: Prisma.PostWhereInput; where?: Prisma.PostWhereInput;
select?: Prisma.PostSelect<DefaultArgs>; select?: Prisma.PostSelect<DefaultArgs>;
}): Promise<{ items: { id: string; type: string | null; level: string | null; state: string | null; title: string | null; subTitle: string | null; content: string | null; important: boolean | null; domainId: string | null; order: number | null; duration: number | null; rating: number | null; createdAt: Date; publishedAt: Date | null; updatedAt: Date; deletedAt: Date | null; authorId: string | null; parentId: string | null; hasChildren: boolean | null; meta: Prisma.JsonValue | null; }[]; totalPages: number; }> }): Promise<{
{ items: {
return super.findManyWithPagination(args); id: string;
} type: string | null;
level: string | null;
state: string | null;
title: string | null;
subTitle: string | null;
content: string | null;
important: boolean | null;
domainId: string | null;
order: number | null;
duration: number | null;
rating: number | null;
createdAt: Date;
publishedAt: Date | null;
updatedAt: Date;
deletedAt: Date | null;
authorId: string | null;
parentId: string | null;
hasChildren: boolean | null;
meta: Prisma.JsonValue | null;
}[];
totalPages: number;
}> {
return super.findManyWithPagination(args);
}
protected async setPerms(data: Post, staff?: UserProfile) { protected async setPerms(data: Post, staff?: UserProfile) {
if (!staff) return; if (!staff) return;
const perms: ResPerm = { const perms: ResPerm = {