@yimingliao/cms 0.0.196 → 0.0.198

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.
Files changed (28) hide show
  1. package/dist/export/server/index.js +1 -1
  2. package/dist/src/server/infrastructure/database/config/command/create-config-command-repository.js +6 -7
  3. package/dist/src/server/interfaces/actions/resources/config/commands/{upsert/config-upsert-validator.js → update/config-update-validator.js} +2 -4
  4. package/dist/src/server/interfaces/actions/resources/config/commands/update/create-config-update-action.js +32 -0
  5. package/dist/src/server/interfaces/actions/resources/config/queries/create-config-find-many-action.js +1 -1
  6. package/dist/types/export/server/index.d.ts +1 -1
  7. package/dist/types/src/domain/resources/config/base.d.ts +2 -0
  8. package/dist/types/src/domain/resources/config/base.d.ts.map +1 -1
  9. package/dist/types/src/server/index.d.ts +1 -1
  10. package/dist/types/src/server/infrastructure/database/config/command/create-config-command-repository.d.ts +2 -2
  11. package/dist/types/src/server/infrastructure/database/config/command/create-config-command-repository.d.ts.map +1 -1
  12. package/dist/types/src/server/infrastructure/database/config/command/types.d.ts +2 -3
  13. package/dist/types/src/server/infrastructure/database/config/command/types.d.ts.map +1 -1
  14. package/dist/types/src/server/interfaces/actions/index.d.ts +1 -1
  15. package/dist/types/src/server/interfaces/actions/resources/config/commands/index.d.ts +1 -1
  16. package/dist/types/src/server/interfaces/actions/resources/config/commands/{upsert/config-upsert-validator.d.ts → update/config-update-validator.d.ts} +2 -4
  17. package/dist/types/src/server/interfaces/actions/resources/config/commands/{upsert/config-upsert-validator.d.ts.map → update/config-update-validator.d.ts.map} +1 -1
  18. package/dist/types/src/server/interfaces/actions/resources/config/commands/update/create-config-update-action.d.ts +11 -0
  19. package/dist/types/src/server/interfaces/actions/resources/config/commands/update/create-config-update-action.d.ts.map +1 -0
  20. package/dist/types/src/server/interfaces/actions/resources/config/index.d.ts +1 -1
  21. package/dist/types/src/server/interfaces/actions/resources/config/queries/create-config-find-many-action.d.ts +1 -1
  22. package/dist/types/src/server/interfaces/actions/resources/index.d.ts +1 -1
  23. package/dist/types/src/server/interfaces/index.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/prisma/schema/Config/Config.prisma +2 -0
  26. package/dist/src/server/interfaces/actions/resources/config/commands/upsert/create-config-upsert-action.js +0 -27
  27. package/dist/types/src/server/interfaces/actions/resources/config/commands/upsert/create-config-upsert-action.d.ts +0 -8
  28. package/dist/types/src/server/interfaces/actions/resources/config/commands/upsert/create-config-upsert-action.d.ts.map +0 -1
@@ -73,7 +73,7 @@ export { createPostFindFullAction } from '../../src/server/interfaces/actions/re
73
73
  export { createPostFindListCardsAction } from '../../src/server/interfaces/actions/resources/post/queries/create-post-find-list-cards-action.js';
74
74
  export { createPostFindManyAction } from '../../src/server/interfaces/actions/resources/post/queries/create-post-find-many-action.js';
75
75
  export { createSeoMetadataUpsertAction } from '../../src/server/interfaces/actions/resources/seo-metadata/commands/upsert/create-seo-metadata-upsert-action.js';
76
- export { createConfigUpsertAction } from '../../src/server/interfaces/actions/resources/config/commands/upsert/create-config-upsert-action.js';
76
+ export { createConfigUpdateAction } from '../../src/server/interfaces/actions/resources/config/commands/update/create-config-update-action.js';
77
77
  export { createConfigFindAction } from '../../src/server/interfaces/actions/resources/config/queries/create-config-find-action.js';
