@floristcloud/api-lib 1.2.74 → 1.2.75

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.
@@ -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);
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.74",
3
+ "version": "1.2.75",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {