@floristcloud/api-lib 1.2.111 → 1.2.112

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.
@@ -4,7 +4,8 @@ exports.CreateWriteOffFromOrderForClientContractCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const schemas_1 = require("../../../schemas");
6
6
  const CreateWriteOffFromOrderForClientRequestSchema = zod_1.z.object({
7
- quantity: zod_1.z.coerce.number(),
7
+ // Колонка `WriteOff.quantity` — Int: дробное значение доходило до Prisma и падало общей ошибкой.
8
+ quantity: zod_1.z.coerce.number().int().positive(),
8
9
  comment: zod_1.z.string().nullable(),
9
10
  productUUID: zod_1.z.string(),
10
11
  orderProductUUID: zod_1.z.string(),
@@ -355,6 +355,14 @@ exports.ERRORS = {
355
355
  },
356
356
  WRITE_OFF_IMAGE_FETCH_FAILED: { code: 'W013', message: 'Error when retrieving a write-off-image', httpCode: 500 },
357
357
  WRITE_OFF_ARCHIVE_TOTAL_SIZE_EXCEEDED: { code: 'W014', message: 'Total size of write-off archive exceeded', httpCode: 500 },
358
+ WRITE_OFF_ORDER_NOT_COMPLETED: { code: 'W015', message: 'Write-off is allowed only for a completed order', httpCode: 400 },
359
+ WRITE_OFF_ACCEPTANCE_DISABLED: { code: 'W016', message: 'Write-off acceptance from clients is disabled', httpCode: 400 },
360
+ WRITE_OFF_TIME_EXPIRED: { code: 'W017', message: 'Time allowed for creating a write-off has expired', httpCode: 400 },
361
+ WRITE_OFF_ALREADY_EXISTS: {
362
+ code: 'W018',
363
+ message: 'An active write-off for this order product already exists',
364
+ httpCode: 409,
365
+ },
358
366
  //ORDER
359
367
  ORDER_NOT_CREATED: { code: 'O001', message: 'Failed to create order', httpCode: 500 },
360
368
  ORDER_FETCH_FAILED: { code: 'O002', message: 'Error when retrieving a order', httpCode: 500 },
@@ -2,7 +2,8 @@ import { z } from 'zod';
2
2
  import { WriteOffSchema } from '../../../schemas';
3
3
 
4
4
  const CreateWriteOffFromOrderForClientRequestSchema = z.object({
5
- quantity: z.coerce.number(),
5
+ // Колонка `WriteOff.quantity` — Int: дробное значение доходило до Prisma и падало общей ошибкой.
6
+ quantity: z.coerce.number().int().positive(),
6
7
  comment: z.string().nullable(),
7
8
  productUUID: z.string(),
8
9
  orderProductUUID: z.string(),
package/constant/error.ts CHANGED
@@ -368,6 +368,14 @@ export const ERRORS = {
368
368
  },
369
369
  WRITE_OFF_IMAGE_FETCH_FAILED: { code: 'W013', message: 'Error when retrieving a write-off-image', httpCode: 500 },
370
370
  WRITE_OFF_ARCHIVE_TOTAL_SIZE_EXCEEDED: { code: 'W014', message: 'Total size of write-off archive exceeded', httpCode: 500 },
371
+ WRITE_OFF_ORDER_NOT_COMPLETED: { code: 'W015', message: 'Write-off is allowed only for a completed order', httpCode: 400 },
372
+ WRITE_OFF_ACCEPTANCE_DISABLED: { code: 'W016', message: 'Write-off acceptance from clients is disabled', httpCode: 400 },
373
+ WRITE_OFF_TIME_EXPIRED: { code: 'W017', message: 'Time allowed for creating a write-off has expired', httpCode: 400 },
374
+ WRITE_OFF_ALREADY_EXISTS: {
375
+ code: 'W018',
376
+ message: 'An active write-off for this order product already exists',
377
+ httpCode: 409,
378
+ },
371
379
 
372
380
  //ORDER
373
381
  ORDER_NOT_CREATED: { code: 'O001', message: 'Failed to create order', httpCode: 500 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.111",
3
+ "version": "1.2.112",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {