@yimingliao/cms 0.0.10 → 0.0.12

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.
@@ -1,7 +1,7 @@
1
1
  import jwt from 'jsonwebtoken';
2
2
  import { BinaryLike } from 'node:crypto';
3
3
  import { cookies } from 'next/headers';
4
- import { e as AdminRole, v as SingleItem, B as BaseTranslation, a as Admin, c as AdminFull, f as AdminSafe, D as DeviceInfo, d as AdminRefreshToken, k as File, m as FileFull, o as FileType, p as Folder, F as FolderFull, u as PostType, M as MultiItems, E as ExternalLink, j as Faq, T as TocItem, q as Post, s as PostListCard, t as PostTranslation, r as PostFull, S as SeoMetadata, h as Alternate } from '../base-DbGnfZr6.js';
4
+ import { e as AdminRole, v as SingleItem, B as BaseTranslation, a as Admin, c as AdminFull, f as AdminSafe, D as DeviceInfo, d as AdminRefreshToken, k as File, m as FileFull, o as FileType, p as Folder, F as FolderFull, u as PostType, M as MultiItems, E as ExternalLink, j as Faq, T as TocItem, q as Post, s as PostListCard, t as PostTranslation, r as PostFull, S as SeoMetadata, g as AdminTranslation, n as FileTranslation, h as Alternate } from '../base-DbGnfZr6.js';
5
5
 
6
6
  interface JwtServiceConfig {
7
7
  defaultSecret: string;
@@ -497,6 +497,12 @@ declare function createPostQueryRepository(prisma: any): {
497
497
  findWithSeoMetadata: (params: FindParams) => Promise<(Post & {
498
498
  translations: PostTranslation[];
499
499
  seoMetadatas: SeoMetadata[];
500
+ author: AdminSafe & {
501
+ translations: AdminTranslation[];
502
+ };
503
+ coverImage: File & {
504
+ translations: FileTranslation[];
505
+ };
500
506
  }) | null>;
501
507
  };
502
508
 
@@ -419,7 +419,7 @@ function createAdminQueryRepository(prisma) {
419
419
  async function findFull(params) {
420
420
  const where = buildWhere(params);
421
421
  if (!where) return null;
422
- return await prisma.admin.findUnique({
422
+ return prisma.admin.findUnique({
423
423
  where,
424
424
  include: ADMIN_FULL_INCLUDE,
425
425
  ...OMIT_PASSWORD
@@ -481,7 +481,7 @@ function createAdminRefreshTokenQueryRepository(prisma) {
481
481
  async function findManyByAdminId({
482
482
  adminId
483
483
  }) {
484
- return await prisma.adminRefreshToken.findMany({
484
+ return prisma.adminRefreshToken.findMany({
485
485
  where: { adminId },
486
486
  orderBy: [{ createdAt: "desc" }, { id: "asc" }]
487
487
  });
@@ -489,7 +489,7 @@ function createAdminRefreshTokenQueryRepository(prisma) {
489
489
  async function findByToken({
490
490
  tokenHash
491
491
  }) {
492
- return await prisma.adminRefreshToken.findUnique({
492
+ return prisma.adminRefreshToken.findUnique({
493
493
  where: { tokenHash }
494
494
  });
495
495
  }
@@ -727,13 +727,13 @@ function createFileQueryRepository(prisma) {
727
727
  async function findManyByIds({
728
728
  ids: ids2
729
729
  }) {
730
- return await prisma.file.findMany({
730
+ return prisma.file.findMany({
731
731
  where: { id: { in: ids2 } },
732
732
  include: FILE_FULL_INCLUDE
733
733
  });
734
734
  }
735
735
  async function findFull({ id }) {
736
- return await prisma.file.findUnique({
736
+ return prisma.file.findUnique({
737
737
  where: { id },
738
738
  include: FILE_FULL_INCLUDE
739
739
  });
@@ -855,7 +855,7 @@ function createFolderQueryRepository(prisma) {
855
855
  async function findFull(params) {
856
856
  const where = buildWhere2(params);
857
857
  if (!where) return null;
858
- return await prisma.folder.findUnique({
858
+ return prisma.folder.findUnique({
859
859
  where,
860
860
  include: FOLDER_FULL_INCLUDE
861
861
  });
@@ -1177,7 +1177,7 @@ function createPostQueryRepository(prisma) {
1177
1177
  type,
1178
1178
  topicId
1179
1179
  }) {
1180
- return await prisma.post.findMany({
1180
+ return prisma.post.findMany({
1181
1181
  where: { type, ...topicId ? { topicId } : {} },
1182
1182
  orderBy: POST_ORDER_BY,
1183
1183
  include: { translations: true }
@@ -1194,9 +1194,17 @@ function createPostQueryRepository(prisma) {
1194
1194
  async function findWithSeoMetadata(params) {
1195
1195
  const where = buildWhere3(params);
1196
1196
  if (!where) return null;
1197
- return await prisma.post.findFirst({
1197
+ return prisma.post.findFirst({
1198
1198
  where,
1199
- include: { translations: true, seoMetadatas: true }
1199
+ include: {
1200
+ translations: true,
1201
+ seoMetadatas: true,
1202
+ author: {
1203
+ include: { translations: true },
1204
+ omit: { passwordHash: true }
1205
+ },
1206
+ coverImage: { include: { translations: true } }
1207
+ }
1200
1208
  });
1201
1209
  }
1202
1210
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",