From 8cb8de8fa9404c04d72f7d5aa39104c659c3ead9 Mon Sep 17 00:00:00 2001 From: ditiqi Date: Mon, 24 Feb 2025 12:19:09 +0800 Subject: [PATCH] add --- apps/server/src/models/post/post.service.ts | 45 ++++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/apps/server/src/models/post/post.service.ts b/apps/server/src/models/post/post.service.ts index eeb6e98..30d56e8 100755 --- a/apps/server/src/models/post/post.service.ts +++ b/apps/server/src/models/post/post.service.ts @@ -49,7 +49,7 @@ export class PostService extends BaseTreeService { meta: { type: type, }, - }, + } as any, }, { tx }, ); @@ -71,7 +71,7 @@ export class PostService extends BaseTreeService { parentId: courseId, title: title, authorId: staff?.id, - }, + } as any, }, { tx }, ); @@ -216,15 +216,38 @@ export class PostService extends BaseTreeService { return { ...result, items }; }); } - async findManyWithPagination(args: - { page?: number; - pageSize?: number; - where?: Prisma.PostWhereInput; - select?: Prisma.PostSelect; - }): 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; }> - { - return super.findManyWithPagination(args); - } + async findManyWithPagination(args: { + page?: number; + pageSize?: number; + where?: Prisma.PostWhereInput; + select?: Prisma.PostSelect; + }): 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; + }> { + return super.findManyWithPagination(args); + } protected async setPerms(data: Post, staff?: UserProfile) { if (!staff) return; const perms: ResPerm = {