@merkaly/api 0.3.5 → 0.4.0
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 +4 -19
- package/dist/abstract.validator.d.ts +4 -1
- package/dist/abstract.validator.js +106 -0
- package/dist/account/address/address.validator.js +59 -0
- package/dist/account/address/index.js +1 -2
- package/dist/account/payment/index.js +1 -2
- package/dist/account/payment/payment.entity.d.ts +5 -4
- package/dist/account/payment/payment.validator.d.ts +12 -5
- package/dist/account/payment/payment.validator.js +92 -0
- package/dist/account/user/index.js +1 -2
- package/dist/account/user/user.validator.js +60 -0
- package/dist/address.entity.d.ts +1 -0
- package/dist/assets/asset/asset.entity.d.ts +0 -1
- package/dist/assets/asset/asset.enum.js +0 -4
- package/dist/assets/asset/index.js +1 -7
- package/dist/finance/invoice/index.js +2 -7
- package/dist/finance/invoice/invoice.entity.d.ts +3 -1
- package/dist/finance/invoice/invoice.enum.js +0 -4
- package/dist/finance/invoice/invoice.validator.d.ts +3 -0
- package/dist/finance/invoice/invoice.validator.js +78 -0
- package/dist/finance/payment/index.d.ts +0 -1
- package/dist/finance/payment/index.js +2 -7
- package/dist/finance/payment/payment.entity.d.ts +8 -6
- package/dist/finance/payment/payment.enum.d.ts +5 -1
- package/dist/finance/payment/payment.enum.js +9 -8
- package/dist/finance/payment/payment.validator.d.ts +4 -2
- package/dist/finance/payment/payment.validator.js +55 -0
- package/dist/finance/refund/index.js +2 -7
- package/dist/finance/refund/refund.enum.js +0 -4
- package/dist/finance/refund/refund.validator.js +67 -0
- package/dist/finance/subscription/index.js +2 -7
- package/dist/finance/subscription/subscription.enum.js +0 -4
- package/dist/finance/subscription/subscription.validator.js +65 -0
- package/dist/finance/tax/index.js +2 -7
- package/dist/finance/tax/tax.enum.js +0 -4
- package/dist/finance/tax/tax.validator.js +55 -0
- package/dist/index.js +1 -2
- package/dist/inventory/catalog/attribute/attribute.entity.d.ts +1 -3
- package/dist/inventory/catalog/attribute/attribute.validator.d.ts +1 -3
- package/dist/inventory/catalog/attribute/attribute.validator.js +38 -0
- package/dist/inventory/catalog/attribute/index.js +1 -2
- package/dist/inventory/catalog/brand/brand.validator.js +31 -0
- package/dist/inventory/catalog/brand/index.js +1 -2
- package/dist/inventory/catalog/category/category.validator.js +31 -0
- package/dist/inventory/catalog/category/index.js +1 -2
- package/dist/inventory/catalog/collection/collection.validator.js +37 -0
- package/dist/inventory/catalog/collection/index.js +1 -2
- package/dist/inventory/catalog/product/index.js +2 -7
- package/dist/inventory/catalog/product/product.entity.d.ts +3 -11
- package/dist/inventory/catalog/product/product.status.enum.js +0 -4
- package/dist/inventory/catalog/product/product.validator.d.ts +4 -6
- package/dist/inventory/catalog/product/product.validator.js +119 -0
- package/dist/inventory/catalog/variant/index.js +1 -2
- package/dist/inventory/catalog/variant/variant.entity.d.ts +4 -2
- package/dist/inventory/catalog/variant/variant.validator.d.ts +5 -5
- package/dist/inventory/catalog/variant/variant.validator.js +118 -0
- package/dist/inventory/configuration/measurement/index.js +1 -2
- package/dist/inventory/configuration/measurement/measurement.validator.js +78 -0
- package/dist/inventory/configuration/unit/index.js +1 -2
- package/dist/inventory/stock/transfer/index.js +1 -2
- package/dist/inventory/stock/transfer/transfer.entity.d.ts +2 -5
- package/dist/inventory/stock/transfer/transfer.validator.d.ts +5 -6
- package/dist/inventory/stock/transfer/transfer.validator.js +99 -0
- package/dist/inventory/stock/warehouse/index.js +1 -2
- package/dist/inventory/stock/warehouse/warehouse.entity.d.ts +3 -13
- package/dist/inventory/stock/warehouse/warehouse.validator.d.ts +2 -12
- package/dist/inventory/stock/warehouse/warehouse.validator.js +56 -0
- package/dist/order/purchase/item/index.js +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 +41 -0
- package/dist/order/purchase/transaction/index.js +2 -7
- package/dist/order/purchase/transaction/transaction.entity.d.ts +2 -1
- package/dist/order/purchase/transaction/transaction.enum.js +0 -4
- package/dist/order/purchase/transaction/transaction.validator.d.ts +0 -2
- package/dist/order/purchase/transaction/transaction.validator.js +65 -0
- package/dist/order/purchase/vendor/index.js +1 -2
- package/dist/order/purchase/vendor/vendor.validator.js +67 -0
- package/dist/order/sale/customer/customer.entity.d.ts +2 -0
- package/dist/order/sale/customer/customer.enum.d.ts +4 -0
- package/dist/order/sale/customer/customer.enum.js +5 -0
- package/dist/order/sale/customer/customer.validator.d.ts +2 -0
- package/dist/order/sale/customer/customer.validator.js +76 -0
- package/dist/order/sale/customer/index.d.ts +1 -0
- package/dist/order/sale/customer/index.js +2 -2
- package/dist/order/sale/item/index.js +1 -2
- package/dist/order/sale/item/item.entity.d.ts +4 -3
- 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.js +1 -2
- package/dist/order/sale/payment/payment.validator.d.ts +2 -2
- package/dist/order/sale/payment/payment.validator.js +31 -0
- package/dist/order/sale/shipping/index.d.ts +0 -1
- package/dist/order/sale/shipping/index.js +2 -7
- package/dist/order/sale/shipping/shipping.entity.d.ts +3 -4
- package/dist/order/sale/shipping/shipping.enum.js +0 -4
- package/dist/order/sale/shipping/shipping.validator.d.ts +2 -2
- package/dist/order/sale/shipping/shipping.validator.js +57 -0
- package/dist/order/sale/transaction/index.js +2 -7
- package/dist/order/sale/transaction/transaction.entity.d.ts +1 -1
- package/dist/order/sale/transaction/transaction.enum.js +0 -4
- package/dist/order/sale/transaction/transaction.validator.d.ts +4 -3
- package/dist/order/sale/transaction/transaction.validator.js +76 -0
- package/dist/settings/organization/index.js +2 -7
- package/dist/settings/organization/organization.enum.d.ts +2 -2
- package/dist/settings/organization/organization.enum.js +1 -5
- package/dist/settings/organization/organization.validator.js +35 -0
- package/package.json +11 -9
- package/dist/account/cart/cart.entity.d.ts +0 -8
- package/dist/account/cart/cart.validator.d.ts +0 -13
- package/dist/account/cart/index.d.ts +0 -2
- package/dist/account/cart/index.js +0 -2
- package/dist/account/wishlist/index.d.ts +0 -2
- package/dist/account/wishlist/index.js +0 -2
- package/dist/account/wishlist/wishlist.entity.d.ts +0 -8
- package/dist/account/wishlist/wishlist.validator.d.ts +0 -12
- package/dist/finance/payment/payment.status.entity.d.ts +0 -8
- package/dist/inventory/configuration/label/index.d.ts +0 -2
- package/dist/inventory/configuration/label/index.js +0 -2
- package/dist/inventory/configuration/label/label.entity.d.ts +0 -7
- package/dist/inventory/configuration/label/label.validator.d.ts +0 -14
- package/dist/inventory/stock/backorder/backorder.entity.d.ts +0 -33
- package/dist/inventory/stock/backorder/backorder.validator.d.ts +0 -24
- package/dist/inventory/stock/backorder/index.d.ts +0 -2
- package/dist/inventory/stock/backorder/index.js +0 -2
- package/dist/order/sale/address/address.validator.d.ts +0 -11
- package/dist/order/sale/address/index.d.ts +0 -1
- package/dist/order/sale/address/index.js +0 -2
- package/dist/order/sale/shipping/shipping.status.entity.d.ts +0 -8
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CacheService } from './';
|
|
2
1
|
import { LoggerService } from './';
|
|
3
2
|
import { MongoService } from './';
|
|
4
3
|
import { AbstractEntity } from './';
|
|
@@ -16,16 +15,12 @@ export type CreateEntityArgs<T> = {
|
|
|
16
15
|
}> extends true ? K : never]: T[K] extends AbstractEntity ? CreateEntityArgs<T[K]> : T[K];
|
|
17
16
|
};
|
|
18
17
|
type UpdateEntityArgs<T extends AbstractEntity> = Partial<CreateEntityArgs<T>>;
|
|
19
|
-
interface ReadOptions {
|
|
20
|
-
cache?: boolean;
|
|
21
|
-
}
|
|
22
18
|
export declare abstract class AbstractRepository<E extends AbstractEntity = AbstractEntity> {
|
|
23
19
|
protected abstract readonly $schema: AbstractSchema<E>;
|
|
24
20
|
protected readonly $logger: LoggerService;
|
|
25
21
|
protected readonly $request: Request;
|
|
26
22
|
protected readonly $mongo: MongoService<E>;
|
|
27
|
-
readonly $
|
|
28
|
-
protected readonly $joins: Record<string, AbstractSchema<any>>;
|
|
23
|
+
protected readonly $joins: Record<string, AbstractSchema<any> | null>;
|
|
29
24
|
constructor($request: Request, $mongo: MongoService<E>, $logger: LoggerService);
|
|
30
25
|
get $builder(): Model<E>;
|
|
31
26
|
get $user(): import("../../app.types").AppAuthUser;
|
|
@@ -44,23 +39,13 @@ export declare abstract class AbstractRepository<E extends AbstractEntity = Abst
|
|
|
44
39
|
pages: number;
|
|
45
40
|
total: number;
|
|
46
41
|
}>;
|
|
47
|
-
read(param: string | RootFilterQuery<E>, validator?: ReadValidator
|
|
42
|
+
read(param: string | RootFilterQuery<E>, validator?: ReadValidator): Promise<HydratedDocument<E>>;
|
|
48
43
|
create(payload: CreateEntityArgs<E> | AbstractValidator, validator?: ReadValidator, doc?: Document<string, object, E>): Promise<import("mongoose").IfAny<E, any, Document<unknown, {}, E, {}, {}> & (import("mongoose").Require_id<E> extends infer T ? T extends import("mongoose").Require_id<E> ? T extends {
|
|
49
44
|
__v?: infer U;
|
|
50
45
|
} ? T : T & {
|
|
51
46
|
__v: number;
|
|
52
47
|
} : never : never)> | Document<string, object, E, Record<string, any>, {}>>;
|
|
53
|
-
update(
|
|
54
|
-
delete(
|
|
55
|
-
findByCreatedAtRange(startDate: Date, endDate: Date): Promise<{
|
|
56
|
-
data: import("mongoose").IfAny<E, any, Document<unknown, {}, E, {}, {}> & (import("mongoose").Require_id<E> extends infer T ? T extends import("mongoose").Require_id<E> ? T extends {
|
|
57
|
-
__v?: infer U;
|
|
58
|
-
} ? T : T & {
|
|
59
|
-
__v: number;
|
|
60
|
-
} : never : never)>[];
|
|
61
|
-
limit: number;
|
|
62
|
-
pages: number;
|
|
63
|
-
total: number;
|
|
64
|
-
}>;
|
|
48
|
+
update(param: string | RootFilterQuery<E>, payload: UpdateEntityArgs<E> | AbstractValidator, validator?: ReadValidator): Promise<HydratedDocument<E>>;
|
|
49
|
+
delete(param: string | RootFilterQuery<E>): Promise<void>;
|
|
65
50
|
}
|
|
66
51
|
export {};
|
|
@@ -10,9 +10,12 @@ export type KeyOfType<T, V> = keyof {
|
|
|
10
10
|
export declare class ReadValidator<E = AbstractEntity> extends AbstractValidator {
|
|
11
11
|
join?: PopulateOptions[];
|
|
12
12
|
}
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class PaginationValidator {
|
|
14
14
|
limit?: number;
|
|
15
15
|
page?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare class SearchValidator<E = AbstractEntity> {
|
|
18
|
+
pagination?: PaginationValidator;
|
|
16
19
|
sort?: {
|
|
17
20
|
[key: string]: SortOrder;
|
|
18
21
|
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import * as class_transformer_1 from "class-transformer";
|
|
11
|
+
import * as class_validator_1 from "class-validator";
|
|
12
|
+
export class AbstractValidator {
|
|
13
|
+
}
|
|
14
|
+
export function transformJoinsIntoPopulate(value) {
|
|
15
|
+
function transform(value) {
|
|
16
|
+
if ((0, class_validator_1.isString)(value)) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(value);
|
|
19
|
+
return transform(parsed);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return [{ path: value }];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if ((0, class_validator_1.isArray)(value)) {
|
|
26
|
+
return value.flatMap(transform);
|
|
27
|
+
}
|
|
28
|
+
if (typeof value === 'object' && value !== null && 'path' in value) {
|
|
29
|
+
const result = { path: value.path };
|
|
30
|
+
if (value.populate) {
|
|
31
|
+
result.populate = transform(value.populate);
|
|
32
|
+
}
|
|
33
|
+
return [result];
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return transform(value);
|
|
38
|
+
}
|
|
39
|
+
export class ReadValidator extends AbstractValidator {
|
|
40
|
+
join = [];
|
|
41
|
+
}
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsOptional)(),
|
|
44
|
+
(0, class_transformer_1.Transform)(({ value }) => transformJoinsIntoPopulate(value)),
|
|
45
|
+
__metadata("design:type", Array)
|
|
46
|
+
], ReadValidator.prototype, "join", void 0);
|
|
47
|
+
export class PaginationValidator {
|
|
48
|
+
limit = 10;
|
|
49
|
+
page = 1;
|
|
50
|
+
}
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 10)),
|
|
53
|
+
(0, class_validator_1.IsInt)(),
|
|
54
|
+
(0, class_validator_1.IsOptional)(),
|
|
55
|
+
__metadata("design:type", Number)
|
|
56
|
+
], PaginationValidator.prototype, "limit", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1)),
|
|
59
|
+
(0, class_validator_1.IsInt)(),
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], PaginationValidator.prototype, "page", void 0);
|
|
63
|
+
export class SearchValidator {
|
|
64
|
+
pagination = new PaginationValidator();
|
|
65
|
+
sort = {};
|
|
66
|
+
filters = {};
|
|
67
|
+
join = [];
|
|
68
|
+
}
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_transformer_1.Transform)(({ value }) => {
|
|
71
|
+
if (!value) {
|
|
72
|
+
return new PaginationValidator();
|
|
73
|
+
}
|
|
74
|
+
const parsed = (0, class_validator_1.isObject)(value) ? value : JSON.parse(value);
|
|
75
|
+
return (0, class_transformer_1.plainToInstance)(PaginationValidator, parsed);
|
|
76
|
+
}),
|
|
77
|
+
(0, class_validator_1.ValidateNested)(),
|
|
78
|
+
(0, class_transformer_1.Type)(() => PaginationValidator),
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
__metadata("design:type", PaginationValidator)
|
|
81
|
+
], SearchValidator.prototype, "pagination", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, class_transformer_1.Transform)(({ value }) => {
|
|
84
|
+
if ((0, class_validator_1.isObject)(value)) {
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
return value && JSON.parse(value);
|
|
88
|
+
}),
|
|
89
|
+
(0, class_validator_1.IsOptional)(),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], SearchValidator.prototype, "sort", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, class_transformer_1.Transform)(({ value }) => {
|
|
94
|
+
if ((0, class_validator_1.isObject)(value)) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
return value && JSON.parse(value);
|
|
98
|
+
}),
|
|
99
|
+
(0, class_validator_1.IsOptional)(),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], SearchValidator.prototype, "filters", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, class_validator_1.IsOptional)(),
|
|
104
|
+
(0, class_transformer_1.Transform)(({ value }) => transformJoinsIntoPopulate(value)),
|
|
105
|
+
__metadata("design:type", Array)
|
|
106
|
+
], SearchValidator.prototype, "join", void 0);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import * as class_validator_1 from "class-validator";
|
|
11
|
+
import * as abstract_validator_1 from '../..';
|
|
12
|
+
export class SearchAddressValidator extends abstract_validator_1.SearchValidator {
|
|
13
|
+
}
|
|
14
|
+
export class ReadAddressValidator extends abstract_validator_1.ReadValidator {
|
|
15
|
+
}
|
|
16
|
+
export class CreateAddressValidator extends abstract_validator_1.AbstractValidator {
|
|
17
|
+
street;
|
|
18
|
+
name;
|
|
19
|
+
complement;
|
|
20
|
+
country;
|
|
21
|
+
code;
|
|
22
|
+
longitude;
|
|
23
|
+
latitude;
|
|
24
|
+
}
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], CreateAddressValidator.prototype, "street", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CreateAddressValidator.prototype, "name", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsString)(),
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], CreateAddressValidator.prototype, "complement", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.Length)(2, 2),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], CreateAddressValidator.prototype, "country", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], CreateAddressValidator.prototype, "code", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsLongitude)(),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], CreateAddressValidator.prototype, "longitude", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_validator_1.IsLatitude)(),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], CreateAddressValidator.prototype, "latitude", void 0);
|
|
58
|
+
export class UpdateAddressValidator extends CreateAddressValidator {
|
|
59
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export * from './address.validator.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export * from './payment.validator.js';
|
|
@@ -3,9 +3,10 @@ import { AbstractEntity } from '../..';
|
|
|
3
3
|
import type { MongoEntity } from '../..';
|
|
4
4
|
export declare class AccountPaymentEntity extends AbstractEntity {
|
|
5
5
|
user: MongoEntity<AccountUserEntity>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
hash: string;
|
|
7
|
+
last4: string;
|
|
8
|
+
brand: string;
|
|
9
|
+
expMonth: number;
|
|
10
|
+
expYear: number;
|
|
10
11
|
holder: string;
|
|
11
12
|
}
|
|
@@ -6,10 +6,17 @@ export declare class ReadPaymentValidator extends ReadValidator<AccountPaymentEn
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CreatePaymentValidator extends AbstractValidator {
|
|
8
8
|
holder: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
hash: string;
|
|
10
|
+
last4: string;
|
|
11
|
+
brand: string;
|
|
12
|
+
expMonth: number;
|
|
13
|
+
expYear: number;
|
|
12
14
|
}
|
|
13
|
-
export declare class UpdatePaymentValidator extends
|
|
14
|
-
|
|
15
|
+
export declare class UpdatePaymentValidator extends AbstractValidator {
|
|
16
|
+
holder?: string;
|
|
17
|
+
hash: string;
|
|
18
|
+
last4: string;
|
|
19
|
+
brand: string;
|
|
20
|
+
expMonth?: number;
|
|
21
|
+
expYear?: number;
|
|
15
22
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import * as class_validator_1 from "class-validator";
|
|
11
|
+
import * as abstract_validator_1 from '../..';
|
|
12
|
+
export class SearchPaymentValidator extends abstract_validator_1.SearchValidator {
|
|
13
|
+
}
|
|
14
|
+
export class ReadPaymentValidator extends abstract_validator_1.ReadValidator {
|
|
15
|
+
}
|
|
16
|
+
export class CreatePaymentValidator extends abstract_validator_1.AbstractValidator {
|
|
17
|
+
holder;
|
|
18
|
+
hash;
|
|
19
|
+
last4;
|
|
20
|
+
brand;
|
|
21
|
+
expMonth;
|
|
22
|
+
expYear;
|
|
23
|
+
}
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], CreatePaymentValidator.prototype, "holder", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.IsString)(),
|
|
31
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], CreatePaymentValidator.prototype, "hash", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
(0, class_validator_1.Length)(4, 4),
|
|
37
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], CreatePaymentValidator.prototype, "last4", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], CreatePaymentValidator.prototype, "brand", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsInt)(),
|
|
47
|
+
(0, class_validator_1.Min)(1),
|
|
48
|
+
(0, class_validator_1.Max)(12),
|
|
49
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], CreatePaymentValidator.prototype, "expMonth", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.IsInt)(),
|
|
54
|
+
(0, class_validator_1.Min)(2000),
|
|
55
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], CreatePaymentValidator.prototype, "expYear", void 0);
|
|
58
|
+
export class UpdatePaymentValidator extends abstract_validator_1.AbstractValidator {
|
|
59
|
+
holder;
|
|
60
|
+
expMonth;
|
|
61
|
+
expYear;
|
|
62
|
+
}
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], UpdatePaymentValidator.prototype, "holder", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.ValidateIf)(() => false),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], UpdatePaymentValidator.prototype, "hash", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, class_validator_1.ValidateIf)(() => false),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], UpdatePaymentValidator.prototype, "last4", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, class_validator_1.ValidateIf)(() => false),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], UpdatePaymentValidator.prototype, "brand", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, class_validator_1.IsInt)(),
|
|
83
|
+
(0, class_validator_1.Min)(1),
|
|
84
|
+
(0, class_validator_1.Max)(12),
|
|
85
|
+
__metadata("design:type", Number)
|
|
86
|
+
], UpdatePaymentValidator.prototype, "expMonth", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, class_validator_1.IsOptional)(),
|
|
89
|
+
(0, class_validator_1.IsInt)(),
|
|
90
|
+
(0, class_validator_1.Min)(2000),
|
|
91
|
+
__metadata("design:type", Number)
|
|
92
|
+
], UpdatePaymentValidator.prototype, "expYear", void 0);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export * from './user.validator.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import * as class_validator_1 from "class-validator";
|
|
11
|
+
import * as abstract_validator_1 from '../..';
|
|
12
|
+
export class SearchUserValidator extends abstract_validator_1.SearchValidator {
|
|
13
|
+
}
|
|
14
|
+
export class ReadUserValidator extends abstract_validator_1.ReadValidator {
|
|
15
|
+
}
|
|
16
|
+
export class CreateUserValidator extends abstract_validator_1.AbstractValidator {
|
|
17
|
+
name = String();
|
|
18
|
+
picture = String();
|
|
19
|
+
email = String();
|
|
20
|
+
phone = String();
|
|
21
|
+
_id = String();
|
|
22
|
+
identities = [];
|
|
23
|
+
active = Boolean();
|
|
24
|
+
}
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], CreateUserValidator.prototype, "name", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], CreateUserValidator.prototype, "picture", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsEmail)(),
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], CreateUserValidator.prototype, "email", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], CreateUserValidator.prototype, "phone", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], CreateUserValidator.prototype, "_id", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
__metadata("design:type", Array)
|
|
53
|
+
], CreateUserValidator.prototype, "identities", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_validator_1.IsBoolean)(),
|
|
56
|
+
(0, class_validator_1.IsOptional)(),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], CreateUserValidator.prototype, "active", void 0);
|
|
59
|
+
export class UpdateUserValidator extends CreateUserValidator {
|
|
60
|
+
}
|
package/dist/address.entity.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssetType = void 0;
|
|
4
1
|
var AssetType;
|
|
5
2
|
(function (AssetType) {
|
|
6
3
|
AssetType["FILE"] = "file";
|
|
@@ -8,4 +5,3 @@ var AssetType;
|
|
|
8
5
|
AssetType["IMAGE"] = "image";
|
|
9
6
|
AssetType["DOCUMENT"] = "document";
|
|
10
7
|
})(AssetType || (exports.AssetType = AssetType = {}));
|
|
11
|
-
//# sourceMappingURL=asset.enum.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var asset_enum_1 = require("./asset.enum");
|
|
4
|
-
Object.keys(asset_enum_1).forEach(function (key) {
|
|
5
|
-
if (key === "default" || key === "__esModule") return;
|
|
6
|
-
Object.defineProperty(exports, key, { enumerable: true, get: function () { return asset_enum_1[key]; } });
|
|
7
|
-
});
|
|
1
|
+
export * from './asset.enum.js';
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var invoice_enum_1 = require("./invoice.enum");
|
|
4
|
-
Object.keys(invoice_enum_1).forEach(function (key) {
|
|
5
|
-
if (key === "default" || key === "__esModule") return;
|
|
6
|
-
Object.defineProperty(exports, key, { enumerable: true, get: function () { return invoice_enum_1[key]; } });
|
|
7
|
-
});
|
|
1
|
+
export * from './invoice.enum.js';
|
|
2
|
+
export * from './invoice.validator.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { AbstractEntity } from '../..';
|
|
1
|
+
import { AbstractEntity, MongoEntity } from '../..';
|
|
2
2
|
import { FinanceInvoiceStatusEnum, FinanceInvoiceTypeEnum } from './';
|
|
3
3
|
export declare class FinanceInvoiceEntity extends AbstractEntity {
|
|
4
|
+
order: MongoEntity<any>;
|
|
5
|
+
orderModel: string;
|
|
4
6
|
total: number;
|
|
5
7
|
subtotal: number;
|
|
6
8
|
tax: number;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FinanceInvoiceTypeEnum = exports.FinanceInvoiceStatusEnum = void 0;
|
|
4
1
|
var FinanceInvoiceStatusEnum;
|
|
5
2
|
(function (FinanceInvoiceStatusEnum) {
|
|
6
3
|
FinanceInvoiceStatusEnum["DRAFT"] = "DRAFT";
|
|
@@ -17,4 +14,3 @@ var FinanceInvoiceTypeEnum;
|
|
|
17
14
|
FinanceInvoiceTypeEnum["DEBIT_NOTE"] = "DEBIT_NOTE";
|
|
18
15
|
FinanceInvoiceTypeEnum["PROFORMA"] = "PROFORMA";
|
|
19
16
|
})(FinanceInvoiceTypeEnum || (exports.FinanceInvoiceTypeEnum = FinanceInvoiceTypeEnum = {}));
|
|
20
|
-
//# sourceMappingURL=invoice.enum.js.map
|
|
@@ -6,6 +6,9 @@ export declare class SearchFinanceInvoiceValidator extends SearchValidator<Finan
|
|
|
6
6
|
export declare class ReadFinanceInvoiceValidator extends ReadValidator<FinanceInvoiceEntity> {
|
|
7
7
|
}
|
|
8
8
|
export declare class CreateFinanceInvoiceValidator extends AbstractValidator {
|
|
9
|
+
order: string;
|
|
10
|
+
orderModel: string;
|
|
11
|
+
customer?: string;
|
|
9
12
|
type: FinanceInvoiceTypeEnum;
|
|
10
13
|
total?: number;
|
|
11
14
|
subtotal?: number;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import * as class_validator_1 from "class-validator";
|
|
11
|
+
import * as invoice_enum_1 from './';
|
|
12
|
+
import * as abstract_validator_1 from '../..';
|
|
13
|
+
export class SearchFinanceInvoiceValidator extends abstract_validator_1.SearchValidator {
|
|
14
|
+
}
|
|
15
|
+
export class ReadFinanceInvoiceValidator extends abstract_validator_1.ReadValidator {
|
|
16
|
+
}
|
|
17
|
+
export class CreateFinanceInvoiceValidator extends abstract_validator_1.AbstractValidator {
|
|
18
|
+
order;
|
|
19
|
+
orderModel;
|
|
20
|
+
customer;
|
|
21
|
+
type;
|
|
22
|
+
total;
|
|
23
|
+
subtotal;
|
|
24
|
+
tax;
|
|
25
|
+
dueDate;
|
|
26
|
+
notes;
|
|
27
|
+
}
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsMongoId)(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], CreateFinanceInvoiceValidator.prototype, "order", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsIn)(['SaleTransactionEntity', 'PurchaseTransactionEntity']),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], CreateFinanceInvoiceValidator.prototype, "orderModel", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsMongoId)(),
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], CreateFinanceInvoiceValidator.prototype, "customer", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsEnum)(invoice_enum_1.FinanceInvoiceTypeEnum),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], CreateFinanceInvoiceValidator.prototype, "type", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsNumber)(),
|
|
48
|
+
(0, class_validator_1.IsOptional)(),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], CreateFinanceInvoiceValidator.prototype, "total", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_validator_1.IsNumber)(),
|
|
53
|
+
(0, class_validator_1.IsOptional)(),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], CreateFinanceInvoiceValidator.prototype, "subtotal", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, class_validator_1.IsNumber)(),
|
|
58
|
+
(0, class_validator_1.IsOptional)(),
|
|
59
|
+
__metadata("design:type", Number)
|
|
60
|
+
], CreateFinanceInvoiceValidator.prototype, "tax", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, class_validator_1.IsDate)(),
|
|
63
|
+
(0, class_validator_1.IsOptional)(),
|
|
64
|
+
__metadata("design:type", Date)
|
|
65
|
+
], CreateFinanceInvoiceValidator.prototype, "dueDate", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, class_validator_1.IsString)(),
|
|
68
|
+
(0, class_validator_1.IsOptional)(),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], CreateFinanceInvoiceValidator.prototype, "notes", void 0);
|
|
71
|
+
export class UpdateFinanceInvoiceValidator extends CreateFinanceInvoiceValidator {
|
|
72
|
+
status;
|
|
73
|
+
}
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, class_validator_1.IsEnum)(invoice_enum_1.FinanceInvoiceStatusEnum),
|
|
76
|
+
(0, class_validator_1.IsOptional)(),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], UpdateFinanceInvoiceValidator.prototype, "status", void 0);
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var payment_enum_1 = require("./payment.enum");
|
|
4
|
-
Object.keys(payment_enum_1).forEach(function (key) {
|
|
5
|
-
if (key === "default" || key === "__esModule") return;
|
|
6
|
-
Object.defineProperty(exports, key, { enumerable: true, get: function () { return payment_enum_1[key]; } });
|
|
7
|
-
});
|
|
1
|
+
export * from './payment.enum.js';
|
|
2
|
+
export * from './payment.validator.js';
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import { PurchaseTransactionEntity } from '../../order/purchase/transaction';
|
|
1
2
|
import { SaleTransactionEntity } from '../../order/sale/transaction';
|
|
2
3
|
import { AbstractEntity, MongoEntity } from '../..';
|
|
3
|
-
import { FinancePaymentTypeEnum } from './';
|
|
4
|
-
import { FinancePaymentStatusEntity } from './';
|
|
4
|
+
import { FinancePaymentTypeEnum, FinancePaymentMethodEnum, FinancePaymentStatusEnum } from './';
|
|
5
5
|
import type { FinanceRefundEntity } from '../refund';
|
|
6
6
|
export declare class FinancePaymentEntity extends AbstractEntity {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type: FinancePaymentTypeEnum;
|
|
8
|
+
target: string;
|
|
9
|
+
order: MongoEntity<SaleTransactionEntity | PurchaseTransactionEntity>;
|
|
10
|
+
status: FinancePaymentStatusEnum;
|
|
11
|
+
date: Date;
|
|
9
12
|
total: number;
|
|
10
13
|
fee: number;
|
|
11
|
-
|
|
14
|
+
method: FinancePaymentMethodEnum;
|
|
12
15
|
sequence: number;
|
|
13
16
|
refunds: MongoEntity<FinanceRefundEntity>[];
|
|
14
17
|
readonly number: string;
|
|
15
|
-
readonly currentStatus: FinancePaymentStatusEntity;
|
|
16
18
|
readonly refundedTotal: number;
|
|
17
19
|
}
|