@floristcloud/api-lib 1.2.74 → 1.2.76

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.
@@ -8,6 +8,9 @@ const CreateCategoryTemplateRequestSchema = schemas_1.CategoryTemplateSchema.pic
8
8
  alias: true,
9
9
  type: true,
10
10
  language: true,
11
+ multiplicity: true,
12
+ isSizeSeparate: true,
13
+ isSaveCategoryName: true,
11
14
  });
12
15
  const CreateCategoryTemplateResponseSchema = zod_1.z.object({
13
16
  message: zod_1.z.string().optional(),
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteCategoryTemplateContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../schemas");
6
+ const DeleteCategoryTemplateResponseSchema = zod_1.z.object({
7
+ message: zod_1.z.string().optional(),
8
+ data: schemas_1.DeleteDataResponseSchema,
9
+ });
10
+ var DeleteCategoryTemplateContractCommand;
11
+ (function (DeleteCategoryTemplateContractCommand) {
12
+ DeleteCategoryTemplateContractCommand.ResponseSchema = DeleteCategoryTemplateResponseSchema;
13
+ })(DeleteCategoryTemplateContractCommand || (exports.DeleteCategoryTemplateContractCommand = DeleteCategoryTemplateContractCommand = {}));
@@ -3,11 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetCategoryTemplateListContractQuery = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const schemas_1 = require("../../schemas");
6
- const GetCategoryTemplateResponseSchema = zod_1.z.object({
6
+ const GetCategoryTemplateListRequestSchema = zod_1.z.object({
7
+ page: zod_1.z.coerce.number().optional().default(1),
8
+ count: zod_1.z.coerce.number().optional().default(10),
9
+ searchQuery: zod_1.z.string().optional(),
10
+ });
11
+ const GetCategoryTemplateListResponseSchema = zod_1.z.object({
7
12
  message: zod_1.z.string().optional(),
8
- data: schemas_1.CategoryTemplateSchema.array(),
13
+ data: schemas_1.CategoryTemplateListSchema,
9
14
  });
10
15
  var GetCategoryTemplateListContractQuery;
11
16
  (function (GetCategoryTemplateListContractQuery) {
12
- GetCategoryTemplateListContractQuery.ResponseSchema = GetCategoryTemplateResponseSchema;
17
+ GetCategoryTemplateListContractQuery.RequestSchema = GetCategoryTemplateListRequestSchema;
18
+ GetCategoryTemplateListContractQuery.ResponseSchema = GetCategoryTemplateListResponseSchema;
13
19
  })(GetCategoryTemplateListContractQuery || (exports.GetCategoryTemplateListContractQuery = GetCategoryTemplateListContractQuery = {}));
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-category-template.command"), exports);
18
+ __exportStar(require("./delete-category-template.command"), exports);
18
19
  __exportStar(require("./get-category-template-by-uuid.query"), exports);
19
20
  __exportStar(require("./get-category-template-list.query"), exports);
20
21
  __exportStar(require("./update-category-template.command"), exports);
@@ -8,7 +8,10 @@ const UpdateCategoryTemplateRequestSchema = schemas_1.CategoryTemplateSchema.pic
8
8
  alias: true,
9
9
  type: true,
10
10
  language: true,
11
- });
11
+ multiplicity: true,
12
+ isSizeSeparate: true,
13
+ isSaveCategoryName: true,
14
+ }).partial();
12
15
  const UpdateCategoryTemplateResponseSchema = zod_1.z.object({
13
16
  message: zod_1.z.string().optional(),
14
17
  data: schemas_1.CategoryTemplateSchema.optional(),
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckProductImageUniquenessContractQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../../schemas");
6
+ // Pre-upload duplicate check: the client sends only the identity fields (no file/key) so it can
7
+ // detect a conflict BEFORE uploading a photo, avoiding an orphaned file when the create would 409.
8
+ // Mirrors the identity subset that CreateProductImage enforces uniqueness on. FC-53.
9
+ const CheckProductImageUniquenessRequestSchema = schemas_1.ProductImageSchema.pick({
10
+ categoryUUID: true,
11
+ name: true,
12
+ color: true,
13
+ country: true,
14
+ grower: true,
15
+ }).required({ categoryUUID: true });
16
+ const CheckProductImageUniquenessResponseSchema = zod_1.z.object({
17
+ data: zod_1.z.object({
18
+ exists: zod_1.z.boolean(),
19
+ // The conflicting live image (uuid + current photo) when exists is true, else null. Same shape
20
+ // the create endpoint returns on a 409, so the client can reuse its "replace/rename" dialog.
21
+ existing: schemas_1.ProductImageSchema.nullable(),
22
+ }),
23
+ });
24
+ var CheckProductImageUniquenessContractQuery;
25
+ (function (CheckProductImageUniquenessContractQuery) {
26
+ CheckProductImageUniquenessContractQuery.RequestSchema = CheckProductImageUniquenessRequestSchema;
27
+ CheckProductImageUniquenessContractQuery.ResponseSchema = CheckProductImageUniquenessResponseSchema;
28
+ })(CheckProductImageUniquenessContractQuery || (exports.CheckProductImageUniquenessContractQuery = CheckProductImageUniquenessContractQuery = {}));
@@ -19,6 +19,7 @@ __exportStar(require("./update-product-image.command"), exports);
19
19
  __exportStar(require("./delete-product-image.command"), exports);
20
20
  __exportStar(require("./get-product-image.query"), exports);
21
21
  __exportStar(require("./get-product-image-deletion-impact.query"), exports);
22
+ __exportStar(require("./check-product-image-uniqueness.query"), exports);
22
23
  __exportStar(require("./get-product-image-list.query"), exports);
23
24
  __exportStar(require("./sync-product-image.command"), exports);
24
25
  __exportStar(require("./group/delete-group-product-image.command"), exports);
@@ -292,6 +292,11 @@ exports.ERRORS = {
292
292
  CATEGORY_TEMPLATE_NOT_UPDATED: { code: 'CT003', message: 'Failed to update category template', httpCode: 500 },
293
293
  CATEGORY_TEMPLATE_NOT_FOUND: { code: 'CT004', message: 'Category template not found', httpCode: 404 },
294
294
  CATEGORY_TEMPLATE_FETCH_FAILED: { code: 'CT005', message: 'Error when retrieving a category template', httpCode: 500 },
295
+ CATEGORY_TEMPLATE_HAS_PRODUCT_IMAGE_TEMPLATES: {
296
+ code: 'CT006',
297
+ message: 'Cannot delete category template that has product image templates',
298
+ httpCode: 409,
299
+ },
295
300
  // ProductImageTemplate
296
301
  PRODUCT_IMAGE_TEMPLATE_NOT_CREATED: { code: 'PIT001', message: 'Failed to create product image template', httpCode: 500 },
297
302
  PRODUCT_IMAGE_TEMPLATE_NOT_DELETED: { code: 'PIT002', message: 'Failed to delete product image template', httpCode: 500 },
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CategoryTemplateSchema = exports.CategoryTemplateTypeSchema = void 0;
3
+ exports.CategoryTemplateListSchema = exports.CategoryTemplateSchema = exports.CategoryTemplateTypeSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const language_enum_1 = require("../../enum/language.enum");
6
6
  exports.CategoryTemplateTypeSchema = zod_1.z.object({
@@ -13,7 +13,14 @@ exports.CategoryTemplateSchema = zod_1.z.object({
13
13
  alias: zod_1.z.string().array(),
14
14
  type: exports.CategoryTemplateTypeSchema,
15
15
  language: zod_1.z.nativeEnum(language_enum_1.LanguageEnum),
16
+ multiplicity: zod_1.z.number(),
17
+ isSizeSeparate: zod_1.z.boolean(),
18
+ isSaveCategoryName: zod_1.z.boolean(),
16
19
  deletedAt: zod_1.z.date().nullable(),
17
20
  createdAt: zod_1.z.date(),
18
21
  updatedAt: zod_1.z.date(),
19
22
  });
23
+ exports.CategoryTemplateListSchema = zod_1.z.object({
24
+ list: exports.CategoryTemplateSchema.array(),
25
+ total: zod_1.z.number(),
26
+ });
@@ -6,6 +6,9 @@ const CreateCategoryTemplateRequestSchema = CategoryTemplateSchema.pick({
6
6
  alias: true,
7
7
  type: true,
8
8
  language: true,
9
+ multiplicity: true,
10
+ isSizeSeparate: true,
11
+ isSaveCategoryName: true,
9
12
  });
10
13
 
11
14
  const CreateCategoryTemplateResponseSchema = z.object({
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { DeleteDataResponseSchema } from '../../schemas';
3
+
4
+ const DeleteCategoryTemplateResponseSchema = z.object({
5
+ message: z.string().optional(),
6
+ data: DeleteDataResponseSchema,
7
+ });
8
+
9
+ export namespace DeleteCategoryTemplateContractCommand {
10
+ export const ResponseSchema = DeleteCategoryTemplateResponseSchema;
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -1,12 +1,21 @@
1
1
  import { z } from 'zod';
2
- import { CategoryTemplateSchema } from '../../schemas';
2
+ import { CategoryTemplateListSchema } from '../../schemas';
3
3
 
4
- const GetCategoryTemplateResponseSchema = z.object({
4
+ const GetCategoryTemplateListRequestSchema = z.object({
5
+ page: z.coerce.number().optional().default(1),
6
+ count: z.coerce.number().optional().default(10),
7
+ searchQuery: z.string().optional(),
8
+ });
9
+
10
+ const GetCategoryTemplateListResponseSchema = z.object({
5
11
  message: z.string().optional(),
6
- data: CategoryTemplateSchema.array(),
12
+ data: CategoryTemplateListSchema,
7
13
  });
8
14
 
9
15
  export namespace GetCategoryTemplateListContractQuery {
10
- export const ResponseSchema = GetCategoryTemplateResponseSchema;
16
+ export const RequestSchema = GetCategoryTemplateListRequestSchema;
17
+ export type Request = z.infer<typeof RequestSchema>;
18
+
19
+ export const ResponseSchema = GetCategoryTemplateListResponseSchema;
11
20
  export type Response = z.infer<typeof ResponseSchema>;
12
21
  }
@@ -1,4 +1,5 @@
1
1
  export * from './create-category-template.command';
2
+ export * from './delete-category-template.command';
2
3
  export * from './get-category-template-by-uuid.query';
3
4
  export * from './get-category-template-list.query';
4
5
  export * from './update-category-template.command';
@@ -6,7 +6,10 @@ const UpdateCategoryTemplateRequestSchema = CategoryTemplateSchema.pick({
6
6
  alias: true,
7
7
  type: true,
8
8
  language: true,
9
- });
9
+ multiplicity: true,
10
+ isSizeSeparate: true,
11
+ isSaveCategoryName: true,
12
+ }).partial();
10
13
 
11
14
  const UpdateCategoryTemplateResponseSchema = z.object({
12
15
  message: z.string().optional(),
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { ProductImageSchema } from '../../schemas';
3
+
4
+ // Pre-upload duplicate check: the client sends only the identity fields (no file/key) so it can
5
+ // detect a conflict BEFORE uploading a photo, avoiding an orphaned file when the create would 409.
6
+ // Mirrors the identity subset that CreateProductImage enforces uniqueness on. FC-53.
7
+ const CheckProductImageUniquenessRequestSchema = ProductImageSchema.pick({
8
+ categoryUUID: true,
9
+ name: true,
10
+ color: true,
11
+ country: true,
12
+ grower: true,
13
+ }).required({ categoryUUID: true });
14
+
15
+ const CheckProductImageUniquenessResponseSchema = z.object({
16
+ data: z.object({
17
+ exists: z.boolean(),
18
+ // The conflicting live image (uuid + current photo) when exists is true, else null. Same shape
19
+ // the create endpoint returns on a 409, so the client can reuse its "replace/rename" dialog.
20
+ existing: ProductImageSchema.nullable(),
21
+ }),
22
+ });
23
+
24
+ export namespace CheckProductImageUniquenessContractQuery {
25
+ export const RequestSchema = CheckProductImageUniquenessRequestSchema;
26
+ export type Request = z.infer<typeof RequestSchema>;
27
+
28
+ export const ResponseSchema = CheckProductImageUniquenessResponseSchema;
29
+ export type Response = z.infer<typeof ResponseSchema>;
30
+ }
@@ -3,6 +3,7 @@ export * from './update-product-image.command';
3
3
  export * from './delete-product-image.command';
4
4
  export * from './get-product-image.query';
5
5
  export * from './get-product-image-deletion-impact.query';
6
+ export * from './check-product-image-uniqueness.query';
6
7
  export * from './get-product-image-list.query';
7
8
  export * from './sync-product-image.command';
8
9
  export * from './group/delete-group-product-image.command';
package/constant/error.ts CHANGED
@@ -304,6 +304,11 @@ export const ERRORS = {
304
304
  CATEGORY_TEMPLATE_NOT_UPDATED: { code: 'CT003', message: 'Failed to update category template', httpCode: 500 },
305
305
  CATEGORY_TEMPLATE_NOT_FOUND: { code: 'CT004', message: 'Category template not found', httpCode: 404 },
306
306
  CATEGORY_TEMPLATE_FETCH_FAILED: { code: 'CT005', message: 'Error when retrieving a category template', httpCode: 500 },
307
+ CATEGORY_TEMPLATE_HAS_PRODUCT_IMAGE_TEMPLATES: {
308
+ code: 'CT006',
309
+ message: 'Cannot delete category template that has product image templates',
310
+ httpCode: 409,
311
+ },
307
312
 
308
313
  // ProductImageTemplate
309
314
  PRODUCT_IMAGE_TEMPLATE_NOT_CREATED: { code: 'PIT001', message: 'Failed to create product image template', httpCode: 500 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.74",
3
+ "version": "1.2.76",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -12,7 +12,15 @@ export const CategoryTemplateSchema = z.object({
12
12
  alias: z.string().array(),
13
13
  type: CategoryTemplateTypeSchema,
14
14
  language: z.nativeEnum(LanguageEnum),
15
+ multiplicity: z.number(),
16
+ isSizeSeparate: z.boolean(),
17
+ isSaveCategoryName: z.boolean(),
15
18
  deletedAt: z.date().nullable(),
16
19
  createdAt: z.date(),
17
20
  updatedAt: z.date(),
18
21
  });
22
+
23
+ export const CategoryTemplateListSchema = z.object({
24
+ list: CategoryTemplateSchema.array(),
25
+ total: z.number(),
26
+ });