@merkaly/api 0.3.0 → 0.3.3
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.entity.d.ts +11 -0
- package/dist/abstract.entity.js +45 -0
- package/dist/abstract.repository.d.ts +56 -0
- package/dist/abstract.repository.js +200 -0
- package/dist/abstract.validator.d.ts +22 -0
- package/dist/abstract.validator.js +98 -0
- package/dist/account/address/address.entity.d.ts +3 -3
- package/dist/account/address/address.entity.js +34 -0
- package/dist/account/address/address.validator.d.ts +2 -2
- package/dist/account/address/address.validator.js +67 -0
- package/dist/account/address/index.d.ts +2 -2
- package/dist/account/address/index.js +10 -0
- package/dist/account/cart/cart.entity.d.ts +8 -0
- package/dist/account/cart/cart.entity.js +34 -0
- package/dist/account/cart/cart.validator.d.ts +13 -0
- package/dist/account/cart/cart.validator.js +45 -0
- package/dist/account/cart/index.d.ts +2 -0
- package/dist/account/cart/index.js +12 -0
- package/dist/account/payment/index.d.ts +2 -0
- package/dist/account/payment/index.js +12 -0
- package/dist/account/payment/payment.entity.d.ts +11 -0
- package/dist/account/payment/payment.entity.js +57 -0
- package/dist/account/payment/payment.validator.d.ts +15 -0
- package/dist/account/payment/payment.validator.js +57 -0
- package/dist/account/user/index.d.ts +2 -2
- package/dist/account/user/index.js +10 -0
- package/dist/account/user/user.entity.d.ts +1 -1
- package/dist/account/user/user.entity.js +46 -0
- package/dist/account/user/user.validator.d.ts +2 -2
- package/dist/account/user/user.validator.js +68 -0
- package/dist/account/wishlist/index.d.ts +2 -0
- package/dist/account/wishlist/index.js +12 -0
- package/dist/account/wishlist/wishlist.entity.d.ts +8 -0
- package/dist/account/wishlist/wishlist.entity.js +38 -0
- package/dist/account/wishlist/wishlist.validator.d.ts +12 -0
- package/dist/account/wishlist/wishlist.validator.js +39 -0
- package/dist/address.entity.d.ts +14 -0
- package/dist/address.entity.js +59 -0
- package/dist/assets/asset/asset.entity.d.ts +11 -0
- package/dist/assets/asset/asset.entity.js +58 -0
- package/dist/assets/asset/asset.enum.d.ts +6 -0
- package/dist/assets/asset/asset.enum.js +11 -0
- package/dist/assets/asset/index.d.ts +2 -0
- package/dist/assets/asset/index.js +12 -0
- package/dist/billing/payment/index.d.ts +2 -2
- package/dist/billing/payment/index.js +10 -3
- package/dist/billing/payment/payment.enum.d.ts +2 -2
- package/dist/billing/payment/payment.enum.js +18 -18
- package/dist/billing/payment/transaction.entity.d.ts +9 -9
- package/dist/billing/payment/transaction.entity.js +55 -0
- package/dist/billing/status/index.d.ts +1 -1
- package/dist/billing/status/index.js +5 -0
- package/dist/billing/status/status.entity.d.ts +5 -5
- package/dist/billing/status/status.entity.js +40 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +22 -0
- package/dist/inventory/catalog/attribute/attribute.entity.d.ts +1 -1
- package/dist/inventory/catalog/attribute/attribute.entity.js +47 -0
- package/dist/inventory/catalog/attribute/attribute.validator.d.ts +2 -2
- package/dist/inventory/catalog/attribute/attribute.validator.js +58 -0
- package/dist/inventory/catalog/attribute/index.d.ts +2 -2
- package/dist/inventory/catalog/attribute/index.js +10 -0
- package/dist/inventory/catalog/brand/brand.entity.d.ts +2 -2
- package/dist/inventory/catalog/brand/brand.entity.js +33 -0
- package/dist/inventory/catalog/brand/brand.validator.d.ts +2 -2
- package/dist/inventory/catalog/brand/brand.validator.js +39 -0
- package/dist/inventory/catalog/brand/index.d.ts +2 -2
- package/dist/inventory/catalog/brand/index.js +10 -0
- package/dist/inventory/catalog/category/category.entity.d.ts +2 -2
- package/dist/inventory/catalog/category/category.entity.js +33 -0
- package/dist/inventory/catalog/category/category.validator.d.ts +2 -2
- package/dist/inventory/catalog/category/category.validator.js +39 -0
- package/dist/inventory/catalog/category/index.d.ts +2 -2
- package/dist/inventory/catalog/category/index.js +10 -0
- package/dist/inventory/catalog/collection/collection.entity.d.ts +2 -2
- package/dist/inventory/catalog/collection/collection.entity.js +42 -0
- package/dist/inventory/catalog/collection/collection.validator.d.ts +2 -2
- package/dist/inventory/catalog/collection/collection.validator.js +45 -0
- package/dist/inventory/catalog/collection/index.d.ts +2 -2
- package/dist/inventory/catalog/collection/index.js +10 -0
- package/dist/inventory/catalog/product/index.d.ts +3 -3
- package/dist/inventory/catalog/product/index.js +15 -2
- package/dist/inventory/catalog/product/product.entity.d.ts +10 -10
- package/dist/inventory/catalog/product/product.entity.js +115 -0
- package/dist/inventory/catalog/product/product.validator.d.ts +4 -4
- package/dist/inventory/catalog/product/product.validator.js +135 -0
- package/dist/inventory/configuration/label/index.d.ts +2 -2
- package/dist/inventory/configuration/label/index.js +10 -0
- package/dist/inventory/configuration/label/label.entity.d.ts +1 -1
- package/dist/inventory/configuration/label/label.entity.js +42 -0
- package/dist/inventory/configuration/label/label.validator.d.ts +2 -2
- package/dist/inventory/configuration/label/label.validator.js +51 -0
- package/dist/inventory/configuration/measurement/index.d.ts +2 -1
- package/dist/inventory/configuration/measurement/index.js +10 -0
- package/dist/inventory/configuration/measurement/measurement.entity.d.ts +4 -4
- package/dist/inventory/configuration/measurement/measurement.entity.js +42 -0
- package/dist/inventory/configuration/measurement/measurement.validator.d.ts +21 -0
- package/dist/inventory/configuration/measurement/measurement.validator.js +87 -0
- package/dist/inventory/configuration/unit/index.d.ts +1 -1
- package/dist/inventory/configuration/unit/index.js +5 -0
- package/dist/inventory/configuration/unit/unit.entity.d.ts +2 -2
- package/dist/inventory/configuration/unit/unit.entity.js +46 -0
- package/dist/inventory/stock/backorder/backorder.entity.d.ts +5 -5
- package/dist/inventory/stock/backorder/backorder.entity.js +106 -0
- package/dist/inventory/stock/backorder/backorder.validator.d.ts +2 -2
- package/dist/inventory/stock/backorder/backorder.validator.js +112 -0
- package/dist/inventory/stock/backorder/index.d.ts +2 -2
- package/dist/inventory/stock/backorder/index.js +10 -0
- package/dist/inventory/stock/transfer/index.d.ts +2 -2
- package/dist/inventory/stock/transfer/index.js +10 -0
- package/dist/inventory/stock/transfer/transfer.entity.d.ts +6 -6
- package/dist/inventory/stock/transfer/transfer.entity.js +108 -0
- package/dist/inventory/stock/transfer/transfer.validator.d.ts +4 -4
- package/dist/inventory/stock/transfer/transfer.validator.js +108 -0
- package/dist/inventory/stock/warehouse/index.d.ts +2 -2
- package/dist/inventory/stock/warehouse/index.js +10 -0
- package/dist/inventory/stock/warehouse/warehouse.entity.d.ts +1 -1
- package/dist/inventory/stock/warehouse/warehouse.entity.js +67 -0
- package/dist/inventory/stock/warehouse/warehouse.validator.d.ts +4 -4
- package/dist/inventory/stock/warehouse/warehouse.validator.js +115 -0
- package/dist/logistic/carrier/carrier.entity.d.ts +1 -1
- package/dist/logistic/carrier/carrier.entity.js +57 -0
- package/dist/logistic/carrier/carrier.validator.d.ts +2 -2
- package/dist/logistic/carrier/carrier.validator.js +69 -0
- package/dist/logistic/carrier/index.d.ts +2 -2
- package/dist/logistic/carrier/index.js +10 -0
- package/dist/logistic/shipment/index.d.ts +3 -3
- package/dist/logistic/shipment/index.js +15 -3
- package/dist/logistic/shipment/shipment.entity.d.ts +11 -11
- package/dist/logistic/shipment/shipment.entity.js +67 -0
- package/dist/logistic/shipment/shipment.enum.d.ts +2 -2
- package/dist/logistic/shipment/shipment.enum.js +19 -19
- package/dist/logistic/shipment/shipment.validator.d.ts +8 -8
- package/dist/logistic/shipment/shipment.validator.js +65 -0
- package/dist/order/purchase/item/index.d.ts +2 -2
- package/dist/order/purchase/item/index.js +10 -0
- package/dist/order/purchase/item/item.entity.d.ts +3 -3
- package/dist/order/purchase/item/item.entity.js +46 -0
- package/dist/order/purchase/item/item.validator.d.ts +1 -1
- package/dist/order/purchase/item/item.validator.js +41 -0
- package/dist/order/purchase/transaction/index.d.ts +3 -3
- package/dist/order/purchase/transaction/index.js +15 -2
- package/dist/order/purchase/transaction/transaction.entity.d.ts +6 -6
- package/dist/order/purchase/transaction/transaction.entity.js +67 -0
- package/dist/order/purchase/transaction/transaction.validator.d.ts +4 -4
- package/dist/order/purchase/transaction/transaction.validator.js +87 -0
- package/dist/order/purchase/vendor/index.d.ts +2 -2
- package/dist/order/purchase/vendor/index.js +10 -0
- package/dist/order/purchase/vendor/vendor.entity.d.ts +1 -1
- package/dist/order/purchase/vendor/vendor.entity.js +62 -0
- package/dist/order/purchase/vendor/vendor.validator.d.ts +2 -2
- package/dist/order/purchase/vendor/vendor.validator.js +75 -0
- package/dist/order/sale/address/address.validator.d.ts +11 -0
- package/dist/order/sale/address/address.validator.js +70 -0
- package/dist/order/sale/address/index.d.ts +1 -0
- package/dist/order/sale/address/index.js +7 -0
- package/dist/order/sale/customer/customer.entity.d.ts +1 -1
- package/dist/order/sale/customer/customer.entity.js +62 -0
- package/dist/order/sale/customer/customer.validator.d.ts +2 -2
- package/dist/order/sale/customer/customer.validator.js +77 -0
- package/dist/order/sale/customer/index.d.ts +2 -2
- package/dist/order/sale/customer/index.js +10 -0
- package/dist/order/sale/item/index.d.ts +2 -2
- package/dist/order/sale/item/index.js +10 -0
- package/dist/order/sale/item/item.entity.d.ts +3 -3
- package/dist/order/sale/item/item.entity.js +45 -0
- package/dist/order/sale/item/item.validator.d.ts +1 -1
- package/dist/order/sale/item/item.validator.js +34 -0
- package/dist/order/sale/payment/index.d.ts +1 -0
- package/dist/order/sale/payment/index.js +7 -0
- package/dist/order/sale/payment/payment.validator.d.ts +16 -0
- package/dist/order/sale/payment/payment.validator.js +51 -0
- package/dist/order/sale/transaction/index.d.ts +3 -3
- package/dist/order/sale/transaction/index.js +15 -2
- package/dist/order/sale/transaction/transaction.entity.d.ts +11 -11
- package/dist/order/sale/transaction/transaction.entity.js +56 -0
- package/dist/order/sale/transaction/transaction.enum.d.ts +1 -1
- package/dist/order/sale/transaction/transaction.enum.js +10 -10
- package/dist/order/sale/transaction/transaction.validator.d.ts +8 -8
- package/dist/order/sale/transaction/transaction.validator.js +76 -0
- package/dist/repository.types.d.ts +13 -0
- package/package.json +1 -1
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
3
|
+
var transaction_entity_1 = require("./transaction.entity");
|
|
4
|
+
Object.keys(transaction_entity_1).forEach(function (key) {
|
|
5
|
+
if (key === "default" || key === "__esModule") return;
|
|
6
|
+
Object.defineProperty(exports, key, { enumerable: true, get: function () { return transaction_entity_1[key]; } });
|
|
7
|
+
});
|
|
8
|
+
var transaction_validator_1 = require("./transaction.validator");
|
|
9
|
+
Object.keys(transaction_validator_1).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, { enumerable: true, get: function () { return transaction_validator_1[key]; } });
|
|
12
|
+
});
|
|
13
|
+
var transaction_enum_1 = require("./transaction.enum");
|
|
14
|
+
Object.keys(transaction_enum_1).forEach(function (key) {
|
|
15
|
+
if (key === "default" || key === "__esModule") return;
|
|
16
|
+
Object.defineProperty(exports, key, { enumerable: true, get: function () { return transaction_enum_1[key]; } });
|
|
17
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AccountUserEntity } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AbstractEntity } from '
|
|
5
|
-
import {
|
|
6
|
-
import { SaleCustomerEntity } from '
|
|
7
|
-
import { SaleItemEntity } from '
|
|
8
|
-
import type { MongoEntity } from '
|
|
1
|
+
import { AccountUserEntity } from '../../../account/user';
|
|
2
|
+
import { BillingPaymentEntity } from '../../../billing/payment';
|
|
3
|
+
import { LogisticShippingEntity } from '../../../logistic/shipment';
|
|
4
|
+
import { AbstractEntity } from '../../..';
|
|
5
|
+
import { SaleTransactionStatusEnum } from './';
|
|
6
|
+
import { SaleCustomerEntity } from '../customer';
|
|
7
|
+
import { SaleItemEntity } from '../item';
|
|
8
|
+
import type { MongoEntity } from '../../..';
|
|
9
9
|
export declare class SaleTransactionEntity extends AbstractEntity {
|
|
10
10
|
user: MongoEntity<AccountUserEntity>;
|
|
11
11
|
company: MongoEntity<SaleCustomerEntity>;
|
|
@@ -13,9 +13,9 @@ export declare class SaleTransactionEntity extends AbstractEntity {
|
|
|
13
13
|
sequence: number;
|
|
14
14
|
notes?: string;
|
|
15
15
|
readonly number: string;
|
|
16
|
-
readonly status:
|
|
16
|
+
readonly status: SaleTransactionStatusEnum;
|
|
17
17
|
readonly subtotal: number;
|
|
18
18
|
readonly total: number;
|
|
19
|
-
readonly shipping?: MongoEntity<
|
|
20
|
-
readonly payment?: MongoEntity<
|
|
19
|
+
readonly shipping?: MongoEntity<LogisticShippingEntity>;
|
|
20
|
+
readonly payment?: MongoEntity<BillingPaymentEntity>;
|
|
21
21
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SaleTransactionEntity = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
const user_schema_1 = require("../../../account/schemas/user.schema");
|
|
16
|
+
const customer_schema_1 = require("../schemas/customer.schema");
|
|
17
|
+
const item_schema_1 = require("../schemas/item.schema");
|
|
18
|
+
const abstract_entity_1 = require("../../../../infrastructure/abstracts/abstract.entity");
|
|
19
|
+
let SaleTransactionEntity = class SaleTransactionEntity extends abstract_entity_1.AbstractEntity {
|
|
20
|
+
user;
|
|
21
|
+
company;
|
|
22
|
+
items = [];
|
|
23
|
+
sequence = 0;
|
|
24
|
+
notes;
|
|
25
|
+
number;
|
|
26
|
+
status;
|
|
27
|
+
subtotal;
|
|
28
|
+
total;
|
|
29
|
+
shipping;
|
|
30
|
+
payment;
|
|
31
|
+
};
|
|
32
|
+
exports.SaleTransactionEntity = SaleTransactionEntity;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)({ ref: user_schema_1.AccountUserSchema.name, required: true, type: mongoose_2.Schema.Types.String }),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], SaleTransactionEntity.prototype, "user", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)({ ref: customer_schema_1.SaleCustomerSchema.name, type: mongoose_2.Schema.Types.ObjectId }),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], SaleTransactionEntity.prototype, "company", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, mongoose_1.Prop)({ default: () => [], type: [item_schema_1.SaleItemSchema.schema] }),
|
|
43
|
+
__metadata("design:type", Array)
|
|
44
|
+
], SaleTransactionEntity.prototype, "items", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, mongoose_1.Prop)({ default: 1, immutable: true, type: mongoose_2.Schema.Types.Number, unique: true }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], SaleTransactionEntity.prototype, "sequence", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, trim: true }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], SaleTransactionEntity.prototype, "notes", void 0);
|
|
53
|
+
exports.SaleTransactionEntity = SaleTransactionEntity = __decorate([
|
|
54
|
+
(0, mongoose_1.Schema)(abstract_entity_1.$collection)
|
|
55
|
+
], SaleTransactionEntity);
|
|
56
|
+
//# sourceMappingURL=transaction.entity.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(
|
|
3
|
+
exports.SaleTransactionStatusEnum = void 0;
|
|
4
|
+
var SaleTransactionStatusEnum;
|
|
5
|
+
(function (SaleTransactionStatusEnum) {
|
|
6
|
+
SaleTransactionStatusEnum["PENDING"] = "PENDING";
|
|
7
|
+
SaleTransactionStatusEnum["ACCEPTED"] = "ACCEPTED";
|
|
8
|
+
SaleTransactionStatusEnum["IN_PROGRESS"] = "IN_PROGRESS";
|
|
9
|
+
SaleTransactionStatusEnum["ON_HOLD"] = "ON_HOLD";
|
|
10
|
+
SaleTransactionStatusEnum["COMPLETED"] = "COMPLETED";
|
|
11
|
+
SaleTransactionStatusEnum["CANCELLED"] = "CANCELLED";
|
|
12
|
+
})(SaleTransactionStatusEnum || (exports.SaleTransactionStatusEnum = SaleTransactionStatusEnum = {}));
|
|
13
13
|
//# sourceMappingURL=transaction.enum.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { SaleTransactionEntity } from '
|
|
2
|
-
import {
|
|
3
|
-
import { AbstractValidator, ReadValidator, SearchValidator } from '
|
|
4
|
-
import {
|
|
5
|
-
import { CreatePaymentValidator } from '
|
|
6
|
-
import { CreateShippingValidator } from '
|
|
1
|
+
import { SaleTransactionEntity } from './';
|
|
2
|
+
import { SaleTransactionStatusEnum } from './';
|
|
3
|
+
import { AbstractValidator, ReadValidator, SearchValidator } from '../../..';
|
|
4
|
+
import { SaleOrderItemValidator } from '../item';
|
|
5
|
+
import { CreatePaymentValidator } from '../payment';
|
|
6
|
+
import { CreateShippingValidator } from '../../../logistic/shipment';
|
|
7
7
|
export declare class SearchOrdersValidator extends SearchValidator<SaleTransactionEntity> {
|
|
8
8
|
}
|
|
9
9
|
export declare class ReadOrderValidator extends ReadValidator<SaleTransactionEntity> {
|
|
10
10
|
}
|
|
11
11
|
export declare class CreateOrderValidator extends AbstractValidator {
|
|
12
|
-
items:
|
|
12
|
+
items: SaleOrderItemValidator[];
|
|
13
13
|
notes: string;
|
|
14
14
|
shipping: CreateShippingValidator;
|
|
15
15
|
payment: CreatePaymentValidator;
|
|
@@ -17,5 +17,5 @@ export declare class CreateOrderValidator extends AbstractValidator {
|
|
|
17
17
|
company: string;
|
|
18
18
|
}
|
|
19
19
|
export declare class UpdateOrderValidator extends CreateOrderValidator {
|
|
20
|
-
status?:
|
|
20
|
+
status?: SaleTransactionStatusEnum;
|
|
21
21
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateOrderValidator = exports.CreateOrderValidator = exports.ReadOrderValidator = exports.SearchOrdersValidator = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const transaction_enum_1 = require("../enums/transaction.enum");
|
|
16
|
+
const abstract_validator_1 = require("../../../../infrastructure/abstracts/abstract.validator");
|
|
17
|
+
const item_validator_1 = require("./item.validator");
|
|
18
|
+
const payment_validator_1 = require("./payment.validator");
|
|
19
|
+
const shipment_validator_1 = require("../../../logistic/validators/shipment.validator");
|
|
20
|
+
class SearchOrdersValidator extends abstract_validator_1.SearchValidator {
|
|
21
|
+
}
|
|
22
|
+
exports.SearchOrdersValidator = SearchOrdersValidator;
|
|
23
|
+
class ReadOrderValidator extends abstract_validator_1.ReadValidator {
|
|
24
|
+
}
|
|
25
|
+
exports.ReadOrderValidator = ReadOrderValidator;
|
|
26
|
+
class CreateOrderValidator extends abstract_validator_1.AbstractValidator {
|
|
27
|
+
items = [];
|
|
28
|
+
notes = String();
|
|
29
|
+
shipping;
|
|
30
|
+
payment;
|
|
31
|
+
user;
|
|
32
|
+
company;
|
|
33
|
+
}
|
|
34
|
+
exports.CreateOrderValidator = CreateOrderValidator;
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsArray)(),
|
|
37
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
38
|
+
(0, class_transformer_1.Type)(() => item_validator_1.SaleOrderItemValidator),
|
|
39
|
+
(0, class_validator_1.ValidateNested)(),
|
|
40
|
+
__metadata("design:type", Array)
|
|
41
|
+
], CreateOrderValidator.prototype, "items", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
(0, class_validator_1.IsOptional)(),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], CreateOrderValidator.prototype, "notes", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, class_transformer_1.Type)(() => shipment_validator_1.CreateShippingValidator),
|
|
49
|
+
(0, class_validator_1.ValidateNested)(),
|
|
50
|
+
(0, class_validator_1.IsObject)(),
|
|
51
|
+
__metadata("design:type", shipment_validator_1.CreateShippingValidator)
|
|
52
|
+
], CreateOrderValidator.prototype, "shipping", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, class_transformer_1.Type)(() => payment_validator_1.CreatePaymentValidator),
|
|
55
|
+
(0, class_validator_1.ValidateNested)(),
|
|
56
|
+
(0, class_validator_1.IsObject)(),
|
|
57
|
+
__metadata("design:type", payment_validator_1.CreatePaymentValidator)
|
|
58
|
+
], CreateOrderValidator.prototype, "payment", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, class_validator_1.IsMongoId)(),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], CreateOrderValidator.prototype, "user", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsMongoId)(),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], CreateOrderValidator.prototype, "company", void 0);
|
|
67
|
+
class UpdateOrderValidator extends CreateOrderValidator {
|
|
68
|
+
status;
|
|
69
|
+
}
|
|
70
|
+
exports.UpdateOrderValidator = UpdateOrderValidator;
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, class_validator_1.IsOptional)(),
|
|
73
|
+
(0, class_validator_1.IsEnum)(transaction_enum_1.SaleTransactionStatusEnum),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], UpdateOrderValidator.prototype, "status", void 0);
|
|
76
|
+
//# sourceMappingURL=transaction.validator.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AbstractEntity } from './abstract.entity';
|
|
2
|
+
import type { Document } from 'mongoose';
|
|
3
|
+
|
|
4
|
+
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
5
|
+
type SystemKeys = '_id' | 'createdAt' | 'updatedAt' | 'deletedAt' | keyof Document;
|
|
6
|
+
|
|
7
|
+
export type CreateEntityArgs<T> = {
|
|
8
|
+
[K in keyof T as K extends SystemKeys ? never : T[K] extends Function ? never : Equal<{
|
|
9
|
+
[Q in K]: T[K];
|
|
10
|
+
}, {
|
|
11
|
+
-readonly [Q in K]: T[K];
|
|
12
|
+
}> extends true ? K : never]: T[K] extends AbstractEntity ? CreateEntityArgs<T[K]> : T[K];
|
|
13
|
+
};
|