@yimingliao/cms 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -491,6 +491,7 @@ interface FindParams {
491
491
  type?: PostType;
492
492
  slug?: string;
493
493
  isActive?: boolean;
494
+ topicSlug?: string;
494
495
  }
495
496
  interface FindManyParams {
496
497
  type: PostType;
@@ -508,7 +509,7 @@ declare function createPostQueryRepository(prisma: any): {
508
509
  find: ({ isActive, ...rest }: FindParams) => Promise<(Post & {
509
510
  translations: PostTranslation[];
510
511
  }) | null>;
511
- findFull: ({ isActive, ...rest }: FindParams) => Promise<PostFull | null>;
512
+ findFull: ({ isActive, topicSlug, ...rest }: FindParams) => Promise<PostFull | null>;
512
513
  findWithSeoMetadata: ({ isActive, ...rest }: FindParams) => Promise<(Post & {
513
514
  translations: PostTranslation[];
514
515
  seoMetadatas: SeoMetadata[];
@@ -1183,7 +1183,7 @@ function createPostQueryRepository(prisma) {
1183
1183
  ...state8 ? { state8: true } : {},
1184
1184
  ...state9 ? { state9: true } : {},
1185
1185
  ...state10 ? { state10: true } : {},
1186
- // relations: Post
1186
+ // relations
1187
1187
  ...topicId ? { topicId } : {},
1188
1188
  ...topicSlug ? { topic: { slug: topicSlug } } : {},
1189
1189
  ...categoryId ? { parents: { some: { id: categoryId } } } : {},
@@ -1229,13 +1229,22 @@ function createPostQueryRepository(prisma) {
1229
1229
  });
1230
1230
  }
1231
1231
  async function findFull({
1232
+ // states
1232
1233
  isActive,
1234
+ // relations
1235
+ topicSlug,
1233
1236
  ...rest
1234
1237
  }) {
1235
1238
  const where = buildWhere3(rest);
1236
1239
  if (!where) return null;
1237
1240
  return prisma.post.findFirst({
1238
- where: { ...where, ...isActive ? { isActive } : {} },
1241
+ where: {
1242
+ ...where,
1243
+ // states
1244
+ ...isActive ? { isActive } : {},
1245
+ // relations
1246
+ ...topicSlug ? { topic: { slug: topicSlug } } : {}
1247
+ },
1239
1248
  include: POST_FULL_INCLUDE
1240
1249
  });
1241
1250
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",