@merkaly/api 0.6.11 → 0.7.1
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/dist/app.schemas.d.ts +3 -14
- package/dist/finance/payment/payment.transition.js +3 -3
- package/dist/index.d.ts +2 -12
- package/dist/index.js +2 -12
- package/dist/inventory/catalog/product/product.entity.d.ts +7 -23
- package/dist/inventory/catalog/product/request.validator.d.ts +16 -28
- package/dist/inventory/catalog/product/request.validator.js +48 -106
- package/dist/inventory/catalog/variant/index.d.ts +0 -2
- package/dist/inventory/catalog/variant/request.validator.d.ts +6 -13
- package/dist/inventory/catalog/variant/request.validator.js +26 -71
- package/dist/inventory/catalog/variant/variant.entity.d.ts +4 -17
- package/dist/order/purchase/item/item.entity.d.ts +0 -5
- package/dist/order/purchase/item/request.validator.d.ts +1 -1
- package/dist/order/purchase/item/request.validator.js +6 -6
- package/dist/order/purchase/transaction/request.validator.d.ts +0 -1
- package/dist/order/purchase/transaction/request.validator.js +0 -7
- package/dist/order/purchase/transaction/transaction.transition.js +3 -3
- package/dist/order/sale/item/item.entity.d.ts +0 -5
- package/dist/order/sale/item/request.validator.d.ts +1 -1
- package/dist/order/sale/item/request.validator.js +6 -6
- package/dist/order/sale/transaction/request.validator.d.ts +0 -1
- package/dist/order/sale/transaction/request.validator.js +0 -7
- package/dist/order/sale/transaction/transaction.transition.js +4 -4
- package/dist/{account/payment → supplier/product}/index.d.ts +1 -1
- package/dist/supplier/product/product.preview.d.ts +23 -0
- package/dist/supplier/product/request.validator.d.ts +4 -0
- package/dist/supplier/product/request.validator.js +20 -0
- package/dist/supplier/source/index.d.ts +2 -0
- package/dist/supplier/source/index.js +1 -0
- package/dist/supplier/source/provider.enum.d.ts +3 -0
- package/dist/supplier/source/provider.enum.js +4 -0
- package/dist/supplier/source/source.entity.d.ts +5 -0
- package/dist/transaction.entity.d.ts +6 -4
- package/package.json +5 -5
- package/dist/account/address/address.entity.d.ts +0 -7
- package/dist/account/address/index.d.ts +0 -2
- package/dist/account/address/request.validator.d.ts +0 -16
- package/dist/account/address/request.validator.js +0 -79
- package/dist/account/payment/index.js +0 -1
- package/dist/account/payment/payment.entity.d.ts +0 -12
- package/dist/account/payment/request.validator.d.ts +0 -19
- package/dist/account/payment/request.validator.js +0 -95
- package/dist/finance/invoice/index.d.ts +0 -3
- package/dist/finance/invoice/index.js +0 -2
- package/dist/finance/invoice/invoice.entity.d.ts +0 -14
- package/dist/finance/invoice/invoice.enum.d.ts +0 -14
- package/dist/finance/invoice/invoice.enum.js +0 -16
- package/dist/finance/invoice/request.validator.d.ts +0 -21
- package/dist/finance/invoice/request.validator.js +0 -103
- package/dist/finance/refund/index.d.ts +0 -4
- package/dist/finance/refund/index.js +0 -3
- package/dist/finance/refund/refund.entity.d.ts +0 -14
- package/dist/finance/refund/refund.enum.d.ts +0 -16
- package/dist/finance/refund/refund.enum.js +0 -18
- package/dist/finance/refund/refund.transition.d.ts +0 -8
- package/dist/finance/refund/refund.transition.js +0 -17
- package/dist/finance/refund/request.validator.d.ts +0 -16
- package/dist/finance/refund/request.validator.js +0 -69
- package/dist/inventory/catalog/attribute/attribute.entity.d.ts +0 -6
- package/dist/inventory/catalog/attribute/index.d.ts +0 -2
- package/dist/inventory/catalog/attribute/index.js +0 -1
- package/dist/inventory/catalog/attribute/request.validator.d.ts +0 -11
- package/dist/inventory/catalog/attribute/request.validator.js +0 -53
- package/dist/inventory/catalog/collection/collection.entity.d.ts +0 -7
- package/dist/inventory/catalog/collection/index.d.ts +0 -2
- package/dist/inventory/catalog/collection/index.js +0 -1
- package/dist/inventory/catalog/collection/request.validator.d.ts +0 -11
- package/dist/inventory/catalog/collection/request.validator.js +0 -50
- package/dist/inventory/catalog/variant/variant.identifier.entity.d.ts +0 -4
- package/dist/inventory/catalog/variant/variant.policy.entity.d.ts +0 -4
- package/dist/inventory/configuration/measurement/index.d.ts +0 -2
- package/dist/inventory/configuration/measurement/index.js +0 -1
- package/dist/inventory/configuration/measurement/measurement.entity.d.ts +0 -8
- package/dist/inventory/configuration/measurement/request.validator.d.ts +0 -21
- package/dist/inventory/configuration/measurement/request.validator.js +0 -106
- package/dist/inventory/configuration/unit/index.d.ts +0 -1
- package/dist/inventory/configuration/unit/index.js +0 -1
- package/dist/inventory/configuration/unit/unit.entity.d.ts +0 -8
- package/dist/inventory/stock/balance/balance.entity.d.ts +0 -15
- package/dist/inventory/stock/balance/balance.status.enum.d.ts +0 -6
- package/dist/inventory/stock/balance/balance.status.enum.js +0 -7
- package/dist/inventory/stock/balance/index.d.ts +0 -2
- package/dist/inventory/stock/balance/index.js +0 -1
- package/dist/inventory/stock/transfer/index.d.ts +0 -5
- package/dist/inventory/stock/transfer/index.js +0 -3
- package/dist/inventory/stock/transfer/request.validator.d.ts +0 -24
- package/dist/inventory/stock/transfer/request.validator.js +0 -112
- package/dist/inventory/stock/transfer/transfer.entity.d.ts +0 -25
- package/dist/inventory/stock/transfer/transfer.enum.d.ts +0 -5
- package/dist/inventory/stock/transfer/transfer.enum.js +0 -6
- package/dist/inventory/stock/transfer/transfer.item.entity.d.ts +0 -22
- package/dist/inventory/stock/transfer/transfer.transition.d.ts +0 -8
- package/dist/inventory/stock/transfer/transfer.transition.js +0 -18
- package/dist/inventory/stock/warehouse/index.d.ts +0 -2
- package/dist/inventory/stock/warehouse/index.js +0 -1
- package/dist/inventory/stock/warehouse/request.validator.d.ts +0 -14
- package/dist/inventory/stock/warehouse/request.validator.js +0 -82
- package/dist/inventory/stock/warehouse/warehouse.entity.d.ts +0 -10
- package/dist/order/type/index.d.ts +0 -1
- package/dist/order/type/index.js +0 -1
- package/dist/order/type/order.enum.d.ts +0 -4
- package/dist/order/type/order.enum.js +0 -5
- /package/dist/{account/address → supplier/product}/index.js +0 -0
package/dist/app.schemas.d.ts
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
export declare abstract class AppSchemas {
|
|
2
2
|
static get account(): {
|
|
3
|
-
addresses: string;
|
|
4
|
-
payments: string;
|
|
5
3
|
users: string;
|
|
6
4
|
};
|
|
7
5
|
static get assets(): {
|
|
8
6
|
files: string;
|
|
9
7
|
};
|
|
10
8
|
static get finance(): {
|
|
11
|
-
invoices: string;
|
|
12
9
|
payments: string;
|
|
13
|
-
refunds: string;
|
|
14
10
|
subscriptions: string;
|
|
15
11
|
taxes: string;
|
|
16
12
|
};
|
|
17
13
|
static get inventory(): {
|
|
18
14
|
catalog: {
|
|
19
|
-
attributes: string;
|
|
20
15
|
brands: string;
|
|
21
16
|
categories: string;
|
|
22
|
-
collections: string;
|
|
23
17
|
products: string;
|
|
24
18
|
variants: string;
|
|
25
19
|
};
|
|
26
|
-
configuration: {
|
|
27
|
-
measurements: string;
|
|
28
|
-
};
|
|
29
|
-
stock: {
|
|
30
|
-
balances: string;
|
|
31
|
-
transfers: string;
|
|
32
|
-
warehouses: string;
|
|
33
|
-
};
|
|
34
20
|
};
|
|
35
21
|
static get order(): {
|
|
36
22
|
purchase: {
|
|
@@ -48,6 +34,9 @@ export declare abstract class AppSchemas {
|
|
|
48
34
|
transactions: string;
|
|
49
35
|
};
|
|
50
36
|
};
|
|
37
|
+
static get supplier(): {
|
|
38
|
+
sources: string;
|
|
39
|
+
};
|
|
51
40
|
static get settings(): {
|
|
52
41
|
organizations: string;
|
|
53
42
|
};
|
|
@@ -3,8 +3,8 @@ import * as payment_enum_1 from './payment.enum.js';
|
|
|
3
3
|
|
|
4
4
|
export class FinancePaymentTransition extends AbstractTransition {
|
|
5
5
|
$states = {
|
|
6
|
-
[payment_enum_1.FinancePaymentStatusEnum.PENDING]: [payment_enum_1.FinancePaymentStatusEnum.
|
|
7
|
-
[payment_enum_1.FinancePaymentStatusEnum.PAID]: [
|
|
6
|
+
[payment_enum_1.FinancePaymentStatusEnum.PENDING]: [payment_enum_1.FinancePaymentStatusEnum.CANCELLED],
|
|
7
|
+
[payment_enum_1.FinancePaymentStatusEnum.PAID]: [],
|
|
8
8
|
[payment_enum_1.FinancePaymentStatusEnum.CANCELLED]: [],
|
|
9
9
|
[payment_enum_1.FinancePaymentStatusEnum.REFUNDED]: [],
|
|
10
10
|
};
|
|
@@ -14,6 +14,6 @@ export class FinancePaymentTransition extends AbstractTransition {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
get initialStates() {
|
|
17
|
-
return [payment_enum_1.FinancePaymentStatusEnum.PENDING
|
|
17
|
+
return [payment_enum_1.FinancePaymentStatusEnum.PENDING];
|
|
18
18
|
}
|
|
19
19
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,30 +10,20 @@ export * from './abstract.entity';
|
|
|
10
10
|
export * from './abstract.transition';
|
|
11
11
|
export * from './abstract.validator';
|
|
12
12
|
export * from './relation.status.enum';
|
|
13
|
-
export * from './account/address';
|
|
14
|
-
export * from './account/payment';
|
|
15
13
|
export * from './account/user';
|
|
16
14
|
export * from './assets/asset';
|
|
17
|
-
export * from './finance/invoice';
|
|
18
15
|
export * from './finance/payment';
|
|
19
|
-
export * from './finance/refund';
|
|
20
|
-
export * from './inventory/catalog/attribute';
|
|
21
16
|
export * from './inventory/catalog/brand';
|
|
22
17
|
export * from './inventory/catalog/category';
|
|
23
|
-
export * from './inventory/catalog/collection';
|
|
24
18
|
export * from './inventory/catalog/product';
|
|
25
19
|
export * from './inventory/catalog/variant';
|
|
26
|
-
export * from './inventory/configuration/measurement';
|
|
27
|
-
export * from './inventory/configuration/unit';
|
|
28
|
-
export * from './inventory/stock/balance';
|
|
29
|
-
export * from './inventory/stock/transfer';
|
|
30
|
-
export * from './inventory/stock/warehouse';
|
|
31
20
|
export * from './order/purchase/item';
|
|
32
21
|
export * from './order/purchase/transaction';
|
|
33
22
|
export * from './order/purchase/vendor';
|
|
34
23
|
export * from './order/sale/customer';
|
|
35
24
|
export * from './order/sale/item';
|
|
36
25
|
export * from './order/sale/transaction';
|
|
37
|
-
export * from './order/type';
|
|
38
26
|
export * from './settings/organization';
|
|
27
|
+
export * from './supplier/product';
|
|
28
|
+
export * from './supplier/source';
|
|
39
29
|
export type { SaveEntityArgs } from './repository.types';
|
package/dist/index.js
CHANGED
|
@@ -3,29 +3,19 @@ export * from './address.validator.js';
|
|
|
3
3
|
export * from './abstract.transition.js';
|
|
4
4
|
export * from './abstract.validator.js';
|
|
5
5
|
export * from './relation.status.enum.js';
|
|
6
|
-
export * from './account/address/index.js';
|
|
7
|
-
export * from './account/payment/index.js';
|
|
8
6
|
export * from './account/user/index.js';
|
|
9
7
|
export * from './assets/asset/index.js';
|
|
10
|
-
export * from './finance/invoice/index.js';
|
|
11
8
|
export * from './finance/payment/index.js';
|
|
12
|
-
export * from './finance/refund/index.js';
|
|
13
|
-
export * from './inventory/catalog/attribute/index.js';
|
|
14
9
|
export * from './inventory/catalog/brand/index.js';
|
|
15
10
|
export * from './inventory/catalog/category/index.js';
|
|
16
|
-
export * from './inventory/catalog/collection/index.js';
|
|
17
11
|
export * from './inventory/catalog/product/index.js';
|
|
18
12
|
export * from './inventory/catalog/variant/index.js';
|
|
19
|
-
export * from './inventory/configuration/measurement/index.js';
|
|
20
|
-
export * from './inventory/configuration/unit/index.js';
|
|
21
|
-
export * from './inventory/stock/balance/index.js';
|
|
22
|
-
export * from './inventory/stock/transfer/index.js';
|
|
23
|
-
export * from './inventory/stock/warehouse/index.js';
|
|
24
13
|
export * from './order/purchase/item/index.js';
|
|
25
14
|
export * from './order/purchase/transaction/index.js';
|
|
26
15
|
export * from './order/purchase/vendor/index.js';
|
|
27
16
|
export * from './order/sale/customer/index.js';
|
|
28
17
|
export * from './order/sale/item/index.js';
|
|
29
18
|
export * from './order/sale/transaction/index.js';
|
|
30
|
-
export * from './order/type/index.js';
|
|
31
19
|
export * from './settings/organization/index.js';
|
|
20
|
+
export * from './supplier/product/index.js';
|
|
21
|
+
export * from './supplier/source/index.js';
|
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
import { AssetEntity } from '../../../assets/asset';
|
|
2
|
-
import { StockBalanceEntity } from '../../stock/balance';
|
|
3
|
-
import { StockBalanceStatusEnum } from '../../stock/balance';
|
|
4
2
|
import { AbstractEntity } from '../../../abstract.entity.js';
|
|
5
|
-
import { CatalogAttributeEntity } from '../attribute';
|
|
6
3
|
import type { CatalogBrandEntity } from '../brand';
|
|
7
4
|
import type { CatalogCategoryEntity } from '../category';
|
|
8
5
|
import type { CatalogVariantEntity } from '../variant';
|
|
9
|
-
import type {
|
|
10
|
-
import type { ConfigurationUnitEntity } from '../../configuration/unit';
|
|
6
|
+
import type { SupplierSourceEntity } from '../../../supplier/source';
|
|
11
7
|
export declare class CatalogProductEntity extends AbstractEntity {
|
|
12
8
|
sku?: string;
|
|
13
9
|
name: string;
|
|
14
10
|
description?: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
active: boolean;
|
|
12
|
+
source?: SupplierSourceEntity;
|
|
13
|
+
externalProductId?: string;
|
|
14
|
+
variant: CatalogVariantEntity;
|
|
15
|
+
readonly supplierPrice: number;
|
|
16
|
+
readonly retailPrice: number;
|
|
19
17
|
category?: CatalogCategoryEntity;
|
|
20
18
|
brand?: CatalogBrandEntity;
|
|
21
|
-
attributes: {
|
|
22
|
-
type: CatalogAttributeEntity;
|
|
23
|
-
values: string[];
|
|
24
|
-
}[];
|
|
25
|
-
measure?: {
|
|
26
|
-
amount: number;
|
|
27
|
-
kind: ConfigurationMeasurementEntity;
|
|
28
|
-
unit: string;
|
|
29
|
-
selected?: ConfigurationUnitEntity;
|
|
30
|
-
};
|
|
31
19
|
hashtags: string[];
|
|
32
20
|
readonly picture: AssetEntity;
|
|
33
21
|
readonly pictures: AssetEntity[];
|
|
34
22
|
readonly variants: CatalogVariantEntity[];
|
|
35
|
-
readonly status: StockBalanceStatusEnum;
|
|
36
|
-
readonly balance: StockBalanceEntity;
|
|
37
|
-
readonly balances: StockBalanceEntity[];
|
|
38
|
-
readonly 'measure.selected': ConfigurationUnitEntity;
|
|
39
23
|
}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../../abstract.validator.js';
|
|
2
|
+
import { CreateVariantRequestValidator, UpdateVariantRequestValidator } from '../variant';
|
|
2
3
|
import type { CatalogProductEntity } from './product.entity.js';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
policy?: {
|
|
6
|
-
minStock?: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare class ProductAttributeRequestValidator extends AbstractRequestValidator {
|
|
10
|
-
type: string;
|
|
11
|
-
values: string[];
|
|
12
|
-
constructor(attribute?: CatalogProductEntity['attributes'][number]);
|
|
13
|
-
}
|
|
14
|
-
export declare class CreateProductRequestValidator extends AbstractRequestValidator {
|
|
4
|
+
import type { CatalogVariantEntity } from '../variant';
|
|
5
|
+
declare class ProductMetadataRequestValidator extends AbstractRequestValidator {
|
|
15
6
|
name: string;
|
|
16
|
-
sku?: string;
|
|
17
|
-
gtin?: string;
|
|
18
7
|
description?: string;
|
|
19
|
-
sellPrice?: number;
|
|
20
|
-
buyPrice?: number;
|
|
21
|
-
minStockLevel?: number;
|
|
22
|
-
measure: {
|
|
23
|
-
amount: any;
|
|
24
|
-
kind: any;
|
|
25
|
-
unit: any;
|
|
26
|
-
};
|
|
27
|
-
pictures?: string[];
|
|
28
8
|
category?: string;
|
|
29
9
|
brand?: string;
|
|
30
|
-
hashtags
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
hashtags?: string[];
|
|
11
|
+
constructor(product?: CatalogProductEntity);
|
|
12
|
+
}
|
|
13
|
+
declare class UpdateProductVariantRequestValidator extends UpdateVariantRequestValidator {
|
|
14
|
+
_id?: string;
|
|
15
|
+
constructor(variant?: CatalogVariantEntity);
|
|
33
16
|
}
|
|
34
|
-
export declare class UpdateProductRequestValidator extends
|
|
17
|
+
export declare class UpdateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
35
18
|
name: string;
|
|
36
|
-
|
|
19
|
+
active?: boolean;
|
|
20
|
+
variant?: UpdateProductVariantRequestValidator;
|
|
21
|
+
constructor(product?: CatalogProductEntity);
|
|
22
|
+
}
|
|
23
|
+
export declare class CreateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
24
|
+
variant: CreateVariantRequestValidator;
|
|
37
25
|
}
|
|
38
26
|
export {};
|
|
@@ -11,71 +11,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
import * as class_transformer_1 from "class-transformer";
|
|
12
12
|
import * as class_validator_1 from "class-validator";
|
|
13
13
|
import * as abstract_validator_1 from '../../../abstract.validator.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
values = [];
|
|
17
|
-
constructor(attribute) {
|
|
18
|
-
super();
|
|
19
|
-
if (!attribute) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
this.type = (attribute.type?._id || attribute.type);
|
|
23
|
-
this.values = attribute.values ?? [];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, class_validator_1.IsMongoId)(),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], ProductAttributeRequestValidator.prototype, "type", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, class_validator_1.IsArray)(),
|
|
32
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
33
|
-
(0, class_validator_1.Length)(0, 100, { each: true }),
|
|
34
|
-
__metadata("design:type", Array)
|
|
35
|
-
], ProductAttributeRequestValidator.prototype, "values", void 0);
|
|
36
|
-
export class CreateProductRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
14
|
+
import * as request_validator_1 from '../variant/index.js';
|
|
15
|
+
class ProductMetadataRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
37
16
|
name;
|
|
38
|
-
sku;
|
|
39
|
-
gtin;
|
|
40
17
|
description;
|
|
41
|
-
sellPrice;
|
|
42
|
-
buyPrice;
|
|
43
|
-
minStockLevel;
|
|
44
|
-
measure = { amount: null, kind: null, unit: null };
|
|
45
|
-
pictures = [];
|
|
46
18
|
category;
|
|
47
19
|
brand;
|
|
48
|
-
hashtags
|
|
49
|
-
attributes = [];
|
|
20
|
+
hashtags;
|
|
50
21
|
constructor(product) {
|
|
51
22
|
super();
|
|
52
|
-
if (!product)
|
|
23
|
+
if (!product)
|
|
53
24
|
return;
|
|
54
|
-
}
|
|
55
|
-
const identifier = product.variants?.[0]?.identifier;
|
|
56
25
|
this.name = product.name;
|
|
57
|
-
this.sku = identifier?.sku ?? product.sku;
|
|
58
|
-
this.gtin = identifier?.gtin;
|
|
59
26
|
this.description = product.description;
|
|
60
|
-
this.sellPrice = product.sellPrice ?? product.price;
|
|
61
|
-
this.buyPrice = product.buyPrice ?? product.cost;
|
|
62
|
-
this.minStockLevel = product.minStockLevel ?? product.policy?.minStock;
|
|
63
27
|
this.category = (product.category?._id || product.category);
|
|
64
28
|
this.brand = (product.brand?._id || product.brand);
|
|
65
29
|
this.hashtags = product.hashtags ?? [];
|
|
66
|
-
if (product.measure !== undefined) {
|
|
67
|
-
const measureUnit = product.measure?.unit;
|
|
68
|
-
this.measure = {
|
|
69
|
-
amount: product.measure?.amount ?? null,
|
|
70
|
-
kind: (product.measure?.kind?._id || product.measure?.kind),
|
|
71
|
-
unit: (measureUnit?._id || measureUnit),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
this.pictures =
|
|
75
|
-
product.pictures?.map((picture) => (picture?._id || picture)) ?? this.pictures;
|
|
76
|
-
this.attributes =
|
|
77
|
-
product.attributes?.map((attribute) => new ProductAttributeRequestValidator(attribute)) ??
|
|
78
|
-
this.attributes;
|
|
79
30
|
}
|
|
80
31
|
}
|
|
81
32
|
__decorate([
|
|
@@ -83,84 +34,75 @@ __decorate([
|
|
|
83
34
|
(0, class_validator_1.IsNotEmpty)(),
|
|
84
35
|
(0, class_validator_1.Length)(0, 100),
|
|
85
36
|
__metadata("design:type", String)
|
|
86
|
-
],
|
|
87
|
-
__decorate([
|
|
88
|
-
(0, class_validator_1.IsString)(),
|
|
89
|
-
(0, class_validator_1.Length)(0, 50),
|
|
90
|
-
(0, class_validator_1.IsOptional)(),
|
|
91
|
-
__metadata("design:type", String)
|
|
92
|
-
], CreateProductRequestValidator.prototype, "sku", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
(0, class_validator_1.IsString)(),
|
|
95
|
-
(0, class_validator_1.Length)(0, 50),
|
|
96
|
-
(0, class_validator_1.IsOptional)(),
|
|
97
|
-
__metadata("design:type", String)
|
|
98
|
-
], CreateProductRequestValidator.prototype, "gtin", void 0);
|
|
37
|
+
], ProductMetadataRequestValidator.prototype, "name", void 0);
|
|
99
38
|
__decorate([
|
|
100
39
|
(0, class_validator_1.IsString)(),
|
|
101
40
|
(0, class_validator_1.Length)(0, 1000),
|
|
102
41
|
(0, class_validator_1.IsOptional)(),
|
|
103
42
|
__metadata("design:type", String)
|
|
104
|
-
],
|
|
105
|
-
__decorate([
|
|
106
|
-
(0, class_validator_1.IsInt)(),
|
|
107
|
-
(0, class_validator_1.Min)(0),
|
|
108
|
-
(0, class_validator_1.IsOptional)(),
|
|
109
|
-
__metadata("design:type", Number)
|
|
110
|
-
], CreateProductRequestValidator.prototype, "sellPrice", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
(0, class_validator_1.IsInt)(),
|
|
113
|
-
(0, class_validator_1.Min)(0),
|
|
114
|
-
(0, class_validator_1.IsOptional)(),
|
|
115
|
-
__metadata("design:type", Number)
|
|
116
|
-
], CreateProductRequestValidator.prototype, "buyPrice", void 0);
|
|
117
|
-
__decorate([
|
|
118
|
-
(0, class_validator_1.IsInt)(),
|
|
119
|
-
(0, class_validator_1.Min)(0),
|
|
120
|
-
(0, class_validator_1.IsOptional)(),
|
|
121
|
-
__metadata("design:type", Number)
|
|
122
|
-
], CreateProductRequestValidator.prototype, "minStockLevel", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
(0, class_validator_1.IsObject)(),
|
|
125
|
-
__metadata("design:type", Object)
|
|
126
|
-
], CreateProductRequestValidator.prototype, "measure", void 0);
|
|
127
|
-
__decorate([
|
|
128
|
-
(0, class_validator_1.IsMongoId)({ each: true }),
|
|
129
|
-
(0, class_validator_1.IsArray)(),
|
|
130
|
-
(0, class_validator_1.IsOptional)(),
|
|
131
|
-
__metadata("design:type", Array)
|
|
132
|
-
], CreateProductRequestValidator.prototype, "pictures", void 0);
|
|
43
|
+
], ProductMetadataRequestValidator.prototype, "description", void 0);
|
|
133
44
|
__decorate([
|
|
134
45
|
(0, class_validator_1.IsMongoId)(),
|
|
135
46
|
(0, class_validator_1.IsOptional)(),
|
|
136
47
|
__metadata("design:type", String)
|
|
137
|
-
],
|
|
48
|
+
], ProductMetadataRequestValidator.prototype, "category", void 0);
|
|
138
49
|
__decorate([
|
|
139
50
|
(0, class_validator_1.IsMongoId)(),
|
|
140
51
|
(0, class_validator_1.IsOptional)(),
|
|
141
52
|
__metadata("design:type", String)
|
|
142
|
-
],
|
|
53
|
+
], ProductMetadataRequestValidator.prototype, "brand", void 0);
|
|
143
54
|
__decorate([
|
|
144
55
|
(0, class_validator_1.IsArray)(),
|
|
145
56
|
(0, class_validator_1.IsString)({ each: true }),
|
|
146
57
|
(0, class_validator_1.Length)(0, 50, { each: true }),
|
|
147
58
|
(0, class_validator_1.IsOptional)(),
|
|
148
59
|
__metadata("design:type", Array)
|
|
149
|
-
],
|
|
60
|
+
], ProductMetadataRequestValidator.prototype, "hashtags", void 0);
|
|
61
|
+
class UpdateProductVariantRequestValidator extends request_validator_1.UpdateVariantRequestValidator {
|
|
62
|
+
_id;
|
|
63
|
+
constructor(variant) {
|
|
64
|
+
super(variant);
|
|
65
|
+
if (variant)
|
|
66
|
+
this._id = String(variant._id ?? variant);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
150
69
|
__decorate([
|
|
151
|
-
(0, class_validator_1.
|
|
152
|
-
(0, class_transformer_1.Type)(() => ProductAttributeRequestValidator),
|
|
153
|
-
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
70
|
+
(0, class_validator_1.IsMongoId)(),
|
|
154
71
|
(0, class_validator_1.IsOptional)(),
|
|
155
|
-
__metadata("design:type",
|
|
156
|
-
],
|
|
157
|
-
export class UpdateProductRequestValidator extends
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], UpdateProductVariantRequestValidator.prototype, "_id", void 0);
|
|
74
|
+
export class UpdateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
75
|
+
active;
|
|
76
|
+
variant;
|
|
77
|
+
constructor(product) {
|
|
78
|
+
super(product);
|
|
79
|
+
if (product)
|
|
80
|
+
this.active = product.active;
|
|
81
|
+
if (product?.variant)
|
|
82
|
+
this.variant = new UpdateProductVariantRequestValidator(product.variant);
|
|
83
|
+
}
|
|
158
84
|
}
|
|
159
85
|
__decorate([
|
|
160
86
|
(0, class_validator_1.IsOptional)(),
|
|
161
87
|
__metadata("design:type", String)
|
|
162
88
|
], UpdateProductRequestValidator.prototype, "name", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, class_validator_1.IsBoolean)(),
|
|
91
|
+
(0, class_validator_1.IsOptional)(),
|
|
92
|
+
__metadata("design:type", Boolean)
|
|
93
|
+
], UpdateProductRequestValidator.prototype, "active", void 0);
|
|
163
94
|
__decorate([
|
|
164
95
|
(0, class_validator_1.IsOptional)(),
|
|
165
|
-
|
|
166
|
-
|
|
96
|
+
(0, class_validator_1.ValidateNested)(),
|
|
97
|
+
(0, class_transformer_1.Type)(() => UpdateProductVariantRequestValidator),
|
|
98
|
+
__metadata("design:type", UpdateProductVariantRequestValidator)
|
|
99
|
+
], UpdateProductRequestValidator.prototype, "variant", void 0);
|
|
100
|
+
export class CreateProductRequestValidator extends ProductMetadataRequestValidator {
|
|
101
|
+
variant;
|
|
102
|
+
}
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, class_validator_1.IsDefined)(),
|
|
105
|
+
(0, class_validator_1.ValidateNested)(),
|
|
106
|
+
(0, class_transformer_1.Type)(() => request_validator_1.CreateVariantRequestValidator),
|
|
107
|
+
__metadata("design:type", request_validator_1.CreateVariantRequestValidator)
|
|
108
|
+
], CreateProductRequestValidator.prototype, "variant", void 0);
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../../abstract.validator.js';
|
|
2
2
|
import type { CatalogVariantEntity } from './variant.entity.js';
|
|
3
|
-
export declare class
|
|
4
|
-
|
|
5
|
-
value: string;
|
|
6
|
-
constructor(option?: CatalogVariantEntity['options'][number]);
|
|
7
|
-
}
|
|
8
|
-
export declare class CreateVariantRequestValidator extends AbstractRequestValidator {
|
|
9
|
-
product?: string;
|
|
10
|
-
sku?: string;
|
|
11
|
-
price?: number;
|
|
12
|
-
minStockLevel?: number;
|
|
13
|
-
options?: VariantOptionRequestValidator[];
|
|
3
|
+
export declare class UpdateVariantRequestValidator extends AbstractRequestValidator {
|
|
4
|
+
retailPrice?: number;
|
|
14
5
|
active?: boolean;
|
|
15
|
-
gtin?: string;
|
|
16
6
|
constructor(variant?: CatalogVariantEntity);
|
|
17
7
|
}
|
|
18
|
-
export declare class
|
|
8
|
+
export declare class CreateVariantRequestValidator extends UpdateVariantRequestValidator {
|
|
9
|
+
supplierPrice: number;
|
|
10
|
+
retailPrice: number;
|
|
11
|
+
constructor(variant?: CatalogVariantEntity);
|
|
19
12
|
}
|
|
@@ -8,93 +8,48 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
import * as class_transformer_1 from "class-transformer";
|
|
12
11
|
import * as class_validator_1 from "class-validator";
|
|
13
12
|
import * as abstract_validator_1 from '../../../abstract.validator.js';
|
|
14
|
-
export class
|
|
15
|
-
|
|
16
|
-
value;
|
|
17
|
-
constructor(option) {
|
|
18
|
-
super();
|
|
19
|
-
if (!option) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
this.type = (option.type?._id || option.type);
|
|
23
|
-
this.value = option.value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, class_validator_1.IsMongoId)(),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], VariantOptionRequestValidator.prototype, "type", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, class_validator_1.IsString)(),
|
|
32
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
33
|
-
(0, class_validator_1.Length)(0, 100),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], VariantOptionRequestValidator.prototype, "value", void 0);
|
|
36
|
-
export class CreateVariantRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
37
|
-
product;
|
|
38
|
-
sku;
|
|
39
|
-
price;
|
|
40
|
-
minStockLevel;
|
|
41
|
-
options = [];
|
|
13
|
+
export class UpdateVariantRequestValidator extends abstract_validator_1.AbstractRequestValidator {
|
|
14
|
+
retailPrice;
|
|
42
15
|
active;
|
|
43
|
-
gtin;
|
|
44
16
|
constructor(variant) {
|
|
45
17
|
super();
|
|
46
|
-
if (!variant)
|
|
18
|
+
if (!variant)
|
|
47
19
|
return;
|
|
48
|
-
|
|
49
|
-
this.product = (variant.product?._id || variant.product);
|
|
50
|
-
this.sku = variant.identifier?.sku;
|
|
51
|
-
this.price = variant.price;
|
|
52
|
-
this.minStockLevel = variant.policy?.minStock;
|
|
20
|
+
this.retailPrice = variant.retailPrice;
|
|
53
21
|
this.active = variant.active;
|
|
54
|
-
this.gtin = variant.identifier?.gtin;
|
|
55
|
-
this.options =
|
|
56
|
-
variant.options?.map((option) => new VariantOptionRequestValidator(option)) ?? this.options;
|
|
57
22
|
}
|
|
58
23
|
}
|
|
59
|
-
__decorate([
|
|
60
|
-
(0, class_validator_1.IsMongoId)(),
|
|
61
|
-
(0, class_validator_1.IsOptional)(),
|
|
62
|
-
__metadata("design:type", String)
|
|
63
|
-
], CreateVariantRequestValidator.prototype, "product", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, class_validator_1.IsString)(),
|
|
66
|
-
(0, class_validator_1.Length)(0, 50),
|
|
67
|
-
(0, class_validator_1.IsOptional)(),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], CreateVariantRequestValidator.prototype, "sku", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, class_validator_1.IsNumber)(),
|
|
72
|
-
(0, class_validator_1.IsOptional)(),
|
|
73
|
-
__metadata("design:type", Number)
|
|
74
|
-
], CreateVariantRequestValidator.prototype, "price", void 0);
|
|
75
24
|
__decorate([
|
|
76
25
|
(0, class_validator_1.IsInt)(),
|
|
77
26
|
(0, class_validator_1.Min)(0),
|
|
27
|
+
(0, class_validator_1.Max)(Number.MAX_SAFE_INTEGER),
|
|
78
28
|
(0, class_validator_1.IsOptional)(),
|
|
79
29
|
__metadata("design:type", Number)
|
|
80
|
-
],
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, class_validator_1.IsArray)(),
|
|
83
|
-
(0, class_validator_1.IsOptional)(),
|
|
84
|
-
(0, class_transformer_1.Type)(() => VariantOptionRequestValidator),
|
|
85
|
-
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
86
|
-
__metadata("design:type", Array)
|
|
87
|
-
], CreateVariantRequestValidator.prototype, "options", void 0);
|
|
30
|
+
], UpdateVariantRequestValidator.prototype, "retailPrice", void 0);
|
|
88
31
|
__decorate([
|
|
89
32
|
(0, class_validator_1.IsBoolean)(),
|
|
90
33
|
(0, class_validator_1.IsOptional)(),
|
|
91
34
|
__metadata("design:type", Boolean)
|
|
92
|
-
],
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
35
|
+
], UpdateVariantRequestValidator.prototype, "active", void 0);
|
|
36
|
+
export class CreateVariantRequestValidator extends UpdateVariantRequestValidator {
|
|
37
|
+
supplierPrice;
|
|
38
|
+
constructor(variant) {
|
|
39
|
+
super(variant);
|
|
40
|
+
if (variant)
|
|
41
|
+
this.supplierPrice = variant.supplierPrice;
|
|
42
|
+
}
|
|
100
43
|
}
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_validator_1.IsInt)(),
|
|
46
|
+
(0, class_validator_1.Min)(0),
|
|
47
|
+
(0, class_validator_1.Max)(Number.MAX_SAFE_INTEGER),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], CreateVariantRequestValidator.prototype, "supplierPrice", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsInt)(),
|
|
52
|
+
(0, class_validator_1.Min)(0),
|
|
53
|
+
(0, class_validator_1.Max)(Number.MAX_SAFE_INTEGER),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], CreateVariantRequestValidator.prototype, "retailPrice", void 0);
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import { AssetEntity } from '../../../assets/asset';
|
|
2
|
-
import { StockBalanceStatusEnum } from '../../stock/balance';
|
|
3
2
|
import { AbstractEntity } from '../../../abstract.entity.js';
|
|
4
|
-
import { VariantIdentifierEntity } from './variant.identifier.entity.js';
|
|
5
|
-
import { VariantPolicyEntity } from './variant.policy.entity.js';
|
|
6
|
-
import type { CatalogAttributeEntity } from '../attribute';
|
|
7
3
|
import type { CatalogProductEntity } from '../product';
|
|
8
|
-
import type { StockBalanceEntity } from '../../stock/balance';
|
|
9
4
|
export declare class CatalogVariantEntity extends AbstractEntity {
|
|
10
|
-
product
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
identifier: VariantIdentifierEntity;
|
|
14
|
-
options: {
|
|
15
|
-
type: CatalogAttributeEntity;
|
|
16
|
-
value: string;
|
|
17
|
-
}[];
|
|
5
|
+
product: CatalogProductEntity;
|
|
6
|
+
supplierPrice: number;
|
|
7
|
+
retailPrice: number;
|
|
18
8
|
active: boolean;
|
|
19
9
|
pictures: AssetEntity[];
|
|
10
|
+
externalVariantId?: string;
|
|
20
11
|
readonly picture: AssetEntity;
|
|
21
|
-
readonly total: number;
|
|
22
|
-
readonly status: StockBalanceStatusEnum;
|
|
23
|
-
readonly balance: StockBalanceEntity;
|
|
24
|
-
readonly balances: StockBalanceEntity[];
|
|
25
12
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { CatalogProductEntity } from '../../../inventory/catalog/product';
|
|
2
2
|
import { CatalogVariantEntity } from '../../../inventory/catalog/variant';
|
|
3
|
-
import { StockBalanceEntity } from '../../../inventory/stock/balance';
|
|
4
|
-
import { StockWarehouseEntity } from '../../../inventory/stock/warehouse';
|
|
5
3
|
import { AbstractEntity } from '../../../abstract.entity.js';
|
|
6
4
|
interface ItemPricing {
|
|
7
5
|
product: number;
|
|
@@ -12,13 +10,10 @@ interface ItemPricing {
|
|
|
12
10
|
export declare class ItemEntity extends AbstractEntity {
|
|
13
11
|
product?: CatalogProductEntity;
|
|
14
12
|
variant: CatalogVariantEntity;
|
|
15
|
-
warehouse: StockWarehouseEntity;
|
|
16
13
|
quantity: number;
|
|
17
14
|
notes: string;
|
|
18
15
|
price: ItemPricing;
|
|
19
16
|
readonly 'price.unit': number;
|
|
20
17
|
readonly 'price.total': number;
|
|
21
|
-
readonly balance?: StockBalanceEntity;
|
|
22
|
-
readonly isProcessable: boolean;
|
|
23
18
|
}
|
|
24
19
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AbstractRequestValidator } from '../../../abstract.validator.js';
|
|
2
2
|
import type { ItemEntity } from '../../sale/item';
|
|
3
3
|
export declare class PurchaseItemRequestValidator extends AbstractRequestValidator {
|
|
4
|
+
_id?: string;
|
|
4
5
|
product: string;
|
|
5
6
|
variant: string;
|
|
6
|
-
warehouse?: string;
|
|
7
7
|
quantity: number;
|
|
8
8
|
price: number;
|
|
9
9
|
notes: string;
|