@merkaly/api 0.5.7 → 0.5.9
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/abstract.repository.d.ts +1 -5
- package/dist/finance/payment/payment.entity.d.ts +2 -1
- package/dist/finance/payment/payment.enum.d.ts +2 -1
- package/dist/finance/payment/payment.enum.js +1 -0
- package/dist/finance/payment/payment.validator.d.ts +1 -1
- package/dist/finance/payment/payment.validator.js +2 -2
- package/dist/inventory/catalog/product/product.entity.d.ts +1 -2
- package/dist/order/purchase/item/item.entity.d.ts +2 -0
- package/dist/order/purchase/item/item.validator.d.ts +1 -0
- package/dist/order/purchase/item/item.validator.js +5 -0
- package/dist/order/purchase/transaction/transaction.entity.d.ts +0 -2
- package/dist/order/purchase/transaction/transaction.validator.d.ts +0 -1
- package/dist/order/purchase/transaction/transaction.validator.js +1 -7
- package/dist/order/sale/item/item.entity.d.ts +2 -0
- package/dist/order/sale/item/item.validator.d.ts +1 -0
- package/dist/order/sale/item/item.validator.js +5 -0
- package/dist/order/sale/transaction/transaction.entity.d.ts +0 -2
- package/dist/order/sale/transaction/transaction.validator.d.ts +0 -1
- package/dist/order/sale/transaction/transaction.validator.js +1 -8
- package/dist/settings/organization/organization.enum.d.ts +2 -2
- package/dist/settings/organization/organization.enum.js +2 -2
- package/package.json +1 -1
|
@@ -65,11 +65,7 @@ export declare abstract class AbstractRepository<E extends AbstractEntity = Abst
|
|
|
65
65
|
}>;
|
|
66
66
|
read(locator: EntityLocator<E>, options?: ReadMethodOptions): Promise<E>;
|
|
67
67
|
private hasUpdateOperators;
|
|
68
|
-
protected save({ param, payload, join, session }: SaveMethodOptions<E>): Promise<
|
|
69
|
-
__v?: infer U;
|
|
70
|
-
} ? T : T & {
|
|
71
|
-
__v: number;
|
|
72
|
-
} : never : never)>>;
|
|
68
|
+
protected save({ param, payload, join, session }: SaveMethodOptions<E>): Promise<E>;
|
|
73
69
|
abstract create(options: CreateMethodOptions<AbstractValidator>): Promise<E>;
|
|
74
70
|
abstract update(locator: EntityLocator<E>, options: UpdateMethodOptions<AbstractValidator>): Promise<E>;
|
|
75
71
|
delete(locator: EntityLocator<E>, options?: DeleteMethodOptions): Promise<void>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PurchaseTransactionEntity } from '../../order/purchase/transaction';
|
|
2
2
|
import { SaleTransactionEntity } from '../../order/sale/transaction';
|
|
3
|
+
import { ServiceTransactionEntity } from '../..';
|
|
3
4
|
import { AbstractEntity, MongoEntity } from '../..';
|
|
4
5
|
import { StatusEntity } from '../..';
|
|
5
6
|
import { FinancePaymentMethodEnum, FinancePaymentStatusEnum, FinancePaymentTypeEnum } from './payment.enum.js';
|
|
6
7
|
export declare class FinancePaymentEntity extends AbstractEntity {
|
|
7
8
|
type: FinancePaymentTypeEnum;
|
|
8
9
|
target: string;
|
|
9
|
-
order: MongoEntity<SaleTransactionEntity | PurchaseTransactionEntity>;
|
|
10
|
+
order: MongoEntity<SaleTransactionEntity | PurchaseTransactionEntity | ServiceTransactionEntity>;
|
|
10
11
|
total: number;
|
|
11
12
|
fee: number;
|
|
12
13
|
method?: FinancePaymentMethodEnum;
|
|
@@ -16,4 +16,5 @@ export var FinancePaymentTypeEnum;
|
|
|
16
16
|
(function (FinancePaymentTypeEnum) {
|
|
17
17
|
FinancePaymentTypeEnum["SALE"] = "SALE";
|
|
18
18
|
FinancePaymentTypeEnum["PURCHASE"] = "PURCHASE";
|
|
19
|
+
FinancePaymentTypeEnum["SERVICE"] = "SERVICE";
|
|
19
20
|
})(FinancePaymentTypeEnum || (FinancePaymentTypeEnum = {}));
|
|
@@ -6,7 +6,7 @@ export declare class SearchFinancePaymentValidator extends SearchValidator<Finan
|
|
|
6
6
|
export declare class ReadFinancePaymentValidator extends ReadValidator<FinancePaymentEntity> {
|
|
7
7
|
}
|
|
8
8
|
export declare class SaveFinancePaymentValidator extends AbstractValidator {
|
|
9
|
-
|
|
9
|
+
type: FinancePaymentTypeEnum;
|
|
10
10
|
order?: string;
|
|
11
11
|
method?: FinancePaymentMethodEnum;
|
|
12
12
|
total?: number;
|
|
@@ -15,7 +15,7 @@ export class SearchFinancePaymentValidator extends abstract_validator_1.SearchVa
|
|
|
15
15
|
export class ReadFinancePaymentValidator extends abstract_validator_1.ReadValidator {
|
|
16
16
|
}
|
|
17
17
|
export class SaveFinancePaymentValidator extends abstract_validator_1.AbstractValidator {
|
|
18
|
-
|
|
18
|
+
type;
|
|
19
19
|
order;
|
|
20
20
|
method;
|
|
21
21
|
total;
|
|
@@ -25,7 +25,7 @@ __decorate([
|
|
|
25
25
|
(0, class_validator_1.IsEnum)(payment_enum_1.FinancePaymentTypeEnum),
|
|
26
26
|
(0, class_validator_1.IsOptional)({ groups: ['update'] }),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
|
-
], SaveFinancePaymentValidator.prototype, "
|
|
28
|
+
], SaveFinancePaymentValidator.prototype, "type", void 0);
|
|
29
29
|
__decorate([
|
|
30
30
|
(0, class_validator_1.IsMongoId)(),
|
|
31
31
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -24,8 +24,7 @@ export declare class CatalogProductEntity extends AbstractEntity {
|
|
|
24
24
|
unit: string;
|
|
25
25
|
};
|
|
26
26
|
hashtags: string[];
|
|
27
|
-
variants: MongoEntity<CatalogVariantEntity>[];
|
|
28
|
-
readonly hasVariants: boolean;
|
|
27
|
+
readonly variants: MongoEntity<CatalogVariantEntity>[];
|
|
29
28
|
readonly stock: number;
|
|
30
29
|
readonly image: MongoEntity<AssetEntity>;
|
|
31
30
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CatalogProductEntity } from '../../../inventory/catalog/product';
|
|
2
2
|
import { CatalogVariantEntity } from '../../../inventory/catalog/variant';
|
|
3
|
+
import { StockWarehouseEntity } from '../../../inventory/stock/warehouse';
|
|
3
4
|
import { AbstractEntity } from '../../..';
|
|
4
5
|
import type { MongoEntity } from '../../..';
|
|
5
6
|
export declare class PurchaseItemEntity extends AbstractEntity {
|
|
6
7
|
product: MongoEntity<CatalogProductEntity>;
|
|
7
8
|
variant: MongoEntity<CatalogVariantEntity>;
|
|
9
|
+
warehouse: MongoEntity<StockWarehouseEntity>;
|
|
8
10
|
priceProduct: number;
|
|
9
11
|
priceVariant: number;
|
|
10
12
|
quantity: number;
|
|
@@ -12,6 +12,7 @@ import * as abstract_validator_1 from '../../..';
|
|
|
12
12
|
export class PurchaseItemValidator extends abstract_validator_1.AbstractValidator {
|
|
13
13
|
product = String();
|
|
14
14
|
variant = String();
|
|
15
|
+
warehouse = String();
|
|
15
16
|
quantity = 1;
|
|
16
17
|
price = 0;
|
|
17
18
|
notes = String();
|
|
@@ -27,6 +28,10 @@ __decorate([
|
|
|
27
28
|
(0, class_validator_1.IsMongoId)(),
|
|
28
29
|
__metadata("design:type", Object)
|
|
29
30
|
], PurchaseItemValidator.prototype, "variant", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsMongoId)(),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], PurchaseItemValidator.prototype, "warehouse", void 0);
|
|
30
35
|
__decorate([
|
|
31
36
|
(0, class_validator_1.IsNumber)(),
|
|
32
37
|
(0, class_validator_1.Min)(1),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AccountUserEntity } from '../../../account/user';
|
|
2
2
|
import { FinancePaymentEntity } from '../../../finance/payment';
|
|
3
|
-
import { StockTransferEntity } from '../../../inventory/stock/transfer';
|
|
4
3
|
import { AbstractEntity } from '../../..';
|
|
5
4
|
import { StatusEntity } from '../../..';
|
|
6
5
|
import { PurchaseTransactionStatusEnum } from './transaction.enum.js';
|
|
@@ -10,7 +9,6 @@ import type { MongoEntity } from '../../..';
|
|
|
10
9
|
export declare class PurchaseTransactionEntity extends AbstractEntity {
|
|
11
10
|
user: MongoEntity<AccountUserEntity>;
|
|
12
11
|
vendor: MongoEntity<PurchaseVendorEntity>;
|
|
13
|
-
transfer: MongoEntity<StockTransferEntity>;
|
|
14
12
|
items: PurchaseItemEntity[];
|
|
15
13
|
notes?: string;
|
|
16
14
|
status: PurchaseTransactionStatusEnum;
|
|
@@ -27,16 +27,14 @@ export class SavePurchaseTransactionValidator extends abstract_validator_1.Abstr
|
|
|
27
27
|
quantity: item.quantity,
|
|
28
28
|
total: item.total,
|
|
29
29
|
variant: (0, abstract_validator_1.toId)(item.variant),
|
|
30
|
+
warehouse: (0, abstract_validator_1.toId)(item.warehouse),
|
|
30
31
|
}));
|
|
31
|
-
const transfer = entity.transfer;
|
|
32
32
|
this.notes = entity.notes;
|
|
33
|
-
this.warehouse = (0, abstract_validator_1.toId)(transfer?.destination);
|
|
34
33
|
this.vendor = (0, abstract_validator_1.toId)(entity.vendor);
|
|
35
34
|
}
|
|
36
35
|
items = [];
|
|
37
36
|
notes;
|
|
38
37
|
vendor;
|
|
39
|
-
warehouse;
|
|
40
38
|
get total() {
|
|
41
39
|
return this.items.reduce((sum, item) => sum + item.total, 0);
|
|
42
40
|
}
|
|
@@ -60,7 +58,3 @@ __decorate([
|
|
|
60
58
|
(0, class_validator_1.IsOptional)(),
|
|
61
59
|
__metadata("design:type", String)
|
|
62
60
|
], SavePurchaseTransactionValidator.prototype, "vendor", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, class_validator_1.IsMongoId)(),
|
|
65
|
-
__metadata("design:type", String)
|
|
66
|
-
], SavePurchaseTransactionValidator.prototype, "warehouse", void 0);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { CatalogAttributeEntity } from '../../../inventory/catalog/attribute';
|
|
2
2
|
import { CatalogProductEntity } from '../../../inventory/catalog/product';
|
|
3
|
+
import { StockWarehouseEntity } from '../../../inventory/stock/warehouse';
|
|
3
4
|
import { AbstractEntity } from '../../..';
|
|
4
5
|
import type { CatalogVariantEntity } from '../../../inventory/catalog/variant';
|
|
5
6
|
import type { MongoEntity } from '../../..';
|
|
6
7
|
export declare class SaleItemEntity extends AbstractEntity {
|
|
7
8
|
product: MongoEntity<CatalogProductEntity>;
|
|
8
9
|
variant: MongoEntity<CatalogVariantEntity>;
|
|
10
|
+
warehouse: MongoEntity<StockWarehouseEntity>;
|
|
9
11
|
priceProduct: number;
|
|
10
12
|
priceVariant: number;
|
|
11
13
|
quantity: number;
|
|
@@ -11,6 +11,7 @@ import * as class_validator_1 from "class-validator";
|
|
|
11
11
|
export class SaleItemValidator {
|
|
12
12
|
product;
|
|
13
13
|
variant;
|
|
14
|
+
warehouse;
|
|
14
15
|
quantity = 1;
|
|
15
16
|
notes;
|
|
16
17
|
price = 0;
|
|
@@ -26,6 +27,10 @@ __decorate([
|
|
|
26
27
|
(0, class_validator_1.IsMongoId)(),
|
|
27
28
|
__metadata("design:type", String)
|
|
28
29
|
], SaleItemValidator.prototype, "variant", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsMongoId)(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], SaleItemValidator.prototype, "warehouse", void 0);
|
|
29
34
|
__decorate([
|
|
30
35
|
(0, class_validator_1.IsPositive)(),
|
|
31
36
|
(0, class_validator_1.IsInt)(),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AccountUserEntity } from '../../../account/user';
|
|
2
2
|
import { FinancePaymentEntity } from '../../../finance/payment';
|
|
3
|
-
import { StockTransferEntity } from '../../../inventory/stock/transfer';
|
|
4
3
|
import { AbstractEntity } from '../../..';
|
|
5
4
|
import { StatusEntity } from '../../..';
|
|
6
5
|
import { SaleTransactionStatusEnum } from './transaction.enum.js';
|
|
@@ -10,7 +9,6 @@ import type { MongoEntity } from '../../..';
|
|
|
10
9
|
export declare class SaleTransactionEntity extends AbstractEntity {
|
|
11
10
|
user: MongoEntity<AccountUserEntity>;
|
|
12
11
|
customer: MongoEntity<SaleCustomerEntity>;
|
|
13
|
-
transfer: MongoEntity<StockTransferEntity>;
|
|
14
12
|
items: SaleItemEntity[];
|
|
15
13
|
notes?: string;
|
|
16
14
|
status: SaleTransactionStatusEnum;
|
|
@@ -26,16 +26,14 @@ export class SaveSaleTransactionValidator extends abstract_validator_1.AbstractV
|
|
|
26
26
|
quantity: item.quantity,
|
|
27
27
|
total: item.total,
|
|
28
28
|
variant: (0, abstract_validator_1.toId)(item.variant),
|
|
29
|
+
warehouse: (0, abstract_validator_1.toId)(item.warehouse),
|
|
29
30
|
}));
|
|
30
|
-
const transfer = entity.transfer;
|
|
31
|
-
this.warehouse = (0, abstract_validator_1.toId)(transfer?.origin);
|
|
32
31
|
this.notes = entity.notes;
|
|
33
32
|
this.customer = (0, abstract_validator_1.toId)(entity.customer);
|
|
34
33
|
}
|
|
35
34
|
items = [];
|
|
36
35
|
notes;
|
|
37
36
|
customer;
|
|
38
|
-
warehouse;
|
|
39
37
|
get total() {
|
|
40
38
|
return this.items.reduce((sum, item) => sum + item.total, 0);
|
|
41
39
|
}
|
|
@@ -59,8 +57,3 @@ __decorate([
|
|
|
59
57
|
(0, class_validator_1.IsOptional)(),
|
|
60
58
|
__metadata("design:type", String)
|
|
61
59
|
], SaveSaleTransactionValidator.prototype, "customer", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, class_validator_1.IsMongoId)(),
|
|
64
|
-
(0, class_validator_1.IsOptional)({ groups: ['update'] }),
|
|
65
|
-
__metadata("design:type", String)
|
|
66
|
-
], SaveSaleTransactionValidator.prototype, "warehouse", void 0);
|
|
@@ -3,10 +3,10 @@ export declare enum SettingsOrganizationEnum {
|
|
|
3
3
|
APP_CONTACT = "app.contact",
|
|
4
4
|
APP_REGIONAL = "app.regional",
|
|
5
5
|
APP_ADDRESS = "app.address",
|
|
6
|
+
INVENTORY_STOCK_TRANSFER_SEQUENCE = "inventory.stock.transfer.sequence",
|
|
6
7
|
ORDER_SALE_TRANSACTION_SEQUENCE = "order.sale.transaction.sequence",
|
|
7
|
-
ORDER_SALE_PAYMENT_SEQUENCE = "order.sale.payment.sequence",
|
|
8
8
|
ORDER_PURCHASE_TRANSACTION_SEQUENCE = "order.purchase.transaction.sequence",
|
|
9
|
-
|
|
9
|
+
ORDER_SERVICE_TRANSACTION_SEQUENCE = "order.service.transaction.sequence",
|
|
10
10
|
FINANCE_INVOICE_SEQUENCE = "finance.invoice.sequence",
|
|
11
11
|
FINANCE_PAYMENT_SEQUENCE = "finance.payment.sequence",
|
|
12
12
|
FINANCE_REFUND_SEQUENCE = "finance.refund.sequence",
|
|
@@ -4,10 +4,10 @@ export var SettingsOrganizationEnum;
|
|
|
4
4
|
SettingsOrganizationEnum["APP_CONTACT"] = "app.contact";
|
|
5
5
|
SettingsOrganizationEnum["APP_REGIONAL"] = "app.regional";
|
|
6
6
|
SettingsOrganizationEnum["APP_ADDRESS"] = "app.address";
|
|
7
|
+
SettingsOrganizationEnum["INVENTORY_STOCK_TRANSFER_SEQUENCE"] = "inventory.stock.transfer.sequence";
|
|
7
8
|
SettingsOrganizationEnum["ORDER_SALE_TRANSACTION_SEQUENCE"] = "order.sale.transaction.sequence";
|
|
8
|
-
SettingsOrganizationEnum["ORDER_SALE_PAYMENT_SEQUENCE"] = "order.sale.payment.sequence";
|
|
9
9
|
SettingsOrganizationEnum["ORDER_PURCHASE_TRANSACTION_SEQUENCE"] = "order.purchase.transaction.sequence";
|
|
10
|
-
SettingsOrganizationEnum["
|
|
10
|
+
SettingsOrganizationEnum["ORDER_SERVICE_TRANSACTION_SEQUENCE"] = "order.service.transaction.sequence";
|
|
11
11
|
SettingsOrganizationEnum["FINANCE_INVOICE_SEQUENCE"] = "finance.invoice.sequence";
|
|
12
12
|
SettingsOrganizationEnum["FINANCE_PAYMENT_SEQUENCE"] = "finance.payment.sequence";
|
|
13
13
|
SettingsOrganizationEnum["FINANCE_REFUND_SEQUENCE"] = "finance.refund.sequence";
|