@floristcloud/api-lib 1.2.166 → 1.2.168
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/category/create-category.command.js +3 -9
- package/build/commands/category/get-category-by-uuid.query.js +4 -11
- package/build/commands/category/get-category-list.query.js +3 -9
- package/build/commands/category/update-category-command.js +3 -9
- package/build/commands/integration/ozexport/get-ozexport-catalog-filters.query.js +10 -0
- package/build/commands/integration/ozexport/index.js +1 -0
- package/build/constant/discount-rules-pricing-type-list.constant.js +14 -0
- package/build/constant/error.js +11 -0
- package/build/constant/index.js +1 -0
- package/build/enum/discount-rules-mode-type.enum.js +2 -4
- package/build/enum/discount-rules-type.enum.js +1 -0
- package/build/schemas/category/category-create.schema.js +4 -0
- package/build/schemas/category/category-extended-with-box-settings.schema.js +8 -0
- package/build/schemas/category/category-extended.schema.js +8 -0
- package/build/schemas/category/category-list.schema.js +2 -2
- package/build/schemas/category/category-pieces-per-box-by-length.schema.js +9 -0
- package/build/schemas/category/category-pieces-per-box-overrides.schema.js +8 -0
- package/build/schemas/category/category-update.schema.js +4 -0
- package/build/schemas/category/category-with-box-settings.schema.js +11 -0
- package/build/schemas/category/category.schema.js +1 -5
- package/build/schemas/category/create-category-response.schema.js +9 -0
- package/build/schemas/category/get-category-by-uuid-request.schema.js +7 -0
- package/build/schemas/category/get-category-by-uuid-response.schema.js +9 -0
- package/build/schemas/category/get-category-list-response.schema.js +9 -0
- package/build/schemas/category/index.js +10 -0
- package/build/schemas/category/update-category-response.schema.js +9 -0
- package/build/schemas/discount-rules/discount-rules.schema.js +25 -11
- package/build/schemas/discount-rules/product-discount-price-data.schema.js +9 -0
- package/build/schemas/discount-rules/product-discount-price-multiplicity-option.schema.js +2 -0
- package/build/schemas/integration/ozexport/get-ozexport-catalog-filters-request.schema.js +5 -0
- package/build/schemas/integration/ozexport/get-ozexport-catalog-filters-response-data.schema.js +9 -0
- package/build/schemas/integration/ozexport/get-ozexport-catalog-filters-response.schema.js +8 -0
- package/build/schemas/integration/ozexport/get-ozexport-catalog-offers-request.schema.js +2 -0
- package/build/schemas/integration/ozexport/get-ozexport-catalog-request.schema.js +3 -0
- package/build/schemas/integration/ozexport/index.js +4 -0
- package/build/schemas/integration/ozexport/ozexport-catalog-category.schema.js +8 -0
- package/build/schemas/order-product/price-correction-analyze-item.schema.js +6 -0
- package/build/schemas/pre-order-collection-item/index.js +1 -0
- package/build/schemas/pre-order-collection-item/pre-order-collection-item-extended-for-admin.schema.js +2 -1
- package/build/schemas/pre-order-collection-item/pre-order-collection-item-extended-with-clients-pre-order-product.schema.js +2 -0
- package/build/schemas/pre-order-collection-item/pre-order-collection-item-for-admin.schema.js +2 -1
- package/build/schemas/pre-order-collection-item/supplier-add-analyze-item.schema.js +2 -0
- package/build/schemas/pre-order-collection-item/supplier-add-analyze-request.schema.js +1 -0
- package/build/schemas/pre-order-collection-item/supplier-add-cost-price.schema.js +6 -0
- package/build/schemas/pre-order-collection-item/supplier-add-execute-item.schema.js +2 -0
- package/build/schemas/pre-order-collection-item/supplier-add-execute-request.schema.js +1 -0
- package/build/schemas/product-image/product-image.schema.js +2 -2
- package/commands/category/create-category.command.ts +3 -10
- package/commands/category/get-category-by-uuid.query.ts +3 -11
- package/commands/category/get-category-list.query.ts +4 -11
- package/commands/category/update-category-command.ts +3 -10
- package/commands/integration/ozexport/get-ozexport-catalog-filters.query.ts +11 -0
- package/commands/integration/ozexport/index.ts +1 -0
- package/constant/discount-rules-pricing-type-list.constant.ts +12 -0
- package/constant/error.ts +11 -0
- package/constant/index.ts +1 -0
- package/enum/discount-rules-mode-type.enum.ts +2 -4
- package/enum/discount-rules-type.enum.ts +1 -0
- package/package.json +1 -1
- package/schemas/category/category-create.schema.ts +5 -0
- package/schemas/category/category-extended-with-box-settings.schema.ts +6 -0
- package/schemas/category/category-extended.schema.ts +6 -0
- package/schemas/category/category-list.schema.ts +2 -2
- package/schemas/category/category-pieces-per-box-by-length.schema.ts +8 -0
- package/schemas/category/category-pieces-per-box-overrides.schema.ts +6 -0
- package/schemas/category/category-update.schema.ts +5 -0
- package/schemas/category/category-with-box-settings.schema.ts +10 -0
- package/schemas/category/category.schema.ts +0 -5
- package/schemas/category/create-category-response.schema.ts +7 -0
- package/schemas/category/get-category-by-uuid-request.schema.ts +5 -0
- package/schemas/category/get-category-by-uuid-response.schema.ts +7 -0
- package/schemas/category/get-category-list-response.schema.ts +7 -0
- package/schemas/category/index.ts +10 -0
- package/schemas/category/update-category-response.schema.ts +7 -0
- package/schemas/discount-rules/discount-rules.schema.ts +28 -11
- package/schemas/discount-rules/product-discount-price-data.schema.ts +9 -0
- package/schemas/discount-rules/product-discount-price-multiplicity-option.schema.ts +2 -0
- package/schemas/integration/ozexport/get-ozexport-catalog-filters-request.schema.ts +3 -0
- package/schemas/integration/ozexport/get-ozexport-catalog-filters-response-data.schema.ts +7 -0
- package/schemas/integration/ozexport/get-ozexport-catalog-filters-response.schema.ts +6 -0
- package/schemas/integration/ozexport/get-ozexport-catalog-offers-request.schema.ts +2 -0
- package/schemas/integration/ozexport/get-ozexport-catalog-request.schema.ts +4 -0
- package/schemas/integration/ozexport/index.ts +4 -0
- package/schemas/integration/ozexport/ozexport-catalog-category.schema.ts +6 -0
- package/schemas/order-product/price-correction-analyze-item.schema.ts +7 -0
- package/schemas/pre-order-collection-item/index.ts +1 -0
- package/schemas/pre-order-collection-item/pre-order-collection-item-extended-for-admin.schema.ts +5 -3
- package/schemas/pre-order-collection-item/pre-order-collection-item-extended-with-clients-pre-order-product.schema.ts +2 -0
- package/schemas/pre-order-collection-item/pre-order-collection-item-for-admin.schema.ts +5 -1
- package/schemas/pre-order-collection-item/supplier-add-analyze-item.schema.ts +2 -0
- package/schemas/pre-order-collection-item/supplier-add-analyze-request.schema.ts +1 -0
- package/schemas/pre-order-collection-item/supplier-add-cost-price.schema.ts +4 -0
- package/schemas/pre-order-collection-item/supplier-add-execute-item.schema.ts +2 -0
- package/schemas/pre-order-collection-item/supplier-add-execute-request.schema.ts +1 -0
- package/schemas/product-image/product-image.schema.ts +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SupplierAddCostPriceSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Себестоимость передаётся точной десятичной строкой без округления до денежного масштаба.
|
|
6
|
+
exports.SupplierAddCostPriceSchema = zod_1.z.string().regex(/^\d+(\.\d+)?$/);
|
|
@@ -4,10 +4,12 @@ exports.SupplierAddExecuteItemSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const supplier_add_offer_key_schema_1 = require("./supplier-add-offer-key.schema");
|
|
6
6
|
const supplier_add_sale_price_schema_1 = require("./supplier-add-sale-price.schema");
|
|
7
|
+
const supplier_add_cost_price_schema_1 = require("./supplier-add-cost-price.schema");
|
|
7
8
|
// Кратность — Int колонки позиции (int4).
|
|
8
9
|
const MULTIPLICITY_MAX = 2147483647;
|
|
9
10
|
exports.SupplierAddExecuteItemSchema = supplier_add_offer_key_schema_1.SupplierAddOfferKeySchema.extend({
|
|
10
11
|
price: supplier_add_sale_price_schema_1.SupplierAddSalePriceSchema,
|
|
12
|
+
costPrice: supplier_add_cost_price_schema_1.SupplierAddCostPriceSchema.nullable().optional(),
|
|
11
13
|
multiplicity: zod_1.z.number().int().min(1).max(MULTIPLICITY_MAX).optional(),
|
|
12
14
|
isOpen: zod_1.z.boolean().optional(),
|
|
13
15
|
});
|
|
@@ -15,4 +15,5 @@ exports.SupplierAddExecuteRequestSchema = zod_1.z.object({
|
|
|
15
15
|
.refine(has_unique_supplier_add_keys_helper_1.hasUniqueSupplierAddKeys, { message: 'validation.supplierAdd.duplicateKeys' }),
|
|
16
16
|
// true — добавить и те предложения, которые в коллекции уже есть (ALREADY_IN_COLLECTION не пропускается).
|
|
17
17
|
allowDuplicates: zod_1.z.boolean().optional().default(false),
|
|
18
|
+
transferGrower: zod_1.z.boolean().optional().default(true),
|
|
18
19
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateProductImageSchema = exports.ProductImageExtendedSchema = exports.ProductImageSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const category_extended_schema_1 = require("../category/category-extended.schema");
|
|
6
6
|
const product_image_alias_schema_1 = require("./product-image-alias.schema");
|
|
7
7
|
exports.ProductImageSchema = zod_1.z.object({
|
|
8
8
|
uuid: zod_1.z.string(),
|
|
@@ -20,7 +20,7 @@ exports.ProductImageSchema = zod_1.z.object({
|
|
|
20
20
|
deletedAt: zod_1.z.date().nullable(),
|
|
21
21
|
});
|
|
22
22
|
exports.ProductImageExtendedSchema = exports.ProductImageSchema.extend({
|
|
23
|
-
category:
|
|
23
|
+
category: category_extended_schema_1.CategoryExtendedSchema.nullable(),
|
|
24
24
|
aliasList: zod_1.z.array(product_image_alias_schema_1.ProductImageAliasSchema).optional(),
|
|
25
25
|
});
|
|
26
26
|
exports.UpdateProductImageSchema = exports.ProductImageSchema.omit({
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CategorySchema } from '../../schemas';
|
|
1
|
+
import type { z } from 'zod';
|
|
3
2
|
import { CategoryCreateSchema } from '../../schemas/category/category-create.schema';
|
|
4
|
-
|
|
5
|
-
const CreateCategoryRequestSchema = CategoryCreateSchema;
|
|
6
|
-
|
|
7
|
-
const CreateCategoryResponseSchema = z.object({
|
|
8
|
-
message: z.string().optional(),
|
|
9
|
-
data: CategorySchema,
|
|
10
|
-
});
|
|
3
|
+
import { CreateCategoryResponseSchema } from '../../schemas/category/create-category-response.schema';
|
|
11
4
|
|
|
12
5
|
export namespace CreateCategoryContractCommand {
|
|
13
|
-
export const RequestSchema =
|
|
6
|
+
export const RequestSchema = CategoryCreateSchema;
|
|
14
7
|
export type Request = z.infer<typeof RequestSchema>;
|
|
15
8
|
|
|
16
9
|
export const ResponseSchema = CreateCategoryResponseSchema;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const GetCategoryByUUIDRequestSchema = z.object({
|
|
5
|
-
uuid: z.uuid(),
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const GetCategoryByUUIDResponseSchema = z.object({
|
|
9
|
-
message: z.string().optional(),
|
|
10
|
-
data: CategoryExtendedSchema,
|
|
11
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { GetCategoryByUUIDRequestSchema } from '../../schemas/category/get-category-by-uuid-request.schema';
|
|
3
|
+
import { GetCategoryByUUIDResponseSchema } from '../../schemas/category/get-category-by-uuid-response.schema';
|
|
12
4
|
|
|
13
5
|
export namespace GetCategoryByUUIDhContractQuery {
|
|
14
6
|
export const RequestSchema = GetCategoryByUUIDRequestSchema;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import type { z } from 'zod';
|
|
2
2
|
import { CategoryListFilterSchema } from '../../schemas/category/category-list-filter.schema';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const GetCategoryListRequestSchema = CategoryListFilterSchema;
|
|
6
|
-
|
|
7
|
-
const GetCategoryResponseSchema = z.object({
|
|
8
|
-
message: z.string().optional(),
|
|
9
|
-
data: CategoryListSchema,
|
|
10
|
-
});
|
|
3
|
+
import { GetCategoryListResponseSchema } from '../../schemas/category/get-category-list-response.schema';
|
|
11
4
|
|
|
12
5
|
export namespace GetCategoryListContractQuery {
|
|
13
|
-
export const RequestSchema =
|
|
6
|
+
export const RequestSchema = CategoryListFilterSchema;
|
|
14
7
|
export type Request = z.infer<typeof RequestSchema>;
|
|
15
8
|
|
|
16
|
-
export const ResponseSchema =
|
|
9
|
+
export const ResponseSchema = GetCategoryListResponseSchema;
|
|
17
10
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
11
|
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CategorySchema } from '../../schemas';
|
|
1
|
+
import type { z } from 'zod';
|
|
3
2
|
import { CategoryUpdateSchema } from '../../schemas/category/category-update.schema';
|
|
4
|
-
|
|
5
|
-
const UpdateCategoryRequestSchema = CategoryUpdateSchema;
|
|
6
|
-
|
|
7
|
-
const UpdateCategoryResponseSchema = z.object({
|
|
8
|
-
message: z.string().optional(),
|
|
9
|
-
data: CategorySchema.nullable(),
|
|
10
|
-
});
|
|
3
|
+
import { UpdateCategoryResponseSchema } from '../../schemas/category/update-category-response.schema';
|
|
11
4
|
|
|
12
5
|
export namespace UpdateCategoryContractCommand {
|
|
13
|
-
export const RequestSchema =
|
|
6
|
+
export const RequestSchema = CategoryUpdateSchema;
|
|
14
7
|
export type Request = z.infer<typeof RequestSchema>;
|
|
15
8
|
|
|
16
9
|
export const ResponseSchema = UpdateCategoryResponseSchema;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { GetOzexportCatalogFiltersRequestSchema } from '../../../schemas/integration/ozexport/get-ozexport-catalog-filters-request.schema';
|
|
3
|
+
import { GetOzexportCatalogFiltersResponseSchema } from '../../../schemas/integration/ozexport/get-ozexport-catalog-filters-response.schema';
|
|
4
|
+
|
|
5
|
+
export namespace GetOzexportCatalogFiltersContractQuery {
|
|
6
|
+
export const RequestSchema = GetOzexportCatalogFiltersRequestSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = GetOzexportCatalogFiltersResponseSchema;
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './connect-ozexport.command';
|
|
2
2
|
export * from './disconnect-ozexport.command';
|
|
3
3
|
export * from './get-ozexport-catalog.query';
|
|
4
|
+
export * from './get-ozexport-catalog-filters.query';
|
|
4
5
|
export * from './get-ozexport-status.query';
|
|
5
6
|
export * from './select-ozexport-unit.command';
|
|
6
7
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DiscountRulesTypeEnum } from '../enum/discount-rules-type.enum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Правила ценообразования: задают цену клиента целиком, а не уменьшают её.
|
|
5
|
+
*
|
|
6
|
+
* Цена от себестоимости или от прайса плюс наценка. Если у клиента есть такое правило, скидки к нему не
|
|
7
|
+
* применяются, и больше одного действующего правила ценообразования на клиента быть не может.
|
|
8
|
+
*/
|
|
9
|
+
export const DISCOUNT_RULES_PRICING_TYPE_LIST: DiscountRulesTypeEnum[] = [
|
|
10
|
+
DiscountRulesTypeEnum.COST_PLUS_MARKUP,
|
|
11
|
+
DiscountRulesTypeEnum.PRICE_PLUS_MARKUP,
|
|
12
|
+
];
|
package/constant/error.ts
CHANGED
|
@@ -1406,6 +1406,17 @@ export const ERRORS = {
|
|
|
1406
1406
|
message: 'Too many products for a single consignment discount operation',
|
|
1407
1407
|
httpCode: 400,
|
|
1408
1408
|
},
|
|
1409
|
+
DISCOUNT_RULES_PRICING_RULE_CONFLICT: {
|
|
1410
|
+
code: 'DR007',
|
|
1411
|
+
message: 'A client can have only one active pricing rule',
|
|
1412
|
+
httpCode: 409,
|
|
1413
|
+
},
|
|
1414
|
+
// Не дождались транзакционной блокировки правил ценообразования компании (lock_timeout).
|
|
1415
|
+
DISCOUNT_RULES_PRICING_RULE_LOCK_BUSY: {
|
|
1416
|
+
code: 'DR008',
|
|
1417
|
+
message: 'Pricing rules of this company are being changed right now, try again',
|
|
1418
|
+
httpCode: 409,
|
|
1419
|
+
},
|
|
1409
1420
|
DISCOUNT_RULES_NOT_FOUND: { code: 'DR010', message: 'Discount-rules not found', httpCode: 404 },
|
|
1410
1421
|
|
|
1411
1422
|
// ACTION LOG
|
package/constant/index.ts
CHANGED
|
@@ -15,3 +15,4 @@ export * from './product-image-merge.constant';
|
|
|
15
15
|
export * from './client-group-actions.constant';
|
|
16
16
|
export * from './standing-order-positions.constant';
|
|
17
17
|
export * from './order-external-number.constant';
|
|
18
|
+
export * from './discount-rules-pricing-type-list.constant';
|
|
@@ -4,10 +4,8 @@ export enum DiscountRulesModeTypeEnum {
|
|
|
4
4
|
/**
|
|
5
5
|
* Готовая цена, а не величина скидки.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* (`discountRulesModeSchema`) знает только FIXED и PERCENT, а схема выдачи
|
|
10
|
-
* (`discountPriceOutcomeSchema`) — все три.
|
|
7
|
+
* Больше не отдаётся: правило `COST_PLUS_MARKUP` стало правилом ценообразования и задаёт цену
|
|
8
|
+
* клиента, а не вариант скидки. Значение оставлено, чтобы не ломать клиентов, которые его разбирают.
|
|
11
9
|
*/
|
|
12
10
|
TARGET_PRICE = 'TARGET_PRICE',
|
|
13
11
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CategoryPiecesPerBoxOverridesSchema } from './category-pieces-per-box-overrides.schema';
|
|
2
3
|
import { LocalizedNameSchema } from '../i18n/localized-name.schema';
|
|
3
4
|
|
|
5
|
+
const INT4_MAX = 2147483647;
|
|
6
|
+
|
|
4
7
|
// Поля новой категории. Название на дополнительных языках необязательно: без переводов
|
|
5
8
|
// категория живёт на каноническом имени.
|
|
6
9
|
export const CategoryCreateSchema = z.object({
|
|
7
10
|
name: z.string(),
|
|
8
11
|
nameTranslations: LocalizedNameSchema.nullish(),
|
|
9
12
|
multiplicity: z.number(),
|
|
13
|
+
basePiecesPerBox: z.number().int().positive().max(INT4_MAX).nullable().optional(),
|
|
14
|
+
piecesPerBoxByLength: CategoryPiecesPerBoxOverridesSchema.optional(),
|
|
10
15
|
isSizeSeparate: z.coerce.boolean(),
|
|
11
16
|
typeUUID: z.string(),
|
|
12
17
|
isSaveCategoryName: z.coerce.boolean(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { CategoryExtendedWithBoxSettingsSchema } from './category-extended-with-box-settings.schema';
|
|
3
3
|
|
|
4
4
|
// Страница справочника категорий вместе с общим числом строк по фильтру.
|
|
5
5
|
export const CategoryListSchema = z.object({
|
|
6
|
-
categoryList:
|
|
6
|
+
categoryList: CategoryExtendedWithBoxSettingsSchema.array(),
|
|
7
7
|
total: z.number(),
|
|
8
8
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategoryPiecesPerBoxByLengthSchema } from './category-pieces-per-box-by-length.schema';
|
|
3
|
+
|
|
4
|
+
export const CategoryPiecesPerBoxOverridesSchema = z
|
|
5
|
+
.array(CategoryPiecesPerBoxByLengthSchema)
|
|
6
|
+
.refine(values => new Set(values.map(value => value.lengthCm)).size === values.length, { message: 'Each length must occur only once' });
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CategoryPiecesPerBoxOverridesSchema } from './category-pieces-per-box-overrides.schema';
|
|
2
3
|
import { CategoryStatusEnum } from '../../enum';
|
|
3
4
|
import { LocalizedNameSchema } from '../i18n/localized-name.schema';
|
|
4
5
|
|
|
6
|
+
const INT4_MAX = 2147483647;
|
|
7
|
+
|
|
5
8
|
// Поля редактируемой категории. Переводы отсутствуют в теле — остаются прежними;
|
|
6
9
|
// `null` и пустой объект их очищают.
|
|
7
10
|
export const CategoryUpdateSchema = z.object({
|
|
@@ -9,6 +12,8 @@ export const CategoryUpdateSchema = z.object({
|
|
|
9
12
|
nameTranslations: LocalizedNameSchema.nullish(),
|
|
10
13
|
typeUUID: z.string(),
|
|
11
14
|
multiplicity: z.number(),
|
|
15
|
+
basePiecesPerBox: z.number().int().positive().max(INT4_MAX).nullable().optional(),
|
|
16
|
+
piecesPerBoxByLength: CategoryPiecesPerBoxOverridesSchema.optional(),
|
|
12
17
|
isSizeSeparate: z.coerce.boolean(),
|
|
13
18
|
isSaveCategoryName: z.coerce.boolean(),
|
|
14
19
|
status: z.nativeEnum(CategoryStatusEnum),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategorySchema } from './category.schema';
|
|
3
|
+
import { CategoryPiecesPerBoxOverridesSchema } from './category-pieces-per-box-overrides.schema';
|
|
4
|
+
|
|
5
|
+
const INT4_MAX = 2147483647;
|
|
6
|
+
|
|
7
|
+
export const CategoryWithBoxSettingsSchema = CategorySchema.extend({
|
|
8
|
+
basePiecesPerBox: z.number().int().positive().max(INT4_MAX).nullable(),
|
|
9
|
+
piecesPerBoxByLength: CategoryPiecesPerBoxOverridesSchema,
|
|
10
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CategoryStatusEnum } from '../../enum/category-status.enum';
|
|
3
3
|
import { LocalizedNameSchema } from '../i18n/localized-name.schema';
|
|
4
|
-
import { TypeSchema } from '../type/type.schema';
|
|
5
4
|
|
|
6
5
|
export const CategorySchema = z.object({
|
|
7
6
|
uuid: z.uuid(),
|
|
@@ -17,7 +16,3 @@ export const CategorySchema = z.object({
|
|
|
17
16
|
updatedAt: z.date(),
|
|
18
17
|
deletedAt: z.date().nullable(),
|
|
19
18
|
});
|
|
20
|
-
|
|
21
|
-
export const CategoryExtendedSchema = CategorySchema.extend({
|
|
22
|
-
type: TypeSchema.nullable(),
|
|
23
|
-
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategoryExtendedWithBoxSettingsSchema } from './category-extended-with-box-settings.schema';
|
|
3
|
+
|
|
4
|
+
export const GetCategoryByUUIDResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: CategoryExtendedWithBoxSettingsSchema,
|
|
7
|
+
});
|
|
@@ -5,3 +5,13 @@ export * from './category-list-filter.schema';
|
|
|
5
5
|
export * from './category-list.schema';
|
|
6
6
|
export * from './category.schema';
|
|
7
7
|
export * from './category-name.schema';
|
|
8
|
+
export * from './category-pieces-per-box-by-length.schema';
|
|
9
|
+
export * from './category-pieces-per-box-overrides.schema';
|
|
10
|
+
export * from './category-extended.schema';
|
|
11
|
+
export * from './create-category-response.schema';
|
|
12
|
+
export * from './update-category-response.schema';
|
|
13
|
+
export * from './get-category-by-uuid-request.schema';
|
|
14
|
+
export * from './get-category-by-uuid-response.schema';
|
|
15
|
+
export * from './get-category-list-response.schema';
|
|
16
|
+
export * from './category-with-box-settings.schema';
|
|
17
|
+
export * from './category-extended-with-box-settings.schema';
|
|
@@ -23,10 +23,9 @@ export const discountRulesModeSchema = z.discriminatedUnion('typeDiscount', [dis
|
|
|
23
23
|
/**
|
|
24
24
|
* Итог применения правила к товару — то, что уезжает клиенту в `discountDataList`.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* создании правила нельзя, `discountRulesModeSchema` его не принимает.
|
|
26
|
+
* Ветка TARGET_PRICE больше не отдаётся: правило от себестоимости стало правилом ценообразования и
|
|
27
|
+
* задаёт цену клиента (`price`, `clientPrice`), а не вариант скидки. Ветка оставлена, чтобы не ломать
|
|
28
|
+
* клиентов, которые её разбирают.
|
|
30
29
|
*/
|
|
31
30
|
export const discountPriceOutcomeSchema = z.discriminatedUnion('typeDiscount', [
|
|
32
31
|
discountPercentModeSchema,
|
|
@@ -68,19 +67,33 @@ const DiscountRulesItemDiscountDataSchema = discountRulesModeSchema;
|
|
|
68
67
|
const DiscountRulesDiscountProhibitedDataSchema = z.object({}).default({});
|
|
69
68
|
|
|
70
69
|
/**
|
|
71
|
-
* Наценка
|
|
70
|
+
* Наценка правила ценообразования: процент или сумма на единицу.
|
|
72
71
|
*
|
|
73
|
-
*
|
|
74
|
-
* — только вверх, знака у величины
|
|
75
|
-
* — ноль допустим (
|
|
76
|
-
* `NonNegativeMoneySchema`, а не `PositiveMoneySchema`;
|
|
72
|
+
* Отличия от режима скидки намеренные:
|
|
73
|
+
* — только вверх, знака у величины нет;
|
|
74
|
+
* — ноль допустим (цена ровно равна источнику), поэтому FIXED берёт `NonNegativeMoneySchema`;
|
|
77
75
|
* — у процента нет верхней границы: наценка в 150 % законна, в отличие от скидки в 150 %.
|
|
78
76
|
*/
|
|
77
|
+
const pricingMarkupPercentSchema = z.object({ typeMarkup: z.literal(DiscountRulesModeTypeEnum.PERCENT), markupValue: z.number().min(0) });
|
|
78
|
+
const pricingMarkupFixedSchema = z.object({ typeMarkup: z.literal(DiscountRulesModeTypeEnum.FIXED), markupValue: NonNegativeMoneySchema });
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Потолок «не выше прайса» есть только у цены от себестоимости: цена от прайса с наценкой выше
|
|
82
|
+
* прайса по определению. Поле необязательное, и отсутствие значит разное: при создании — потолка
|
|
83
|
+
* нет, при правке — оставить как было. Так старая панель, которая флага не знает, не снимает потолок
|
|
84
|
+
* у правил, которым его проставила миграция.
|
|
85
|
+
*/
|
|
86
|
+
const costPlusCapShape = { isCappedByPrice: z.boolean().optional() };
|
|
87
|
+
|
|
88
|
+
/** Цена клиента = себестоимость + наценка. */
|
|
79
89
|
const DiscountRulesCostPlusMarkupDataSchema = z.discriminatedUnion('typeMarkup', [
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
pricingMarkupPercentSchema.extend(costPlusCapShape),
|
|
91
|
+
pricingMarkupFixedSchema.extend(costPlusCapShape),
|
|
82
92
|
]);
|
|
83
93
|
|
|
94
|
+
/** Цена клиента = цена позиции (фасовки, если она выбрана) + наценка. */
|
|
95
|
+
const DiscountRulesPricePlusMarkupDataSchema = z.discriminatedUnion('typeMarkup', [pricingMarkupPercentSchema, pricingMarkupFixedSchema]);
|
|
96
|
+
|
|
84
97
|
export const DiscountRulesTypeSchema = z.discriminatedUnion('type', [
|
|
85
98
|
z.object({
|
|
86
99
|
type: z.literal(DiscountRulesTypeEnum.PERSONAL_DISCOUNT),
|
|
@@ -106,6 +119,10 @@ export const DiscountRulesTypeSchema = z.discriminatedUnion('type', [
|
|
|
106
119
|
type: z.literal(DiscountRulesTypeEnum.COST_PLUS_MARKUP),
|
|
107
120
|
data: DiscountRulesCostPlusMarkupDataSchema,
|
|
108
121
|
}),
|
|
122
|
+
z.object({
|
|
123
|
+
type: z.literal(DiscountRulesTypeEnum.PRICE_PLUS_MARKUP),
|
|
124
|
+
data: DiscountRulesPricePlusMarkupDataSchema,
|
|
125
|
+
}),
|
|
109
126
|
]);
|
|
110
127
|
|
|
111
128
|
export const DiscountRulesBaseSchema = z.object({
|
|
@@ -3,9 +3,18 @@ import { MoneySchema } from '../money.schema';
|
|
|
3
3
|
import { ProductDiscountPriceItemSchema } from './product-discount-price-item.schema';
|
|
4
4
|
import { ProductDiscountPriceMultiplicityOptionSchema } from './product-discount-price-multiplicity-option.schema';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Две базы рядом, и это намеренно. `price` / `optionPrice` — прайс, одинаковый для всех.
|
|
8
|
+
* `clientPrice` / `clientOptionPrice` — цена этого клиента до скидок: у клиента с правилом
|
|
9
|
+
* ценообразования (от себестоимости или от прайса с наценкой) это цена по правилу, у остальных — тот
|
|
10
|
+
* же прайс. Скидки считаются от прайса и только у клиентов без правила ценообразования: у клиента с
|
|
11
|
+
* таким правилом скидок нет, списки вариантов пусты. Цену позиции без скидки берите из `clientPrice`,
|
|
12
|
+
* а не из `price`: иначе цена по правилу потеряется.
|
|
13
|
+
*/
|
|
6
14
|
export const ProductDiscountPriceDataSchema = z.object({
|
|
7
15
|
productUUID: z.string(),
|
|
8
16
|
price: MoneySchema,
|
|
17
|
+
clientPrice: MoneySchema,
|
|
9
18
|
priceWithBestDiscount: MoneySchema.nullable(),
|
|
10
19
|
multiplicityOptions: ProductDiscountPriceMultiplicityOptionSchema.array(),
|
|
11
20
|
/**
|
|
@@ -5,6 +5,8 @@ import { ProductDiscountPriceItemSchema } from './product-discount-price-item.sc
|
|
|
5
5
|
export const ProductDiscountPriceMultiplicityOptionSchema = z.object({
|
|
6
6
|
uuid: z.string(),
|
|
7
7
|
optionPrice: MoneySchema.nullable(),
|
|
8
|
+
/** `null` ровно тогда, когда `null` у `optionPrice`: своей цены у фасовки нет, база — `clientPrice`. */
|
|
9
|
+
clientOptionPrice: MoneySchema.nullable(),
|
|
8
10
|
optionPriceWithDiscount: MoneySchema.nullable(),
|
|
9
11
|
isDiscountApplicable: z.boolean(),
|
|
10
12
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OzexportCatalogCategorySchema } from './ozexport-catalog-category.schema';
|
|
3
|
+
|
|
4
|
+
export const GetOzexportCatalogFiltersResponseDataSchema = z.object({
|
|
5
|
+
categories: z.array(OzexportCatalogCategorySchema),
|
|
6
|
+
lengths: z.array(z.number().int().positive()),
|
|
7
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GetOzexportCatalogFiltersResponseDataSchema } from './get-ozexport-catalog-filters-response-data.schema';
|
|
3
|
+
|
|
4
|
+
export const GetOzexportCatalogFiltersResponseSchema = z.object({
|
|
5
|
+
data: GetOzexportCatalogFiltersResponseDataSchema,
|
|
6
|
+
});
|
|
@@ -6,6 +6,8 @@ const OZEXPORT_CATALOG_SEARCH_MAX_LENGTH = 100;
|
|
|
6
6
|
|
|
7
7
|
const OZEXPORT_CATALOG_FILTER_MAX_LENGTH = 100;
|
|
8
8
|
|
|
9
|
+
const OZEXPORT_CATALOG_LENGTH_CM_MAX = 2147483647;
|
|
10
|
+
|
|
9
11
|
// qs отдаёт одиночное значение строкой (`status=AVAILABLE`), а повторённое — массивом.
|
|
10
12
|
const toArray = (value: unknown): unknown => (typeof value === 'string' ? [value] : value);
|
|
11
13
|
|
|
@@ -19,6 +21,8 @@ const OZEXPORT_CATALOG_PAGE_SIZE_DEFAULT = 20;
|
|
|
19
21
|
export const GetOzexportCatalogRequestSchema = z.object({
|
|
20
22
|
search: z.string().trim().max(OZEXPORT_CATALOG_SEARCH_MAX_LENGTH).optional(),
|
|
21
23
|
color: z.string().trim().max(OZEXPORT_CATALOG_FILTER_MAX_LENGTH).optional(),
|
|
24
|
+
categoryTemplateUUID: z.string().uuid().optional(),
|
|
25
|
+
lengthCm: z.coerce.number().int().positive().max(OZEXPORT_CATALOG_LENGTH_CM_MAX).optional(),
|
|
22
26
|
stockType: z.string().trim().max(OZEXPORT_CATALOG_FILTER_MAX_LENGTH).optional(),
|
|
23
27
|
inNomenclature: z.nativeEnum(SupplierCatalogNomenclatureFilterEnum).optional().default(SupplierCatalogNomenclatureFilterEnum.ALL),
|
|
24
28
|
// Без фильтра сервер отдаёт живые предложения (AVAILABLE, NO_PRICE и OUT_OF_STOCK); NOT_FOUND запрашивается явно.
|
|
@@ -2,6 +2,10 @@ export * from './connect-ozexport-request.schema';
|
|
|
2
2
|
export * from './disconnect-ozexport-response-true.schema';
|
|
3
3
|
export * from './disconnect-ozexport-response.schema';
|
|
4
4
|
export * from './get-ozexport-catalog-request.schema';
|
|
5
|
+
export * from './get-ozexport-catalog-filters-request.schema';
|
|
6
|
+
export * from './get-ozexport-catalog-filters-response.schema';
|
|
7
|
+
export * from './get-ozexport-catalog-filters-response-data.schema';
|
|
8
|
+
export * from './ozexport-catalog-category.schema';
|
|
5
9
|
export * from './get-ozexport-catalog-response-data.schema';
|
|
6
10
|
export * from './get-ozexport-catalog-response.schema';
|
|
7
11
|
export * from './ozexport-account-unit.schema';
|
|
@@ -37,6 +37,13 @@ export const PriceCorrectionAnalyzeItemSchema = z.object({
|
|
|
37
37
|
priceDifferenceWithoutDiscount: MoneySchema,
|
|
38
38
|
priceDifferenceWithDiscount: MoneySchema,
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* У клиента действует правило ценообразования (от себестоимости или от прайса с наценкой).
|
|
42
|
+
* Его цена — `newPriceWithDiscount`; «без скидок» для него означает прайс, то есть снятие наценки.
|
|
43
|
+
* Сотруднику стоит показать это до применения.
|
|
44
|
+
*/
|
|
45
|
+
hasPricingRule: z.boolean(),
|
|
46
|
+
|
|
40
47
|
isSkipped: z.boolean(),
|
|
41
48
|
skipReason: ErrorMessageSchema.optional(),
|
|
42
49
|
});
|
|
@@ -52,6 +52,7 @@ export * from './supplier-add-execute-skipped-item.schema';
|
|
|
52
52
|
export * from './supplier-add-items-limit.constant';
|
|
53
53
|
export * from './supplier-add-offer-key.schema';
|
|
54
54
|
export * from './supplier-add-sale-price.schema';
|
|
55
|
+
export * from './supplier-add-cost-price.schema';
|
|
55
56
|
export * from './supplier-sync-analyze-item.schema';
|
|
56
57
|
export * from './supplier-sync-analyze-request.schema';
|
|
57
58
|
export * from './supplier-sync-analyze-response-data.schema';
|
package/schemas/pre-order-collection-item/pre-order-collection-item-extended-for-admin.schema.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PreOrderCollectionItemExtendedSchema } from './pre-order-collection-item-extended.schema';
|
|
2
2
|
import { PreOrderCollectionItemSupplierAdminShape } from './pre-order-collection-item-supplier-admin.shape';
|
|
3
|
+
import { SupplierAddCostPriceSchema } from './supplier-add-cost-price.schema';
|
|
3
4
|
|
|
4
|
-
export const PreOrderCollectionItemExtendedForAdminSchema = PreOrderCollectionItemExtendedSchema.extend(
|
|
5
|
-
PreOrderCollectionItemSupplierAdminShape,
|
|
6
|
-
)
|
|
5
|
+
export const PreOrderCollectionItemExtendedForAdminSchema = PreOrderCollectionItemExtendedSchema.extend({
|
|
6
|
+
...PreOrderCollectionItemSupplierAdminShape,
|
|
7
|
+
costPrice: SupplierAddCostPriceSchema.nullable(),
|
|
8
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PreOrderCollectionItemClientPreOrderProductSchema } from './pre-order-collection-item-client-pre-order-product.schema';
|
|
3
3
|
import { PreOrderCollectionItemExtendedSchema } from './pre-order-collection-item-extended.schema';
|
|
4
|
+
import { SupplierAddCostPriceSchema } from './supplier-add-cost-price.schema';
|
|
4
5
|
|
|
5
6
|
export const PreOrderCollectionItemExtendedWithClientsPreOrderProductSchema = PreOrderCollectionItemExtendedSchema.extend({
|
|
7
|
+
costPrice: SupplierAddCostPriceSchema.nullable(),
|
|
6
8
|
clientsWithPreOrderProduct: z.array(PreOrderCollectionItemClientPreOrderProductSchema),
|
|
7
9
|
});
|