78
78
  export { createConfigFindManyAction } from '../../src/server/interfaces/actions/resources/config/queries/create-config-find-many-action.js';
79
79
  export { createFileUploadApi } from '../../src/server/interfaces/apis/file-upload/file-upload-api.js';
@@ -1,14 +1,13 @@
1
1
  function createConfigCommandRepository(prisma) {
2
- async function upsert({ slug, ...params }) {
3
- const upserted = await prisma.config.upsert({
4
- where: { slug },
5
- create: { slug, ...params },
6
- update: params
2
+ async function update({ id, ...rest }) {
3
+ const updated = await prisma.config.update({
4
+ where: { id },
5
+ data: { ...rest }
7
6
  });
8
- return upserted;
7
+ return updated;
9
8
  }
10
9
  return {
11
- upsert
10
+ update
12
11
  };
13
12
  }
14
13
 
@@ -1,6 +1,4 @@
1
- const configUpsertValidator = (schemas) => schemas.z.object({
2
- slug: schemas.text(),
3
- index: schemas.positiveNumber(),
1
+ const configUpdateValidator = (schemas) => schemas.z.object({
4
2
  // text
5
3
  text1: schemas.text().nullable(),
6
4
  text2: schemas.text().nullable(),
@@ -19,4 +17,4 @@ const configUpsertValidator = (schemas) => schemas.z.object({
19
17
  data4: schemas.array(schemas.z.any())
20
18
  });
21
19
 
22
- export { configUpsertValidator };
20
+ export { configUpdateValidator };
@@ -0,0 +1,32 @@
1
+ import { configUpdateValidator } from './config-update-validator.js';
2
+
3
+ function createConfigUpdateAction(ctx) {
4
+ const {
5
+ repositories: { configCommandRepository },
6
+ middlewares: { authMiddleware },
7
+ action: { executeAction },
8
+ schemas: { schemas }
9
+ } = ctx;
10
+ return async function configUpdateAction({
11
+ id,
12
+ formData
13
+ }) {
14
+ return executeAction(
15
+ async () => {
16
+ await authMiddleware.authenticate();
17
+ const validatedPayload = await configUpdateValidator(schemas).parseAsync(formData);
18
+ const updatedConfig = await configCommandRepository.update({
19
+ id,
20
+ ...validatedPayload
21
+ });
22
+ return {
23
+ i18nKey: "ok.update-ok",
24
+ data: { config: updatedConfig }
25
+ };
26
+ },
27
+ { type: "command" }
28
+ );
29
+ };
30
+ }
31
+
32
+ export { createConfigUpdateAction };
@@ -8,7 +8,7 @@ function createConfigFindManyAction(ctx) {
8
8
  async () => {
9
9
  const found = await configQueryRepository.findMany();
10
10
  return {
11
- data: { config: found }
11
+ data: { configs: found }
12
12
  };
13
13
  },
14
14
  {
@@ -1,2 +1,2 @@
1
- export { createJwtService, createArgon2Service, createCryptoService, createCookieService, createCache, createCacheResult, createIpRateLimiter, normalizeCacheKey, type RawCacheKey, createZod, createUnique, createExist, createSchemas, createFileSchema, createMultiFileSchema, createTocItemSchema, createTransporter, createSendEmail, createRenderEmailTemplate, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createPostCommandRepository, createPostQueryRepository, POST_LIST_CARD_INCLUDE, createSeoMetadataCommandRepository, createConfigCommandRepository, createConfigQueryRepository, ORDER_BY, ADMIN_ORDER_BY, POST_ORDER_BY, createExecuteAction, createExecuteApi, createRunAction, createAuthMiddleware, createVerifyAccessToken, createVerifyRefreshToken, type ActionContext, createSignInAction, createSignOutAction, createVerifyAction, createChangePasswordAction, createVerifyEmailAction, createEmailUnverifiedAction, createForgotPasswordAction, createResetPasswordAction, createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpsertAction, type ConfigUpsertFormData, createConfigFindAction, createConfigFindManyAction, type ApiContext, type FileUploadRequestDto, type FileUploadResponseDto, createFileUploadApi, type MultiFilesUploadRequestDto, type MultiFilesUploadResponseDto, createMultiFilesUploadApi, createEmailsApi, createPreviewEmailApi, createAuthUseCases, createEmailVerificationEmail, createForgotPasswordEmail, ServerError, } from "../../src/server";
1
+ export { createJwtService, createArgon2Service, createCryptoService, createCookieService, createCache, createCacheResult, createIpRateLimiter, normalizeCacheKey, type RawCacheKey, createZod, createUnique, createExist, createSchemas, createFileSchema, createMultiFileSchema, createTocItemSchema, createTransporter, createSendEmail, createRenderEmailTemplate, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createPostCommandRepository, createPostQueryRepository, POST_LIST_CARD_INCLUDE, createSeoMetadataCommandRepository, createConfigCommandRepository, createConfigQueryRepository, ORDER_BY, ADMIN_ORDER_BY, POST_ORDER_BY, createExecuteAction, createExecuteApi, createRunAction, createAuthMiddleware, createVerifyAccessToken, createVerifyRefreshToken, type ActionContext, createSignInAction, createSignOutAction, createVerifyAction, createChangePasswordAction, createVerifyEmailAction, createEmailUnverifiedAction, createForgotPasswordAction, createResetPasswordAction, createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpdateAction, type ConfigUpdateFormData, createConfigFindAction, createConfigFindManyAction, type ApiContext, type FileUploadRequestDto, type FileUploadResponseDto, createFileUploadApi, type MultiFilesUploadRequestDto, type MultiFilesUploadResponseDto, createMultiFilesUploadApi, createEmailsApi, createPreviewEmailApi, createAuthUseCases, createEmailVerificationEmail, createForgotPasswordEmail, ServerError, } from "../../src/server";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,7 @@
1
1
  export interface Config {
2
2
  id: string;
3
+ slug: string;
4
+ index: number;
3
5
  text1: string | null;
4
6
  text2: string | null;
5
7
  text3: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../../src/domain/resources/config/base.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IAMX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IAKb,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../../src/domain/resources/config/base.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAMd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IAKb,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -1,5 +1,5 @@
1
1
  export { createJwtService, createArgon2Service, createCryptoService, createCookieService, createCache, createCacheResult, createIpRateLimiter, normalizeCacheKey, type RawCacheKey, createZod, createUnique, createExist, createSchemas, createFileSchema, createMultiFileSchema, createTocItemSchema, createTransporter, createSendEmail, createRenderEmailTemplate, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createPostCommandRepository, createPostQueryRepository, POST_LIST_CARD_INCLUDE, createSeoMetadataCommandRepository, createConfigCommandRepository, createConfigQueryRepository, ORDER_BY, ADMIN_ORDER_BY, POST_ORDER_BY, } from "./infrastructure";
2
- export { createExecuteAction, createExecuteApi, createRunAction, createAuthMiddleware, createVerifyAccessToken, createVerifyRefreshToken, type ActionContext, createSignInAction, type SignInFormData, createSignOutAction, createVerifyAction, createChangePasswordAction, type ChangePasswordFormData, createVerifyEmailAction, type VerifyEmailFormData, createEmailUnverifiedAction, type EmailUnverifiedFormData, createForgotPasswordAction, type ForgotPasswordFormData, createResetPasswordAction, type ResetPasswordFormData, createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpsertAction, type ConfigUpsertFormData, createConfigFindAction, createConfigFindManyAction, type ApiContext, type FileUploadRequestDto, type FileUploadResponseDto, createFileUploadApi, type MultiFilesUploadRequestDto, type MultiFilesUploadResponseDto, createMultiFilesUploadApi, createEmailsApi, createPreviewEmailApi, } from "./interfaces";
2
+ export { createExecuteAction, createExecuteApi, createRunAction, createAuthMiddleware, createVerifyAccessToken, createVerifyRefreshToken, type ActionContext, createSignInAction, type SignInFormData, createSignOutAction, createVerifyAction, createChangePasswordAction, type ChangePasswordFormData, createVerifyEmailAction, type VerifyEmailFormData, createEmailUnverifiedAction, type EmailUnverifiedFormData, createForgotPasswordAction, type ForgotPasswordFormData, createResetPasswordAction, type ResetPasswordFormData, createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpdateAction, type ConfigUpdateFormData, createConfigFindAction, createConfigFindManyAction, type ApiContext, type FileUploadRequestDto, type FileUploadResponseDto, createFileUploadApi, type MultiFilesUploadRequestDto, type MultiFilesUploadResponseDto, createMultiFilesUploadApi, createEmailsApi, createPreviewEmailApi, } from "./interfaces";
3
3
  export { createAuthUseCases, createEmailVerificationEmail, createForgotPasswordEmail, } from "./applications";
4
4
  export { ServerError } from "./server-error";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
- import type { UpsertParams } from "./types";
1
+ import type { UpdateParams } from "./types";
2
2
  import type { PrismaClient } from "../../../../../../prisma/generated/client";
3
3
  import type { Config } from "../../../../../domain";
4
4
  export declare function createConfigCommandRepository(prisma: PrismaClient): {
5
- upsert: ({ slug, ...params }: UpsertParams) => Promise<Config>;
5
+ update: ({ id, ...rest }: UpdateParams) => Promise<Config>;
6
6
  };
7
7
  //# sourceMappingURL=create-config-command-repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-config-command-repository.d.ts","sourceRoot":"","sources":["../../../../../../../../src/server/infrastructure/database/config/command/create-config-command-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,YAAY;kCAIrB,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC;EAe1E"}
1
+ {"version":3,"file":"create-config-command-repository.d.ts","sourceRoot":"","sources":["../../../../../../../../src/server/infrastructure/database/config/command/create-config-command-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,YAAY;8BAIzB,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC;EActE"}
@@ -1,6 +1,5 @@
1
- export interface UpsertParams {
2
- slug: string;
3
- index: number;
1
+ export interface UpdateParams {
2
+ id: string;
4
3
  text1: string | null;
5
4
  text2: string | null;
6
5
  text3: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/server/infrastructure/database/config/command/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAMd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;CACd"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/server/infrastructure/database/config/command/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IAMX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,EAAE,GAAG,EAAE,CAAC;CACd"}
@@ -1,4 +1,4 @@
1
1
  export type { ActionContext } from "./action-context";
2
2
  export { createSignInAction, type SignInFormData, createSignOutAction, createVerifyAction, createChangePasswordAction, type ChangePasswordFormData, createEmailUnverifiedAction, type EmailUnverifiedFormData, createVerifyEmailAction, type VerifyEmailFormData, createForgotPasswordAction, type ForgotPasswordFormData, createResetPasswordAction, type ResetPasswordFormData, } from "./auth";
3
- export { createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpsertAction, type ConfigUpsertFormData, createConfigFindAction, createConfigFindManyAction, } from "./resources";
3
+ export { createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpdateAction, type ConfigUpdateFormData, createConfigFindAction, createConfigFindManyAction, } from "./resources";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export { createConfigUpsertAction, type ConfigUpsertFormData, } from "./upsert/create-config-upsert-action";
1
+ export { createConfigUpdateAction, type ConfigUpdateFormData, } from "./update/create-config-update-action";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,5 @@
1
1
  import type { createSchemas } from "../../../../../../infrastructure";
2
- export declare const configUpsertValidator: (schemas: ReturnType<typeof createSchemas>) => import("zod").ZodObject<{
3
- slug: import("zod").ZodString;
4
- index: import("zod").ZodPipe<import("zod").ZodTransform<number | undefined, unknown>, import("zod").ZodNumber>;
2
+ export declare const configUpdateValidator: (schemas: ReturnType<typeof createSchemas>) => import("zod").ZodObject<{
5
3
  text1: import("zod").ZodNullable<import("zod").ZodString>;
6
4
  text2: import("zod").ZodNullable<import("zod").ZodString>;
7
5
  text3: import("zod").ZodNullable<import("zod").ZodString>;
@@ -17,4 +15,4 @@ export declare const configUpsertValidator: (schemas: ReturnType<typeof createSc
17
15
  data3: import("zod").ZodPipe<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodTransform<any[], any[]>>;
18
16
  data4: import("zod").ZodPipe<import("zod").ZodArray<import("zod").ZodAny>, import("zod").ZodTransform<any[], any[]>>;
19
17
  }, import("zod/v4/core").$strip>;
20
- //# sourceMappingURL=config-upsert-validator.d.ts.map
18
+ //# sourceMappingURL=config-update-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-upsert-validator.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/server/interfaces/actions/resources/config/commands/upsert/config-upsert-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,eAAO,MAAM,qBAAqB,GAChC,SAAS,UAAU,CAAC,OAAO,aAAa,CAAC;;;;;;;;;;;;;;;;;gCAwBvC,CAAC"}
1
+ {"version":3,"file":"config-update-validator.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/server/interfaces/actions/resources/config/commands/update/config-update-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,eAAO,MAAM,qBAAqB,GAChC,SAAS,UAAU,CAAC,OAAO,aAAa,CAAC;;;;;;;;;;;;;;;gCAoBvC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ActionContext } from "../../../../action-context";
2
+ import type z from "zod";
3
+ import { configUpdateValidator } from "./config-update-validator";
4
+ export type ConfigUpdateFormData = z.infer<ReturnType<typeof configUpdateValidator>>;
5
+ export declare function createConfigUpdateAction(ctx: ActionContext): ({ id, formData, }: {
6
+ id: string;
7
+ formData: ConfigUpdateFormData;
8
+ }) => Promise<import("../../../../../../../shared").Result<{
9
+ config: import("../../../../../../../domain").Config;
10
+ }>>;
11
+ //# sourceMappingURL=create-config-update-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-config-update-action.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/server/interfaces/actions/resources/config/commands/update/create-config-update-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACxC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CACzC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,IAQhB,mBAGtC;IACD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,oBAAoB,CAAC;CAChC;;IA2BF"}
@@ -1,3 +1,3 @@
1
- export { createConfigUpsertAction, type ConfigUpsertFormData, } from "./commands";
1
+ export { createConfigUpdateAction, type ConfigUpdateFormData, } from "./commands";
2
2
  export { createConfigFindAction, createConfigFindManyAction } from "./queries";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ActionContext } from "../../../action-context";
2
2
  export declare function createConfigFindManyAction(ctx: ActionContext): () => Promise<import("../../../../../../shared").Result<{
3
- config: import("../../../../../../domain").Config[];
3
+ configs: import("../../../../../../domain").Config[];
4
4
  }>>;
5
5
  //# sourceMappingURL=create-config-find-many-action.d.ts.map
@@ -4,5 +4,5 @@ export { createFileCreateAction, type FileCreateFormData, createFileUpdateAction
4
4
  export { createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, } from "./folder";
5
5
  export { createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, } from "./post";
6
6
  export { createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, } from "./seo-metadata";
7
- export { createConfigUpsertAction, type ConfigUpsertFormData, createConfigFindAction, createConfigFindManyAction, } from "./config";
7
+ export { createConfigUpdateAction, type ConfigUpdateFormData, createConfigFindAction, createConfigFindManyAction, } from "./config";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export { createExecuteAction, createExecuteApi, createRunAction, } from "./execution";
2
2
  export { createAuthMiddleware, createVerifyAccessToken, createVerifyRefreshToken, } from "./middlewares";
3
- export { type ActionContext, createSignInAction, type SignInFormData, createSignOutAction, createVerifyAction, createChangePasswordAction, type ChangePasswordFormData, createVerifyEmailAction, type VerifyEmailFormData, createEmailUnverifiedAction, type EmailUnverifiedFormData, createForgotPasswordAction, type ForgotPasswordFormData, createResetPasswordAction, type ResetPasswordFormData, createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpsertAction, type ConfigUpsertFormData, createConfigFindAction, createConfigFindManyAction, } from "./actions";
3
+ export { type ActionContext, createSignInAction, type SignInFormData, createSignOutAction, createVerifyAction, createChangePasswordAction, type ChangePasswordFormData, createVerifyEmailAction, type VerifyEmailFormData, createEmailUnverifiedAction, type EmailUnverifiedFormData, createForgotPasswordAction, type ForgotPasswordFormData, createResetPasswordAction, type ResetPasswordFormData, createAdminCreateAction, type AdminCreateFormData, createAdminUpdateAction, type AdminUpdateFormData, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createFileCreateAction, type FileCreateFormData, createFileUpdateAction, type FileUpdateFormData, createFileCreateManyAction, type FileCreateManyFormData, createFilePurgeManyAction, createFileRestoreManyAction, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileFindFullAction, createFileFindListCardsAction, createFolderCreateAction, type FolderCreateFormData, createFolderUpdateAction, type FolderUpdateFormData, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createPostCreateAction, type PostCreateFormData, createPostUpdateAction, type PostUpdateFormData, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createSeoMetadataUpsertAction, type SeoMetadataUpsertFormData, createConfigUpdateAction, type ConfigUpdateFormData, createConfigFindAction, createConfigFindManyAction, } from "./actions";
4
4
  export { type ApiContext, type FileUploadRequestDto, type FileUploadResponseDto, createFileUploadApi, type MultiFilesUploadRequestDto, type MultiFilesUploadResponseDto, createMultiFilesUploadApi, createEmailsApi, createPreviewEmailApi, } from "./apis";
5
5
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.196",
3
+ "version": "0.0.198",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,4 +31,6 @@ model Config {
31
31
  // -----------------------------------------------------------------------
32
32
  createdAt DateTime @default(now()) @map("created_at")
33
33
  updatedAt DateTime @updatedAt @map("updated_at")
34
+
35
+ @@map("configs")
34
36
  }
@@ -1,27 +0,0 @@
1
- import { configUpsertValidator } from './config-upsert-validator.js';
2
-
3
- function createConfigUpsertAction(ctx) {
4
- const {
5
- repositories: { configCommandRepository },
6
- middlewares: { authMiddleware },
7
- action: { executeAction },
8
- schemas: { schemas }
9
- } = ctx;
10
- return async function configCreateAction({
11
- formData
12
- }) {
13
- return executeAction(
14
- async () => {
15
- await authMiddleware.authenticate();
16
- const validatedPayload = await configUpsertValidator(schemas).parseAsync(formData);
17
- await configCommandRepository.upsert(validatedPayload);
18
- return {
19
- i18nKey: "ok.update-ok"
20
- };
21
- },
22
- { type: "command" }
23
- );
24
- };
25
- }
26
-
27
- export { createConfigUpsertAction };
@@ -1,8 +0,0 @@
1
- import type { ActionContext } from "../../../../action-context";
2
- import type z from "zod";
3
- import { configUpsertValidator } from "./config-upsert-validator";
4
- export type ConfigUpsertFormData = z.infer<ReturnType<typeof configUpsertValidator>>;
5
- export declare function createConfigUpsertAction(ctx: ActionContext): ({ formData, }: {
6
- formData: ConfigUpsertFormData;
7
- }) => Promise<import("../../../../../../../shared").Result<void>>;
8
- //# sourceMappingURL=create-config-upsert-action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-config-upsert-action.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/server/interfaces/actions/resources/config/commands/upsert/create-config-upsert-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACxC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CACzC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,IAQhB,eAEtC;IACD,QAAQ,EAAE,oBAAoB,CAAC;CAChC,iEAuBF"}