@floristcloud/api-lib 1.2.73 → 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.
- package/build/commands/index.js +2 -0
- package/build/commands/order-service-line/create-order-service-line.command.js +9 -0
- package/build/commands/order-service-line/delete-order-service-line.command.js +8 -0
- package/build/commands/order-service-line/get-order-service-line-list.query.js +9 -0
- package/build/commands/order-service-line/index.js +20 -0
- package/build/commands/order-service-line/update-order-service-line.command.js +9 -0
- package/build/commands/product/create-product.command.js +1 -0
- package/build/commands/product/update-product.command.js +1 -0
- package/build/commands/product/webshop/get-product-list-for-client.query.js +2 -0
- package/build/commands/product-image/check-product-image-uniqueness.query.js +28 -0
- package/build/commands/product-image/index.js +1 -0
- package/build/commands/service/create-service.command.js +14 -0
- package/build/commands/service/get-service-list.query.js +17 -0
- package/build/commands/service/index.js +19 -0
- package/build/commands/service/update-service.command.js +14 -0
- package/build/constant/error.js +18 -0
- package/build/enum/index.js +3 -0
- package/build/enum/product-mark.enum.js +7 -0
- package/build/enum/service-pricing-unit.enum.js +9 -0
- package/build/enum/service-status.enum.js +8 -0
- package/build/schemas/index.js +2 -0
- package/build/schemas/order-service-line/order-service-line.schema.js +61 -0
- package/build/schemas/product/product.schema.js +2 -0
- package/build/schemas/service/service.schema.js +35 -0
- package/commands/index.ts +2 -0
- package/commands/order-service-line/create-order-service-line.command.ts +13 -0
- package/commands/order-service-line/delete-order-service-line.command.ts +7 -0
- package/commands/order-service-line/get-order-service-line-list.query.ts +13 -0
- package/commands/order-service-line/index.ts +4 -0
- package/commands/order-service-line/update-order-service-line.command.ts +13 -0
- package/commands/product/create-product.command.ts +2 -1
- package/commands/product/update-product.command.ts +2 -1
- package/commands/product/webshop/get-product-list-for-client.query.ts +2 -0
- package/commands/product-image/check-product-image-uniqueness.query.ts +30 -0
- package/commands/product-image/index.ts +1 -0
- package/commands/service/create-service.command.ts +15 -0
- package/commands/service/get-service-list.query.ts +18 -0
- package/commands/service/index.ts +3 -0
- package/commands/service/update-service.command.ts +15 -0
- package/constant/error.ts +20 -0
- package/enum/index.ts +3 -0
- package/enum/product-mark.enum.ts +3 -0
- package/enum/service-pricing-unit.enum.ts +5 -0
- package/enum/service-status.enum.ts +4 -0
- package/package.json +1 -1
- package/schemas/index.ts +2 -0
- package/schemas/order-service-line/order-service-line.schema.ts +66 -0
- package/schemas/product/product.schema.ts +3 -1
- package/schemas/service/service.schema.ts +36 -0
package/build/commands/index.js
CHANGED
|
@@ -65,6 +65,8 @@ __exportStar(require("./product-configuration/find-product-configuration-by-attr
|
|
|
65
65
|
__exportStar(require("./bank-payment"), exports);
|
|
66
66
|
__exportStar(require("./integration"), exports);
|
|
67
67
|
__exportStar(require("./account-deletion-request"), exports);
|
|
68
|
+
__exportStar(require("./service"), exports);
|
|
69
|
+
__exportStar(require("./order-service-line"), exports);
|
|
68
70
|
// Session contracts exported individually to avoid webpack TDZ issues with Next.js SSG
|
|
69
71
|
var session_logout_command_1 = require("./session/session-logout.command");
|
|
70
72
|
Object.defineProperty(exports, "SessionLogoutContractCommand", { enumerable: true, get: function () { return session_logout_command_1.SessionLogoutContractCommand; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateOrderServiceLineContractCommand = void 0;
|
|
4
|
+
const order_service_line_schema_1 = require("../../schemas/order-service-line/order-service-line.schema");
|
|
5
|
+
var CreateOrderServiceLineContractCommand;
|
|
6
|
+
(function (CreateOrderServiceLineContractCommand) {
|
|
7
|
+
CreateOrderServiceLineContractCommand.RequestSchema = order_service_line_schema_1.CreateOrderServiceLineRequestSchema;
|
|
8
|
+
CreateOrderServiceLineContractCommand.ResponseSchema = order_service_line_schema_1.CreateOrderServiceLineResponseSchema;
|
|
9
|
+
})(CreateOrderServiceLineContractCommand || (exports.CreateOrderServiceLineContractCommand = CreateOrderServiceLineContractCommand = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteOrderServiceLineContractCommand = void 0;
|
|
4
|
+
const order_service_line_schema_1 = require("../../schemas/order-service-line/order-service-line.schema");
|
|
5
|
+
var DeleteOrderServiceLineContractCommand;
|
|
6
|
+
(function (DeleteOrderServiceLineContractCommand) {
|
|
7
|
+
DeleteOrderServiceLineContractCommand.ResponseSchema = order_service_line_schema_1.DeleteOrderServiceLineResponseSchema;
|
|
8
|
+
})(DeleteOrderServiceLineContractCommand || (exports.DeleteOrderServiceLineContractCommand = DeleteOrderServiceLineContractCommand = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrderServiceLineListContractQuery = void 0;
|
|
4
|
+
const order_service_line_schema_1 = require("../../schemas/order-service-line/order-service-line.schema");
|
|
5
|
+
var GetOrderServiceLineListContractQuery;
|
|
6
|
+
(function (GetOrderServiceLineListContractQuery) {
|
|
7
|
+
GetOrderServiceLineListContractQuery.RequestSchema = order_service_line_schema_1.GetOrderServiceLineListRequestSchema;
|
|
8
|
+
GetOrderServiceLineListContractQuery.ResponseSchema = order_service_line_schema_1.GetOrderServiceLineListResponseSchema;
|
|
9
|
+
})(GetOrderServiceLineListContractQuery || (exports.GetOrderServiceLineListContractQuery = GetOrderServiceLineListContractQuery = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-order-service-line.command"), exports);
|
|
18
|
+
__exportStar(require("./update-order-service-line.command"), exports);
|
|
19
|
+
__exportStar(require("./delete-order-service-line.command"), exports);
|
|
20
|
+
__exportStar(require("./get-order-service-line-list.query"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateOrderServiceLineContractCommand = void 0;
|
|
4
|
+
const order_service_line_schema_1 = require("../../schemas/order-service-line/order-service-line.schema");
|
|
5
|
+
var UpdateOrderServiceLineContractCommand;
|
|
6
|
+
(function (UpdateOrderServiceLineContractCommand) {
|
|
7
|
+
UpdateOrderServiceLineContractCommand.RequestSchema = order_service_line_schema_1.UpdateOrderServiceLineRequestSchema;
|
|
8
|
+
UpdateOrderServiceLineContractCommand.ResponseSchema = order_service_line_schema_1.UpdateOrderServiceLineResponseSchema;
|
|
9
|
+
})(UpdateOrderServiceLineContractCommand || (exports.UpdateOrderServiceLineContractCommand = UpdateOrderServiceLineContractCommand = {}));
|
|
@@ -31,6 +31,7 @@ const CreateProductRequestSchema = zod_1.z.object({
|
|
|
31
31
|
vat: zod_1.z.number().nullable(),
|
|
32
32
|
multiplicityDescription: zod_1.z.string().nullable(),
|
|
33
33
|
salesUnit: zod_1.z.nativeEnum(enum_1.SalesUnitEnum).optional().nullable(),
|
|
34
|
+
marks: zod_1.z.array(zod_1.z.nativeEnum(enum_1.ProductMarkEnum)).optional(),
|
|
34
35
|
});
|
|
35
36
|
const CreateProductResponseSchema = zod_1.z.object({
|
|
36
37
|
message: zod_1.z.string().optional(),
|
|
@@ -31,6 +31,7 @@ const UpdateProductRequestSchema = zod_1.z.object({
|
|
|
31
31
|
vat: zod_1.z.number().nullable(),
|
|
32
32
|
multiplicityDescription: zod_1.z.string().nullable(),
|
|
33
33
|
salesUnit: zod_1.z.nativeEnum(enum_1.SalesUnitEnum).optional().nullable(),
|
|
34
|
+
marks: zod_1.z.array(zod_1.z.nativeEnum(enum_1.ProductMarkEnum)).optional(),
|
|
34
35
|
});
|
|
35
36
|
const UpdateProductResponseSchema = zod_1.z.object({
|
|
36
37
|
message: zod_1.z.string().optional(),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetProductListForClientContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../../enum");
|
|
5
6
|
const schemas_1 = require("../../../schemas");
|
|
6
7
|
const GetProductListForClientRequestSchema = zod_1.z.object({
|
|
7
8
|
page: zod_1.z.string().transform(val => Number(val) || 1),
|
|
@@ -18,6 +19,7 @@ const GetProductListForClientRequestSchema = zod_1.z.object({
|
|
|
18
19
|
categoryUUID: zod_1.z.string().optional(),
|
|
19
20
|
typeUUID: zod_1.z.string().optional(),
|
|
20
21
|
searchQuery: zod_1.z.string().optional(),
|
|
22
|
+
marks: zod_1.z.nativeEnum(enum_1.ProductMarkEnum).array().optional(),
|
|
21
23
|
});
|
|
22
24
|
const GetProductListForClientResponseSchema = zod_1.z.object({
|
|
23
25
|
message: zod_1.z.string().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);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateServiceContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const service_schema_1 = require("../../schemas/service/service.schema");
|
|
6
|
+
const CreateServiceResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: service_schema_1.ServiceSchema,
|
|
9
|
+
});
|
|
10
|
+
var CreateServiceContractCommand;
|
|
11
|
+
(function (CreateServiceContractCommand) {
|
|
12
|
+
CreateServiceContractCommand.RequestSchema = service_schema_1.CreateServiceRequestSchema;
|
|
13
|
+
CreateServiceContractCommand.ResponseSchema = CreateServiceResponseSchema;
|
|
14
|
+
})(CreateServiceContractCommand || (exports.CreateServiceContractCommand = CreateServiceContractCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetServiceListContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const service_schema_1 = require("../../schemas/service/service.schema");
|
|
6
|
+
const GetServiceListResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: zod_1.z.object({
|
|
9
|
+
serviceList: service_schema_1.ServiceSchema.array(),
|
|
10
|
+
total: zod_1.z.number(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
var GetServiceListContractQuery;
|
|
14
|
+
(function (GetServiceListContractQuery) {
|
|
15
|
+
GetServiceListContractQuery.RequestSchema = service_schema_1.GetServiceListRequestSchema;
|
|
16
|
+
GetServiceListContractQuery.ResponseSchema = GetServiceListResponseSchema;
|
|
17
|
+
})(GetServiceListContractQuery || (exports.GetServiceListContractQuery = GetServiceListContractQuery = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-service.command"), exports);
|
|
18
|
+
__exportStar(require("./update-service.command"), exports);
|
|
19
|
+
__exportStar(require("./get-service-list.query"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateServiceContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const service_schema_1 = require("../../schemas/service/service.schema");
|
|
6
|
+
const UpdateServiceResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: service_schema_1.ServiceSchema,
|
|
9
|
+
});
|
|
10
|
+
var UpdateServiceContractCommand;
|
|
11
|
+
(function (UpdateServiceContractCommand) {
|
|
12
|
+
UpdateServiceContractCommand.RequestSchema = service_schema_1.UpdateServiceRequestSchema;
|
|
13
|
+
UpdateServiceContractCommand.ResponseSchema = UpdateServiceResponseSchema;
|
|
14
|
+
})(UpdateServiceContractCommand || (exports.UpdateServiceContractCommand = UpdateServiceContractCommand = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -58,6 +58,11 @@ exports.ERRORS = {
|
|
|
58
58
|
PRODUCT_IMAGE_NOT_DELETED: { code: 'PI002', message: 'Failed to delete Product Image', httpCode: 500 },
|
|
59
59
|
PRODUCT_IMAGE_NOT_UPDATED: { code: 'PI003', message: 'Failed to update Product Image', httpCode: 500 },
|
|
60
60
|
PRODUCT_IMAGE_NAME_ALREADY_EXISTS: { code: 'PI004', message: 'Product Image name already exists', httpCode: 409 },
|
|
61
|
+
PRODUCT_IMAGE_ALREADY_EXISTS: {
|
|
62
|
+
code: 'PI014',
|
|
63
|
+
message: 'Product image with the same category, name, grower, country and color already exists',
|
|
64
|
+
httpCode: 409,
|
|
65
|
+
},
|
|
61
66
|
PRODUCT_IMAGE_NOT_FOUND: { code: 'PI005', message: 'Product Image with the specified UUID was not found', httpCode: 404 },
|
|
62
67
|
PRODUCT_IMAGE_FETCH_FAILED: { code: 'PI006', message: 'Error when retrieving a Product Image', httpCode: 500 },
|
|
63
68
|
PRODUCT_IMAGE_FILTERS_VALUES_FETCH_FAILED: {
|
|
@@ -379,6 +384,19 @@ exports.ERRORS = {
|
|
|
379
384
|
message: 'Delivery information will be transferred to the target order.',
|
|
380
385
|
httpCode: 400,
|
|
381
386
|
},
|
|
387
|
+
//SERVICE
|
|
388
|
+
SERVICE_NOT_CREATED: { code: 'SV001', message: 'Failed to create service', httpCode: 500 },
|
|
389
|
+
SERVICE_FETCH_FAILED: { code: 'SV002', message: 'Error when retrieving a service', httpCode: 500 },
|
|
390
|
+
SERVICE_NOT_FOUND: { code: 'SV003', message: 'Service not found', httpCode: 404 },
|
|
391
|
+
SERVICE_NOT_UPDATED: { code: 'SV004', message: 'Service not updated', httpCode: 500 },
|
|
392
|
+
SERVICE_NOT_ACTIVE: { code: 'SV005', message: 'Service is not active', httpCode: 409 },
|
|
393
|
+
//ORDER SERVICE LINE
|
|
394
|
+
ORDER_SERVICE_LINE_NOT_CREATED: { code: 'OSL001', message: 'Failed to add service to order', httpCode: 500 },
|
|
395
|
+
ORDER_SERVICE_LINE_FETCH_FAILED: { code: 'OSL002', message: 'Error when retrieving order services', httpCode: 500 },
|
|
396
|
+
ORDER_SERVICE_LINE_NOT_FOUND: { code: 'OSL003', message: 'Service in order not found', httpCode: 404 },
|
|
397
|
+
ORDER_SERVICE_LINE_NOT_DELETED: { code: 'OSL004', message: 'Service in order not deleted', httpCode: 500 },
|
|
398
|
+
ORDER_SERVICE_LINE_NOT_UPDATED: { code: 'OSL005', message: 'Service in order not updated', httpCode: 500 },
|
|
399
|
+
ORDER_SERVICE_LINE_MODIFY_NOT_ALLOWED: { code: 'OSL006', message: 'Modifying order services is not allowed', httpCode: 409 },
|
|
382
400
|
//ORDER DELIVERY
|
|
383
401
|
ORDER_DELIVERY_ALREADY_EXIST: { code: 'OD006', message: 'Delivery for the order already exists', httpCode: 409 },
|
|
384
402
|
ORDER_DELIVERY_NOT_CREATED: { code: 'OD007', message: 'Failed to create order delivery', httpCode: 500 },
|
package/build/enum/index.js
CHANGED
|
@@ -62,11 +62,14 @@ __exportStar(require("./write-off-status.enum"), exports);
|
|
|
62
62
|
__exportStar(require("./position-report-type.enum"), exports);
|
|
63
63
|
__exportStar(require("./discount-price-routing.enum"), exports);
|
|
64
64
|
__exportStar(require("./sales-unit.enum"), exports);
|
|
65
|
+
__exportStar(require("./product-mark.enum"), exports);
|
|
65
66
|
__exportStar(require("./sales-by-position-group-by.enum"), exports);
|
|
66
67
|
__exportStar(require("./client-import-entity-property.enum"), exports);
|
|
67
68
|
__exportStar(require("./client-import-errors.enum"), exports);
|
|
68
69
|
__exportStar(require("./transaction-import-entity-property.enum"), exports);
|
|
69
70
|
__exportStar(require("./transaction-import-errors.enum"), exports);
|
|
71
|
+
__exportStar(require("./service-pricing-unit.enum"), exports);
|
|
72
|
+
__exportStar(require("./service-status.enum"), exports);
|
|
70
73
|
__exportStar(require("./pre-order-collection-item-import-entity-property.enum"), exports);
|
|
71
74
|
__exportStar(require("./pre-order-collection-item-import-errors.enum"), exports);
|
|
72
75
|
__exportStar(require("./report-period-type.enum"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductMarkEnum = void 0;
|
|
4
|
+
var ProductMarkEnum;
|
|
5
|
+
(function (ProductMarkEnum) {
|
|
6
|
+
ProductMarkEnum["HOT_LIST"] = "HOT_LIST";
|
|
7
|
+
})(ProductMarkEnum || (exports.ProductMarkEnum = ProductMarkEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServicePricingUnitEnum = void 0;
|
|
4
|
+
var ServicePricingUnitEnum;
|
|
5
|
+
(function (ServicePricingUnitEnum) {
|
|
6
|
+
ServicePricingUnitEnum["FIXED"] = "FIXED";
|
|
7
|
+
ServicePricingUnitEnum["PER_ITEM"] = "PER_ITEM";
|
|
8
|
+
ServicePricingUnitEnum["PER_QUANTITY"] = "PER_QUANTITY";
|
|
9
|
+
})(ServicePricingUnitEnum || (exports.ServicePricingUnitEnum = ServicePricingUnitEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceStatusEnum = void 0;
|
|
4
|
+
var ServiceStatusEnum;
|
|
5
|
+
(function (ServiceStatusEnum) {
|
|
6
|
+
ServiceStatusEnum["ACTIVE"] = "ACTIVE";
|
|
7
|
+
ServiceStatusEnum["ARCHIVED"] = "ARCHIVED";
|
|
8
|
+
})(ServiceStatusEnum || (exports.ServiceStatusEnum = ServiceStatusEnum = {}));
|
package/build/schemas/index.js
CHANGED
|
@@ -60,6 +60,8 @@ __exportStar(require("./employee-schedule/employee-schedule.schema"), exports);
|
|
|
60
60
|
__exportStar(require("./work-session/work-session.schema"), exports);
|
|
61
61
|
__exportStar(require("./discount-rules/discount-rules.schema"), exports);
|
|
62
62
|
__exportStar(require("./package/validate-package.schema"), exports);
|
|
63
|
+
__exportStar(require("./service/service.schema"), exports);
|
|
64
|
+
__exportStar(require("./order-service-line/order-service-line.schema"), exports);
|
|
63
65
|
__exportStar(require("./distribution/validate-distribution-by-product.schema"), exports);
|
|
64
66
|
__exportStar(require("./consignment/consignment-distribution-validation.schema"), exports);
|
|
65
67
|
__exportStar(require("./product-image-template/product-image-template.schema"), exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteOrderServiceLineResponseSchema = exports.GetOrderServiceLineListResponseSchema = exports.UpdateOrderServiceLineResponseSchema = exports.CreateOrderServiceLineResponseSchema = exports.GetOrderServiceLineListRequestSchema = exports.UpdateOrderServiceLineRequestSchema = exports.CreateOrderServiceLineRequestSchema = exports.OrderServiceLineSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const service_pricing_unit_enum_1 = require("../../enum/service-pricing-unit.enum");
|
|
6
|
+
exports.OrderServiceLineSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.uuid(),
|
|
8
|
+
orderUUID: zod_1.z.uuid(),
|
|
9
|
+
serviceUUID: zod_1.z.uuid().nullable(),
|
|
10
|
+
name: zod_1.z.string(),
|
|
11
|
+
price: zod_1.z.number(),
|
|
12
|
+
quantity: zod_1.z.number(),
|
|
13
|
+
amount: zod_1.z.number(),
|
|
14
|
+
vat: zod_1.z.number().nullable(),
|
|
15
|
+
vatAmount: zod_1.z.number(),
|
|
16
|
+
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum),
|
|
17
|
+
comment: zod_1.z.string().nullable(),
|
|
18
|
+
createdAt: zod_1.z.date(),
|
|
19
|
+
updatedAt: zod_1.z.date(),
|
|
20
|
+
});
|
|
21
|
+
exports.CreateOrderServiceLineRequestSchema = zod_1.z
|
|
22
|
+
.object({
|
|
23
|
+
orderUUID: zod_1.z.uuid(),
|
|
24
|
+
serviceUUID: zod_1.z.uuid().optional(),
|
|
25
|
+
name: zod_1.z.string().min(1).max(255).optional(),
|
|
26
|
+
price: zod_1.z.number().min(0).max(1000000000).optional(),
|
|
27
|
+
quantity: zod_1.z.number().int().min(1).max(1000000).optional().default(1),
|
|
28
|
+
vat: zod_1.z.number().int().min(0).max(100).optional(),
|
|
29
|
+
comment: zod_1.z.string().max(1000).optional(),
|
|
30
|
+
})
|
|
31
|
+
.refine(data => data.serviceUUID || (data.name && data.price !== undefined), {
|
|
32
|
+
message: 'Either serviceUUID or both name and price must be provided',
|
|
33
|
+
});
|
|
34
|
+
exports.UpdateOrderServiceLineRequestSchema = zod_1.z.object({
|
|
35
|
+
price: zod_1.z.number().min(0).max(1000000000).optional(),
|
|
36
|
+
quantity: zod_1.z.number().int().min(1).max(1000000).optional(),
|
|
37
|
+
comment: zod_1.z.string().max(1000).nullable().optional(),
|
|
38
|
+
});
|
|
39
|
+
exports.GetOrderServiceLineListRequestSchema = zod_1.z.object({
|
|
40
|
+
orderUUID: zod_1.z.uuid(),
|
|
41
|
+
});
|
|
42
|
+
exports.CreateOrderServiceLineResponseSchema = zod_1.z.object({
|
|
43
|
+
message: zod_1.z.string().optional(),
|
|
44
|
+
data: exports.OrderServiceLineSchema,
|
|
45
|
+
});
|
|
46
|
+
exports.UpdateOrderServiceLineResponseSchema = zod_1.z.object({
|
|
47
|
+
message: zod_1.z.string().optional(),
|
|
48
|
+
data: exports.OrderServiceLineSchema,
|
|
49
|
+
});
|
|
50
|
+
exports.GetOrderServiceLineListResponseSchema = zod_1.z.object({
|
|
51
|
+
message: zod_1.z.string().optional(),
|
|
52
|
+
data: zod_1.z.object({
|
|
53
|
+
serviceLineList: exports.OrderServiceLineSchema.array(),
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
exports.DeleteOrderServiceLineResponseSchema = zod_1.z.object({
|
|
57
|
+
message: zod_1.z.string().optional(),
|
|
58
|
+
data: zod_1.z.object({
|
|
59
|
+
success: zod_1.z.boolean(),
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
@@ -37,6 +37,7 @@ exports.ProductSchema = zod_1.z.object({
|
|
|
37
37
|
vat: zod_1.z.number().nullable(),
|
|
38
38
|
multiplicityDescription: zod_1.z.string().nullable(),
|
|
39
39
|
salesUnit: zod_1.z.nativeEnum(enum_1.SalesUnitEnum).nullable(),
|
|
40
|
+
marks: zod_1.z.array(zod_1.z.nativeEnum(enum_1.ProductMarkEnum)),
|
|
40
41
|
createdAt: zod_1.z.date(),
|
|
41
42
|
updatedAt: zod_1.z.date(),
|
|
42
43
|
});
|
|
@@ -63,6 +64,7 @@ exports.ProductForClientSchema = zod_1.z.object({
|
|
|
63
64
|
grower: zod_1.z.string().nullable(),
|
|
64
65
|
multiplicityDescription: zod_1.z.string().nullable(),
|
|
65
66
|
salesUnit: zod_1.z.nativeEnum(enum_1.SalesUnitEnum).nullable(),
|
|
67
|
+
marks: zod_1.z.array(zod_1.z.nativeEnum(enum_1.ProductMarkEnum)),
|
|
66
68
|
});
|
|
67
69
|
exports.ProductExtendedForClientSchema = exports.ProductForClientSchema.merge(zod_1.z.object({
|
|
68
70
|
category: zod_1.z
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetServiceListRequestSchema = exports.UpdateServiceRequestSchema = exports.CreateServiceRequestSchema = exports.ServiceSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const service_pricing_unit_enum_1 = require("../../enum/service-pricing-unit.enum");
|
|
6
|
+
const service_status_enum_1 = require("../../enum/service-status.enum");
|
|
7
|
+
exports.ServiceSchema = zod_1.z.object({
|
|
8
|
+
uuid: zod_1.z.uuid(),
|
|
9
|
+
name: zod_1.z.string(),
|
|
10
|
+
price: zod_1.z.number(),
|
|
11
|
+
vat: zod_1.z.number().nullable(),
|
|
12
|
+
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum),
|
|
13
|
+
status: zod_1.z.nativeEnum(service_status_enum_1.ServiceStatusEnum),
|
|
14
|
+
createdAt: zod_1.z.date(),
|
|
15
|
+
updatedAt: zod_1.z.date(),
|
|
16
|
+
});
|
|
17
|
+
exports.CreateServiceRequestSchema = zod_1.z.object({
|
|
18
|
+
name: zod_1.z.string().min(1).max(255),
|
|
19
|
+
price: zod_1.z.number().min(0).max(1000000000),
|
|
20
|
+
vat: zod_1.z.number().int().min(0).max(100).nullable().optional(),
|
|
21
|
+
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum).optional().default(service_pricing_unit_enum_1.ServicePricingUnitEnum.FIXED),
|
|
22
|
+
});
|
|
23
|
+
exports.UpdateServiceRequestSchema = zod_1.z.object({
|
|
24
|
+
name: zod_1.z.string().min(1).max(255).optional(),
|
|
25
|
+
price: zod_1.z.number().min(0).max(1000000000).optional(),
|
|
26
|
+
vat: zod_1.z.number().int().min(0).max(100).nullable().optional(),
|
|
27
|
+
unit: zod_1.z.nativeEnum(service_pricing_unit_enum_1.ServicePricingUnitEnum).optional(),
|
|
28
|
+
status: zod_1.z.nativeEnum(service_status_enum_1.ServiceStatusEnum).optional(),
|
|
29
|
+
});
|
|
30
|
+
exports.GetServiceListRequestSchema = zod_1.z.object({
|
|
31
|
+
page: zod_1.z.coerce.number().int().positive().optional().default(1),
|
|
32
|
+
count: zod_1.z.coerce.number().int().positive().max(100).optional().default(10),
|
|
33
|
+
searchQuery: zod_1.z.string().max(255).optional(),
|
|
34
|
+
statuses: zod_1.z.array(zod_1.z.nativeEnum(service_status_enum_1.ServiceStatusEnum)).default([]),
|
|
35
|
+
});
|
package/commands/index.ts
CHANGED
|
@@ -48,6 +48,8 @@ export * from './product-configuration/find-product-configuration-by-attributes.
|
|
|
48
48
|
export * from './bank-payment';
|
|
49
49
|
export * from './integration';
|
|
50
50
|
export * from './account-deletion-request';
|
|
51
|
+
export * from './service';
|
|
52
|
+
export * from './order-service-line';
|
|
51
53
|
// Session contracts exported individually to avoid webpack TDZ issues with Next.js SSG
|
|
52
54
|
export { SessionLogoutContractCommand } from './session/session-logout.command';
|
|
53
55
|
export { SessionRevokeAllContractCommand } from './session/session-revoke-all.command';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
CreateOrderServiceLineRequestSchema,
|
|
4
|
+
CreateOrderServiceLineResponseSchema,
|
|
5
|
+
} from '../../schemas/order-service-line/order-service-line.schema';
|
|
6
|
+
|
|
7
|
+
export namespace CreateOrderServiceLineContractCommand {
|
|
8
|
+
export const RequestSchema = CreateOrderServiceLineRequestSchema;
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = CreateOrderServiceLineResponseSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DeleteOrderServiceLineResponseSchema } from '../../schemas/order-service-line/order-service-line.schema';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteOrderServiceLineContractCommand {
|
|
5
|
+
export const ResponseSchema = DeleteOrderServiceLineResponseSchema;
|
|
6
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
GetOrderServiceLineListRequestSchema,
|
|
4
|
+
GetOrderServiceLineListResponseSchema,
|
|
5
|
+
} from '../../schemas/order-service-line/order-service-line.schema';
|
|
6
|
+
|
|
7
|
+
export namespace GetOrderServiceLineListContractQuery {
|
|
8
|
+
export const RequestSchema = GetOrderServiceLineListRequestSchema;
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = GetOrderServiceLineListResponseSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
UpdateOrderServiceLineRequestSchema,
|
|
4
|
+
UpdateOrderServiceLineResponseSchema,
|
|
5
|
+
} from '../../schemas/order-service-line/order-service-line.schema';
|
|
6
|
+
|
|
7
|
+
export namespace UpdateOrderServiceLineContractCommand {
|
|
8
|
+
export const RequestSchema = UpdateOrderServiceLineRequestSchema;
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = UpdateOrderServiceLineResponseSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SalesUnitEnum } from '../../enum';
|
|
2
|
+
import { ProductMarkEnum, SalesUnitEnum } from '../../enum';
|
|
3
3
|
import { ProductExtendedForAdminSchema } from '../../schemas';
|
|
4
4
|
|
|
5
5
|
const CreateProductRequestSchema = z.object({
|
|
@@ -30,6 +30,7 @@ const CreateProductRequestSchema = z.object({
|
|
|
30
30
|
vat: z.number().nullable(),
|
|
31
31
|
multiplicityDescription: z.string().nullable(),
|
|
32
32
|
salesUnit: z.nativeEnum(SalesUnitEnum).optional().nullable(),
|
|
33
|
+
marks: z.array(z.nativeEnum(ProductMarkEnum)).optional(),
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
const CreateProductResponseSchema = z.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SalesUnitEnum } from '../../enum';
|
|
2
|
+
import { ProductMarkEnum, SalesUnitEnum } from '../../enum';
|
|
3
3
|
import { ProductExtendedForAdminSchema } from '../../schemas';
|
|
4
4
|
|
|
5
5
|
const UpdateProductRequestSchema = z.object({
|
|
@@ -30,6 +30,7 @@ const UpdateProductRequestSchema = z.object({
|
|
|
30
30
|
vat: z.number().nullable(),
|
|
31
31
|
multiplicityDescription: z.string().nullable(),
|
|
32
32
|
salesUnit: z.nativeEnum(SalesUnitEnum).optional().nullable(),
|
|
33
|
+
marks: z.array(z.nativeEnum(ProductMarkEnum)).optional(),
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
const UpdateProductResponseSchema = z.object({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ProductMarkEnum } from '../../../enum';
|
|
2
3
|
import { ProductListExtendedForClientSchema } from '../../../schemas';
|
|
3
4
|
|
|
4
5
|
const GetProductListForClientRequestSchema = z.object({
|
|
@@ -16,6 +17,7 @@ const GetProductListForClientRequestSchema = z.object({
|
|
|
16
17
|
categoryUUID: z.string().optional(),
|
|
17
18
|
typeUUID: z.string().optional(),
|
|
18
19
|
searchQuery: z.string().optional(),
|
|
20
|
+
marks: z.nativeEnum(ProductMarkEnum).array().optional(),
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
const GetProductListForClientResponseSchema = z.object({
|
|
@@ -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';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CreateServiceRequestSchema, ServiceSchema } from '../../schemas/service/service.schema';
|
|
3
|
+
|
|
4
|
+
const CreateServiceResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: ServiceSchema,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export namespace CreateServiceContractCommand {
|
|
10
|
+
export const RequestSchema = CreateServiceRequestSchema;
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = CreateServiceResponseSchema;
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GetServiceListRequestSchema, ServiceSchema } from '../../schemas/service/service.schema';
|
|
3
|
+
|
|
4
|
+
const GetServiceListResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: z.object({
|
|
7
|
+
serviceList: ServiceSchema.array(),
|
|
8
|
+
total: z.number(),
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export namespace GetServiceListContractQuery {
|
|
13
|
+
export const RequestSchema = GetServiceListRequestSchema;
|
|
14
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = GetServiceListResponseSchema;
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServiceSchema, UpdateServiceRequestSchema } from '../../schemas/service/service.schema';
|
|
3
|
+
|
|
4
|
+
const UpdateServiceResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: ServiceSchema,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export namespace UpdateServiceContractCommand {
|
|
10
|
+
export const RequestSchema = UpdateServiceRequestSchema;
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = UpdateServiceResponseSchema;
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
package/constant/error.ts
CHANGED
|
@@ -58,6 +58,11 @@ export const ERRORS = {
|
|
|
58
58
|
PRODUCT_IMAGE_NOT_DELETED: { code: 'PI002', message: 'Failed to delete Product Image', httpCode: 500 },
|
|
59
59
|
PRODUCT_IMAGE_NOT_UPDATED: { code: 'PI003', message: 'Failed to update Product Image', httpCode: 500 },
|
|
60
60
|
PRODUCT_IMAGE_NAME_ALREADY_EXISTS: { code: 'PI004', message: 'Product Image name already exists', httpCode: 409 },
|
|
61
|
+
PRODUCT_IMAGE_ALREADY_EXISTS: {
|
|
62
|
+
code: 'PI014',
|
|
63
|
+
message: 'Product image with the same category, name, grower, country and color already exists',
|
|
64
|
+
httpCode: 409,
|
|
65
|
+
},
|
|
61
66
|
PRODUCT_IMAGE_NOT_FOUND: { code: 'PI005', message: 'Product Image with the specified UUID was not found', httpCode: 404 },
|
|
62
67
|
PRODUCT_IMAGE_FETCH_FAILED: { code: 'PI006', message: 'Error when retrieving a Product Image', httpCode: 500 },
|
|
63
68
|
PRODUCT_IMAGE_FILTERS_VALUES_FETCH_FAILED: {
|
|
@@ -394,6 +399,21 @@ export const ERRORS = {
|
|
|
394
399
|
httpCode: 400,
|
|
395
400
|
},
|
|
396
401
|
|
|
402
|
+
//SERVICE
|
|
403
|
+
SERVICE_NOT_CREATED: { code: 'SV001', message: 'Failed to create service', httpCode: 500 },
|
|
404
|
+
SERVICE_FETCH_FAILED: { code: 'SV002', message: 'Error when retrieving a service', httpCode: 500 },
|
|
405
|
+
SERVICE_NOT_FOUND: { code: 'SV003', message: 'Service not found', httpCode: 404 },
|
|
406
|
+
SERVICE_NOT_UPDATED: { code: 'SV004', message: 'Service not updated', httpCode: 500 },
|
|
407
|
+
SERVICE_NOT_ACTIVE: { code: 'SV005', message: 'Service is not active', httpCode: 409 },
|
|
408
|
+
|
|
409
|
+
//ORDER SERVICE LINE
|
|
410
|
+
ORDER_SERVICE_LINE_NOT_CREATED: { code: 'OSL001', message: 'Failed to add service to order', httpCode: 500 },
|
|
411
|
+
ORDER_SERVICE_LINE_FETCH_FAILED: { code: 'OSL002', message: 'Error when retrieving order services', httpCode: 500 },
|
|
412
|
+
ORDER_SERVICE_LINE_NOT_FOUND: { code: 'OSL003', message: 'Service in order not found', httpCode: 404 },
|
|
413
|
+
ORDER_SERVICE_LINE_NOT_DELETED: { code: 'OSL004', message: 'Service in order not deleted', httpCode: 500 },
|
|
414
|
+
ORDER_SERVICE_LINE_NOT_UPDATED: { code: 'OSL005', message: 'Service in order not updated', httpCode: 500 },
|
|
415
|
+
ORDER_SERVICE_LINE_MODIFY_NOT_ALLOWED: { code: 'OSL006', message: 'Modifying order services is not allowed', httpCode: 409 },
|
|
416
|
+
|
|
397
417
|
//ORDER DELIVERY
|
|
398
418
|
ORDER_DELIVERY_ALREADY_EXIST: { code: 'OD006', message: 'Delivery for the order already exists', httpCode: 409 },
|
|
399
419
|
ORDER_DELIVERY_NOT_CREATED: { code: 'OD007', message: 'Failed to create order delivery', httpCode: 500 },
|
package/enum/index.ts
CHANGED
|
@@ -46,11 +46,14 @@ export * from './write-off-status.enum';
|
|
|
46
46
|
export * from './position-report-type.enum';
|
|
47
47
|
export * from './discount-price-routing.enum';
|
|
48
48
|
export * from './sales-unit.enum';
|
|
49
|
+
export * from './product-mark.enum';
|
|
49
50
|
export * from './sales-by-position-group-by.enum';
|
|
50
51
|
export * from './client-import-entity-property.enum';
|
|
51
52
|
export * from './client-import-errors.enum';
|
|
52
53
|
export * from './transaction-import-entity-property.enum';
|
|
53
54
|
export * from './transaction-import-errors.enum';
|
|
55
|
+
export * from './service-pricing-unit.enum';
|
|
56
|
+
export * from './service-status.enum';
|
|
54
57
|
export * from './pre-order-collection-item-import-entity-property.enum';
|
|
55
58
|
export * from './pre-order-collection-item-import-errors.enum';
|
|
56
59
|
export * from './report-period-type.enum';
|
package/package.json
CHANGED
package/schemas/index.ts
CHANGED
|
@@ -44,6 +44,8 @@ export * from './employee-schedule/employee-schedule.schema';
|
|
|
44
44
|
export * from './work-session/work-session.schema';
|
|
45
45
|
export * from './discount-rules/discount-rules.schema';
|
|
46
46
|
export * from './package/validate-package.schema';
|
|
47
|
+
export * from './service/service.schema';
|
|
48
|
+
export * from './order-service-line/order-service-line.schema';
|
|
47
49
|
export * from './distribution/validate-distribution-by-product.schema';
|
|
48
50
|
export * from './consignment/consignment-distribution-validation.schema';
|
|
49
51
|
export * from './product-image-template/product-image-template.schema';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServicePricingUnitEnum } from '../../enum/service-pricing-unit.enum';
|
|
3
|
+
|
|
4
|
+
export const OrderServiceLineSchema = z.object({
|
|
5
|
+
uuid: z.uuid(),
|
|
6
|
+
orderUUID: z.uuid(),
|
|
7
|
+
serviceUUID: z.uuid().nullable(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
price: z.number(),
|
|
10
|
+
quantity: z.number(),
|
|
11
|
+
amount: z.number(),
|
|
12
|
+
vat: z.number().nullable(),
|
|
13
|
+
vatAmount: z.number(),
|
|
14
|
+
unit: z.nativeEnum(ServicePricingUnitEnum),
|
|
15
|
+
comment: z.string().nullable(),
|
|
16
|
+
createdAt: z.date(),
|
|
17
|
+
updatedAt: z.date(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const CreateOrderServiceLineRequestSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
orderUUID: z.uuid(),
|
|
23
|
+
serviceUUID: z.uuid().optional(),
|
|
24
|
+
name: z.string().min(1).max(255).optional(),
|
|
25
|
+
price: z.number().min(0).max(1_000_000_000).optional(),
|
|
26
|
+
quantity: z.number().int().min(1).max(1_000_000).optional().default(1),
|
|
27
|
+
vat: z.number().int().min(0).max(100).optional(),
|
|
28
|
+
comment: z.string().max(1000).optional(),
|
|
29
|
+
})
|
|
30
|
+
.refine(data => data.serviceUUID || (data.name && data.price !== undefined), {
|
|
31
|
+
message: 'Either serviceUUID or both name and price must be provided',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const UpdateOrderServiceLineRequestSchema = z.object({
|
|
35
|
+
price: z.number().min(0).max(1_000_000_000).optional(),
|
|
36
|
+
quantity: z.number().int().min(1).max(1_000_000).optional(),
|
|
37
|
+
comment: z.string().max(1000).nullable().optional(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const GetOrderServiceLineListRequestSchema = z.object({
|
|
41
|
+
orderUUID: z.uuid(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const CreateOrderServiceLineResponseSchema = z.object({
|
|
45
|
+
message: z.string().optional(),
|
|
46
|
+
data: OrderServiceLineSchema,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const UpdateOrderServiceLineResponseSchema = z.object({
|
|
50
|
+
message: z.string().optional(),
|
|
51
|
+
data: OrderServiceLineSchema,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const GetOrderServiceLineListResponseSchema = z.object({
|
|
55
|
+
message: z.string().optional(),
|
|
56
|
+
data: z.object({
|
|
57
|
+
serviceLineList: OrderServiceLineSchema.array(),
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const DeleteOrderServiceLineResponseSchema = z.object({
|
|
62
|
+
message: z.string().optional(),
|
|
63
|
+
data: z.object({
|
|
64
|
+
success: z.boolean(),
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
@@ -3,7 +3,7 @@ import { ProductImageSchema } from '../product-image/product-image.schema';
|
|
|
3
3
|
import { CategorySchema } from '../category/category.schema';
|
|
4
4
|
import { TypeSchema } from '../type/type.schema';
|
|
5
5
|
import { ConsignmentSchema } from '../consignment/consignment.schema';
|
|
6
|
-
import { DiscountRulesTypeEnum, SalesUnitEnum } from '../../enum';
|
|
6
|
+
import { DiscountRulesTypeEnum, ProductMarkEnum, SalesUnitEnum } from '../../enum';
|
|
7
7
|
import { discountRulesModeSchema } from '../discount-rules/discount-rules.schema';
|
|
8
8
|
import { ProductMultiplicityOptionSchema } from '../..';
|
|
9
9
|
|
|
@@ -37,6 +37,7 @@ export const ProductSchema = z.object({
|
|
|
37
37
|
vat: z.number().nullable(),
|
|
38
38
|
multiplicityDescription: z.string().nullable(),
|
|
39
39
|
salesUnit: z.nativeEnum(SalesUnitEnum).nullable(),
|
|
40
|
+
marks: z.array(z.nativeEnum(ProductMarkEnum)),
|
|
40
41
|
|
|
41
42
|
createdAt: z.date(),
|
|
42
43
|
updatedAt: z.date(),
|
|
@@ -68,6 +69,7 @@ export const ProductForClientSchema = z.object({
|
|
|
68
69
|
grower: z.string().nullable(),
|
|
69
70
|
multiplicityDescription: z.string().nullable(),
|
|
70
71
|
salesUnit: z.nativeEnum(SalesUnitEnum).nullable(),
|
|
72
|
+
marks: z.array(z.nativeEnum(ProductMarkEnum)),
|
|
71
73
|
});
|
|
72
74
|
|
|
73
75
|
export const ProductExtendedForClientSchema = ProductForClientSchema.merge(
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServicePricingUnitEnum } from '../../enum/service-pricing-unit.enum';
|
|
3
|
+
import { ServiceStatusEnum } from '../../enum/service-status.enum';
|
|
4
|
+
|
|
5
|
+
export const ServiceSchema = z.object({
|
|
6
|
+
uuid: z.uuid(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
price: z.number(),
|
|
9
|
+
vat: z.number().nullable(),
|
|
10
|
+
unit: z.nativeEnum(ServicePricingUnitEnum),
|
|
11
|
+
status: z.nativeEnum(ServiceStatusEnum),
|
|
12
|
+
createdAt: z.date(),
|
|
13
|
+
updatedAt: z.date(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const CreateServiceRequestSchema = z.object({
|
|
17
|
+
name: z.string().min(1).max(255),
|
|
18
|
+
price: z.number().min(0).max(1_000_000_000),
|
|
19
|
+
vat: z.number().int().min(0).max(100).nullable().optional(),
|
|
20
|
+
unit: z.nativeEnum(ServicePricingUnitEnum).optional().default(ServicePricingUnitEnum.FIXED),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const UpdateServiceRequestSchema = z.object({
|
|
24
|
+
name: z.string().min(1).max(255).optional(),
|
|
25
|
+
price: z.number().min(0).max(1_000_000_000).optional(),
|
|
26
|
+
vat: z.number().int().min(0).max(100).nullable().optional(),
|
|
27
|
+
unit: z.nativeEnum(ServicePricingUnitEnum).optional(),
|
|
28
|
+
status: z.nativeEnum(ServiceStatusEnum).optional(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const GetServiceListRequestSchema = z.object({
|
|
32
|
+
page: z.coerce.number().int().positive().optional().default(1),
|
|
33
|
+
count: z.coerce.number().int().positive().max(100).optional().default(10),
|
|
34
|
+
searchQuery: z.string().max(255).optional(),
|
|
35
|
+
statuses: z.array(z.nativeEnum(ServiceStatusEnum)).default([]),
|
|
36
|
+
});
|