@merkaly/api 0.2.2-10 → 0.2.2-12
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/.output/abstract/abstract.entity.d.ts +8 -0
- package/.output/abstract/abstract.entity.js +34 -0
- package/.output/abstract/abstract.validator.d.ts +9 -0
- package/.output/abstract/abstract.validator.js +41 -0
- package/.output/abstract/app.controller.d.ts +11 -0
- package/.output/abstract/app.controller.d.ts.map +1 -0
- package/.output/abstract/app.controller.js +22 -0
- package/.output/abstract/app.controller.js.map +1 -0
- package/.output/abstract/app.entity.d.ts +9 -0
- package/.output/abstract/app.entity.d.ts.map +1 -0
- package/.output/abstract/app.entity.js +28 -0
- package/.output/abstract/app.entity.js.map +1 -0
- package/.output/abstract/app.exception.d.ts +11 -0
- package/.output/abstract/app.exception.d.ts.map +1 -0
- package/.output/abstract/app.exception.js +37 -0
- package/.output/abstract/app.exception.js.map +1 -0
- package/.output/abstract/app.repository.d.ts +20 -0
- package/.output/abstract/app.repository.d.ts.map +1 -0
- package/.output/abstract/app.repository.js +73 -0
- package/.output/abstract/app.repository.js.map +1 -0
- package/.output/abstract/app.router.d.ts +6 -0
- package/.output/abstract/app.router.d.ts.map +1 -0
- package/.output/abstract/app.router.js +8 -0
- package/.output/abstract/app.router.js.map +1 -0
- package/.output/configs/app.controller.d.ts +11 -0
- package/.output/configs/app.controller.d.ts.map +1 -0
- package/.output/configs/app.controller.js +22 -0
- package/.output/configs/app.controller.js.map +1 -0
- package/.output/configs/app.entity.d.ts +2 -1
- package/.output/configs/app.entity.d.ts.map +1 -0
- package/.output/configs/app.entity.js +10 -16
- package/.output/configs/app.entity.js.map +1 -0
- package/.output/configs/app.exception.d.ts +11 -0
- package/.output/configs/app.exception.d.ts.map +1 -0
- package/.output/configs/app.exception.js +37 -0
- package/.output/configs/app.exception.js.map +1 -0
- package/.output/configs/app.repository.d.ts +20 -0
- package/.output/configs/app.repository.d.ts.map +1 -0
- package/.output/configs/app.repository.js +73 -0
- package/.output/configs/app.repository.js.map +1 -0
- package/.output/configs/app.router.d.ts +6 -0
- package/.output/configs/app.router.d.ts.map +1 -0
- package/.output/configs/app.router.js +8 -0
- package/.output/configs/app.router.js.map +1 -0
- package/.output/decorators/organization.decorator.d.ts +2 -0
- package/.output/decorators/organization.decorator.d.ts.map +1 -0
- package/.output/decorators/organization.decorator.js +10 -0
- package/.output/decorators/organization.decorator.js.map +1 -0
- package/.output/globals/global.controller.d.ts +20 -0
- package/.output/globals/global.controller.d.ts.map +1 -0
- package/.output/globals/global.controller.js +76 -0
- package/.output/globals/global.controller.js.map +1 -0
- package/.output/interceptors/logger.interceptor.d.ts +9 -0
- package/.output/interceptors/logger.interceptor.d.ts.map +1 -0
- package/.output/interceptors/logger.interceptor.js +54 -0
- package/.output/interceptors/logger.interceptor.js.map +1 -0
- package/.output/modules/app.module.d.ts +12 -0
- package/.output/modules/app.module.d.ts.map +1 -0
- package/.output/modules/app.module.js +37 -0
- package/.output/modules/app.module.js.map +1 -0
- package/.output/modules/assets/asset.entity.d.ts +2 -2
- package/.output/modules/assets/asset.entity.js +2 -2
- package/.output/modules/auth/auth.controller.d.ts +7 -0
- package/.output/modules/auth/auth.controller.d.ts.map +1 -0
- package/.output/modules/auth/auth.controller.js +31 -0
- package/.output/modules/auth/auth.controller.js.map +1 -0
- package/.output/modules/auth/connections/connection.controller.d.ts +8 -0
- package/.output/modules/auth/connections/connection.controller.d.ts.map +1 -0
- package/.output/modules/auth/connections/connection.controller.js +30 -0
- package/.output/modules/auth/connections/connection.controller.js.map +1 -0
- package/.output/modules/auth/connections/connection.module.d.ts +8 -0
- package/.output/modules/auth/connections/connection.module.d.ts.map +1 -0
- package/.output/modules/auth/connections/connection.module.js +22 -0
- package/.output/modules/auth/connections/connection.module.js.map +1 -0
- package/.output/modules/auth/connections/connection.validator.d.ts +1 -0
- package/.output/modules/auth/connections/connection.validator.d.ts.map +1 -0
- package/.output/modules/auth/connections/connection.validator.js +1 -12
- package/.output/modules/auth/connections/connection.validator.js.map +1 -0
- package/.output/modules/auth/members/member.controller.d.ts +8 -0
- package/.output/modules/auth/members/member.controller.d.ts.map +1 -0
- package/.output/modules/auth/members/member.controller.js +30 -0
- package/.output/modules/auth/members/member.controller.js.map +1 -0
- package/.output/modules/auth/members/member.module.d.ts +8 -0
- package/.output/modules/auth/members/member.module.d.ts.map +1 -0
- package/.output/modules/auth/members/member.module.js +22 -0
- package/.output/modules/auth/members/member.module.js.map +1 -0
- package/.output/modules/auth/members/member.validator.d.ts +1 -0
- package/.output/modules/auth/members/member.validator.d.ts.map +1 -0
- package/.output/modules/auth/members/member.validator.js +1 -0
- package/.output/modules/auth/members/member.validator.js.map +1 -0
- package/.output/modules/auth/organizations/organization.controller.d.ts +16 -0
- package/.output/modules/auth/organizations/organization.controller.d.ts.map +1 -0
- package/.output/modules/auth/organizations/organization.controller.js +101 -0
- package/.output/modules/auth/organizations/organization.controller.js.map +1 -0
- package/.output/modules/auth/organizations/organization.module.d.ts +9 -0
- package/.output/modules/auth/organizations/organization.module.d.ts.map +1 -0
- package/.output/modules/auth/organizations/organization.module.js +24 -0
- package/.output/modules/auth/organizations/organization.module.js.map +1 -0
- package/.output/modules/auth/organizations/organization.repository.d.ts +9 -0
- package/.output/modules/auth/organizations/organization.repository.d.ts.map +1 -0
- package/.output/modules/auth/organizations/organization.repository.js +42 -0
- package/.output/modules/auth/organizations/organization.repository.js.map +1 -0
- package/.output/modules/auth/organizations/organization.validator.d.ts +1 -0
- package/.output/modules/auth/organizations/organization.validator.d.ts.map +1 -0
- package/.output/modules/auth/organizations/organization.validator.js +1 -12
- package/.output/modules/auth/organizations/organization.validator.js.map +1 -0
- package/.output/modules/health/health.controller.d.ts +8 -0
- package/.output/modules/health/health.controller.d.ts.map +1 -0
- package/.output/modules/health/health.controller.js +29 -0
- package/.output/modules/health/health.controller.js.map +1 -0
- package/.output/modules/health/health.module.d.ts +9 -0
- package/.output/modules/health/health.module.d.ts.map +1 -0
- package/.output/modules/health/health.module.js +24 -0
- package/.output/modules/health/health.module.js.map +1 -0
- package/.output/modules/health.module.d.ts +3 -0
- package/.output/modules/health.module.d.ts.map +1 -0
- package/.output/modules/health.module.js +14 -0
- package/.output/modules/health.module.js.map +1 -0
- package/.output/modules/inventory/brands/brand.entity.d.ts +2 -2
- package/.output/modules/inventory/brands/brand.entity.js +2 -2
- package/.output/modules/inventory/categories/category.entity.d.ts +5 -2
- package/.output/modules/inventory/categories/category.entity.js +13 -2
- package/.output/modules/inventory/categories/category.validator.d.ts +2 -0
- package/.output/modules/inventory/categories/category.validator.js +12 -0
- package/.output/modules/inventory/products/product.entity.d.ts +2 -2
- package/.output/modules/inventory/products/product.entity.js +2 -2
- package/.output/modules/inventory/properties/property.entity.d.ts +7 -0
- package/.output/modules/inventory/properties/property.entity.js +38 -0
- package/.output/modules/inventory/properties/property.validator.d.ts +12 -0
- package/.output/modules/inventory/properties/property.validator.js +50 -0
- package/.output/modules/settings/connections/connection.validator.d.ts +9 -0
- package/.output/modules/settings/connections/connection.validator.js +35 -0
- package/.output/modules/settings/members/member.validator.d.ts +3 -0
- package/.output/modules/settings/members/member.validator.js +3 -0
- package/.output/modules/settings/organization/organization.entity.d.ts +10 -0
- package/.output/modules/settings/organization/organization.entity.d.ts.map +1 -0
- package/.output/modules/settings/organization/organization.entity.js +11 -0
- package/.output/modules/settings/organization/organization.entity.js.map +1 -0
- package/.output/modules/settings/organization/organization.validator.d.ts +15 -0
- package/.output/modules/settings/organization/organization.validator.js +71 -0
- package/.output/modules/settings/organizations/organization.controller.d.ts +16 -0
- package/.output/modules/settings/organizations/organization.controller.d.ts.map +1 -0
- package/.output/modules/settings/organizations/organization.controller.js +101 -0
- package/.output/modules/settings/organizations/organization.controller.js.map +1 -0
- package/.output/modules/settings/organizations/organization.module.d.ts +9 -0
- package/.output/modules/settings/organizations/organization.module.d.ts.map +1 -0
- package/.output/modules/settings/organizations/organization.module.js +24 -0
- package/.output/modules/settings/organizations/organization.module.js.map +1 -0
- package/.output/modules/settings/organizations/organization.repository.d.ts +9 -0
- package/.output/modules/settings/organizations/organization.repository.d.ts.map +1 -0
- package/.output/modules/settings/organizations/organization.repository.js +42 -0
- package/.output/modules/settings/organizations/organization.repository.js.map +1 -0
- package/.output/modules/settings/organizations/organization.validator.d.ts +7 -0
- package/.output/modules/settings/organizations/organization.validator.d.ts.map +1 -0
- package/.output/modules/settings/organizations/organization.validator.js +22 -0
- package/.output/modules/settings/organizations/organization.validator.js.map +1 -0
- package/.output/modules/settings/payments/payment.entity.d.ts +2 -2
- package/.output/modules/settings/payments/payment.entity.js +2 -2
- package/.output/modules/store/cart/cart.entity.d.ts +2 -2
- package/.output/modules/store/cart/cart.entity.js +2 -2
- package/.output/modules/store/orders/item/item.entity.d.ts +2 -2
- package/.output/modules/store/orders/item/item.entity.js +2 -2
- package/.output/modules/store/orders/order.entity.d.ts +2 -2
- package/.output/modules/store/orders/order.entity.js +2 -2
- package/.output/providers/mongo.provider.d.ts +20 -0
- package/.output/providers/mongo.provider.d.ts.map +1 -0
- package/.output/providers/mongo.provider.js +41 -0
- package/.output/providers/mongo.provider.js.map +1 -0
- package/.output/providers/schema.provider.d.ts +12 -0
- package/.output/providers/schema.provider.d.ts.map +1 -0
- package/.output/providers/schema.provider.js +33 -0
- package/.output/providers/schema.provider.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,34 @@
|
|
|
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.AbstractEntity = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
class AbstractEntity extends mongoose_2.Document {
|
|
16
|
+
static $index;
|
|
17
|
+
_id = String();
|
|
18
|
+
createdAt = null;
|
|
19
|
+
updatedAt = null;
|
|
20
|
+
deletedAt = null;
|
|
21
|
+
}
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
24
|
+
__metadata("design:type", Date)
|
|
25
|
+
], AbstractEntity.prototype, "createdAt", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
28
|
+
__metadata("design:type", Date)
|
|
29
|
+
], AbstractEntity.prototype, "updatedAt", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
32
|
+
__metadata("design:type", Date)
|
|
33
|
+
], AbstractEntity.prototype, "deletedAt", void 0);
|
|
34
|
+
exports.AbstractEntity = AbstractEntity;
|
|
@@ -0,0 +1,41 @@
|
|
|
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.FindValidator = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class FindValidator {
|
|
16
|
+
limit = 10;
|
|
17
|
+
sort = {};
|
|
18
|
+
filters = {};
|
|
19
|
+
join = [];
|
|
20
|
+
}
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : 10),
|
|
23
|
+
(0, class_validator_1.IsInt)(),
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
__metadata("design:type", Object)
|
|
26
|
+
], FindValidator.prototype, "limit", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_transformer_1.Transform)(({ value }) => value && JSON.parse(value)),
|
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
|
30
|
+
__metadata("design:type", Object)
|
|
31
|
+
], FindValidator.prototype, "sort", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_transformer_1.Transform)(({ value }) => value && JSON.parse(value)),
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], FindValidator.prototype, "filters", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
__metadata("design:type", Array)
|
|
40
|
+
], FindValidator.prototype, "join", void 0);
|
|
41
|
+
exports.FindValidator = FindValidator;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractRepository } from '../abstract/abstract.repository';
|
|
2
|
+
import { AppEntity } from './app.entity';
|
|
3
|
+
export declare abstract class AppController<E extends AppEntity> {
|
|
4
|
+
protected abstract readonly $repository: AbstractRepository<E>;
|
|
5
|
+
protected find?(...params: any): Promise<E[]>;
|
|
6
|
+
protected read?(id: string): Promise<E>;
|
|
7
|
+
protected create?(validator: unknown, ...params: any): Promise<E>;
|
|
8
|
+
protected update?(id: string, validator: unknown): Promise<E>;
|
|
9
|
+
protected delete?(id: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.controller.d.ts","sourceRoot":"","sources":["../../src/abstract/app.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,8BAAsB,aAAa,CAAC,CAAC,SAAS,SAAS;IACrD,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAE/D,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAI7C,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIvC,SAAS,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI7D,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppController = void 0;
|
|
4
|
+
class AppController {
|
|
5
|
+
find(...params) {
|
|
6
|
+
return this.$repository.find();
|
|
7
|
+
}
|
|
8
|
+
read(id) {
|
|
9
|
+
return this.$repository.read(id);
|
|
10
|
+
}
|
|
11
|
+
create(validator, ...params) {
|
|
12
|
+
return this.$repository.create(validator);
|
|
13
|
+
}
|
|
14
|
+
update(id, validator) {
|
|
15
|
+
return this.$repository.update(id, validator);
|
|
16
|
+
}
|
|
17
|
+
delete(id) {
|
|
18
|
+
return this.$repository.delete(id);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.AppController = AppController;
|
|
22
|
+
//# sourceMappingURL=app.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../../src/abstract/app.controller.ts"],"names":[],"mappings":";;;AAGA,MAAsB,aAAa;IAGvB,IAAI,CAAE,GAAG,MAAW;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAES,IAAI,CAAE,EAAU;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAES,MAAM,CAAE,SAAkB,EAAE,GAAG,MAAW;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAES,MAAM,CAAE,EAAU,EAAE,SAAkB;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAES,MAAM,CAAE,EAAU;QAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AAtBD,sCAsBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Document } from 'mongoose';
|
|
2
|
+
export declare abstract class AppEntity extends Document {
|
|
3
|
+
static $index: string;
|
|
4
|
+
readonly _id = "";
|
|
5
|
+
readonly createdAt?: Date;
|
|
6
|
+
readonly updatedAt?: Date;
|
|
7
|
+
readonly deletedAt?: Date;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=app.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.entity.d.ts","sourceRoot":"","sources":["../../src/abstract/app.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAyB,MAAM,UAAU,CAAC;AAE3D,8BAAsB,SAAU,SAAQ,QAAQ;IAC9C,OAAc,MAAM,EAAE,MAAM,CAAC;IAE7B,SAAyB,GAAG,MAAM;IAElC,SACgB,SAAS,CAAC,EAAE,IAAI,CAAQ;IAExC,SACgB,SAAS,CAAC,EAAE,IAAI,CAAQ;IAExC,SACgB,SAAS,CAAC,EAAE,IAAI,CAAQ;CACzC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppEntity = void 0;
|
|
4
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
5
|
+
const mongoose_2 = require("mongoose");
|
|
6
|
+
class AppEntity extends mongoose_2.Document {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this._id = '';
|
|
10
|
+
this.createdAt = null;
|
|
11
|
+
this.updatedAt = null;
|
|
12
|
+
this.deletedAt = null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
17
|
+
__metadata("design:type", Date)
|
|
18
|
+
], AppEntity.prototype, "createdAt", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
21
|
+
__metadata("design:type", Date)
|
|
22
|
+
], AppEntity.prototype, "updatedAt", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
25
|
+
__metadata("design:type", Date)
|
|
26
|
+
], AppEntity.prototype, "deletedAt", void 0);
|
|
27
|
+
exports.AppEntity = AppEntity;
|
|
28
|
+
//# sourceMappingURL=app.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../../src/abstract/app.entity.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uCAA2D;AAE3D,MAAsB,SAAU,SAAQ,mBAAQ;IAAhD;;QAG2B,QAAG,GAAG,EAAE,CAAC;QAGlB,cAAS,GAAU,IAAI,CAAC;QAGxB,cAAS,GAAU,IAAI,CAAC;QAGxB,cAAS,GAAU,IAAI,CAAC;IAC1C,CAAC;CAAA;AAPC;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;8BACX,IAAI;4CAAQ;AAGxC;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;8BACX,IAAI;4CAAQ;AAGxC;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;8BACX,IAAI;4CAAQ;AAZ1C,8BAaC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArgumentsHost, ExceptionFilter, HttpException, Logger } from '@nestjs/common';
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
export declare abstract class AppException implements ExceptionFilter {
|
|
4
|
+
protected request: Request;
|
|
5
|
+
protected response: Response;
|
|
6
|
+
protected host: ArgumentsHost;
|
|
7
|
+
protected logger: Logger;
|
|
8
|
+
catch(exception: HttpException, host: ArgumentsHost): Response<any, Record<string, any>>;
|
|
9
|
+
protected abstract handleError(exception: HttpException): HttpException;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app.exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.exception.d.ts","sourceRoot":"","sources":["../../src/abstract/app.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAgC,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,8BAAsB,YAAa,YAAW,eAAe;IAC3D,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,MAAM,SAAgB;IAEzB,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa;IAkC1D,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa;CACxE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class AppException {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.logger = new common_1.Logger();
|
|
8
|
+
}
|
|
9
|
+
catch(exception, host) {
|
|
10
|
+
this.host = host;
|
|
11
|
+
const ctx = this.host.switchToHttp();
|
|
12
|
+
this.response = ctx.getResponse();
|
|
13
|
+
this.request = ctx.getRequest();
|
|
14
|
+
this.logger.error(exception);
|
|
15
|
+
const handledError = this.handleError(exception);
|
|
16
|
+
if (handledError instanceof common_1.HttpException) {
|
|
17
|
+
const { message: trace } = exception.getResponse();
|
|
18
|
+
this.response.statusMessage = handledError.name
|
|
19
|
+
.slice(0, -9)
|
|
20
|
+
.replace(/([A-Z])/g, ' $1')
|
|
21
|
+
.trim();
|
|
22
|
+
return this.response
|
|
23
|
+
.status(handledError.getStatus())
|
|
24
|
+
.json({
|
|
25
|
+
statusCode: handledError.getStatus(),
|
|
26
|
+
message: handledError.message,
|
|
27
|
+
error: this.response.statusMessage,
|
|
28
|
+
trace: trace,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return this.response
|
|
32
|
+
.status(500)
|
|
33
|
+
.json(new common_1.InternalServerErrorException(handledError));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AppException = AppException;
|
|
37
|
+
//# sourceMappingURL=app.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.exception.js","sourceRoot":"","sources":["../../src/abstract/app.exception.ts"],"names":[],"mappings":";;;AAAA,2CAAqH;AAGrH,MAAsB,YAAY;IAAlC;QAIY,WAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAqClC,CAAC;IAnCQ,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAE7B,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEjD,IAAI,YAAY,YAAY,sBAAa,EAAE;YACzC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,WAAW,EAAS,CAAC;YAE1D,IAAI,CAAC,QAAQ,CAAC,aAAa,GAAG,YAAY,CAAC,IAAI;iBAC5C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBACZ,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;iBAC1B,IAAI,EAAE,CAAC;YAEV,OAAO,IAAI,CAAC,QAAQ;iBACjB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;iBAChC,IAAI,CAAC;gBACJ,UAAU,EAAE,YAAY,CAAC,SAAS,EAAE;gBACpC,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;gBAClC,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;SACN;QAED,OAAO,IAAI,CAAC,QAAQ;aACjB,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,IAAI,qCAA4B,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1D,CAAC;CAGF;AAzCD,oCAyCC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
import { Model, UpdateQuery } from 'mongoose';
|
|
3
|
+
import { DecodedUser } from '../decorators/user.decorator';
|
|
4
|
+
import { AppEntity } from '../configs/app.entity';
|
|
5
|
+
export declare abstract class AbstractRepository<E extends AppEntity> {
|
|
6
|
+
abstract readonly $model: Model<E>;
|
|
7
|
+
protected readonly $request: Request;
|
|
8
|
+
protected get $user(): DecodedUser | undefined;
|
|
9
|
+
find(...params: unknown[]): Promise<E[]>;
|
|
10
|
+
create(...params: any[]): Promise<E>;
|
|
11
|
+
read(id: string): Promise<E>;
|
|
12
|
+
update(id: string, ...params: unknown[]): Promise<E>;
|
|
13
|
+
delete(id: string): Promise<void>;
|
|
14
|
+
protected $find(): Promise<E[]>;
|
|
15
|
+
protected $read(id: string): Promise<E>;
|
|
16
|
+
protected $create(model: Partial<E>): Promise<E>;
|
|
17
|
+
protected $update(id: string, query: UpdateQuery<E>): Promise<E>;
|
|
18
|
+
protected $delete(id: string): Promise<void>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AC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractRepository = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const core_1 = require("@nestjs/core");
|
|
6
|
+
class AbstractRepository {
|
|
7
|
+
get $user() {
|
|
8
|
+
var _a;
|
|
9
|
+
return (_a = this.$request) === null || _a === void 0 ? void 0 : _a.user;
|
|
10
|
+
}
|
|
11
|
+
find(...params) {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
return this.$find();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
create(...params) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const entity = new this.$model();
|
|
19
|
+
const [validator] = params;
|
|
20
|
+
for (const key in validator) {
|
|
21
|
+
entity[key] = validator[key];
|
|
22
|
+
}
|
|
23
|
+
return this.$create(entity);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
read(id) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return this.$read(id);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
update(id, ...params) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const entity = yield this.$model.findById(id, params);
|
|
34
|
+
return this.$update(id, { $set: entity });
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
delete(id) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return this.$delete(id);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
$find() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return this.$model.find();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
$read(id) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
return this.$model.findById(id);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
$create(model) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return this.$model.create(model);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
$update(id, query) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return this.$model.findByIdAndUpdate(id, query);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
$delete(id) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return this.$model.findByIdAndDelete(id);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, common_1.Inject)(core_1.REQUEST),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], AbstractRepository.prototype, "$request", void 0);
|
|
72
|
+
exports.AbstractRepository = AbstractRepository;
|
|
73
|
+
//# sourceMappingURL=app.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.repository.js","sourceRoot":"","sources":["../../src/abstract/app.repository.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,uCAAuC;AAMvC,MAAsB,kBAAkB;IAMtC,IAAc,KAAK;;QACjB,OAAO,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC;IAC7B,CAAC;IAEY,IAAI,CAAC,GAAG,MAAiB;;YACpC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KAAA;IAEY,MAAM,CAAC,GAAG,MAAa;;YAClC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAEjC,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;YAE3B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;gBAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GA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.d.ts","sourceRoot":"","sources":["../../src/abstract/app.router.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IACpB,gBAAuB,IAAI,EAAE,MAAM,CAAC;IAEpC,gBAAuB,MAAM,EAAE,OAAO,SAAS,CAAC;IAEhD,gBAAuB,QAAQ,CAAC,QAAM;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.router.js","sourceRoot":"","sources":["../../src/abstract/app.router.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;;AAAtB,8BAMC;AADwB,kBAAQ,GAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractRepository } from '../abstract/abstract.repository';
|
|
2
|
+
import { AppEntity } from './app.entity';
|
|
3
|
+
export declare abstract class AppController<E extends AppEntity> {
|
|
4
|
+
protected abstract readonly $repository: AbstractRepository<E>;
|
|
5
|
+
protected find?(...params: any): Promise<E[]>;
|
|
6
|
+
protected read?(id: string): Promise<E>;
|
|
7
|
+
protected create?(validator: unknown, ...params: any): Promise<E>;
|
|
8
|
+
protected update?(id: string, validator: unknown): Promise<E>;
|
|
9
|
+
protected delete?(id: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.controller.d.ts","sourceRoot":"","sources":["../../src/configs/app.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,8BAAsB,aAAa,CAAC,CAAC,SAAS,SAAS;IACrD,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAE/D,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAI7C,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIvC,SAAS,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI7D,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppController = void 0;
|
|
4
|
+
class AppController {
|
|
5
|
+
find(...params) {
|
|
6
|
+
return this.$repository.find();
|
|
7
|
+
}
|
|
8
|
+
read(id) {
|
|
9
|
+
return this.$repository.read(id);
|
|
10
|
+
}
|
|
11
|
+
create(validator, ...params) {
|
|
12
|
+
return this.$repository.create(validator);
|
|
13
|
+
}
|
|
14
|
+
update(id, validator) {
|
|
15
|
+
return this.$repository.update(id, validator);
|
|
16
|
+
}
|
|
17
|
+
delete(id) {
|
|
18
|
+
return this.$repository.delete(id);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.AppController = AppController;
|
|
22
|
+
//# sourceMappingURL=app.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../../src/configs/app.controller.ts"],"names":[],"mappings":";;;AAGA,MAAsB,aAAa;IAGvB,IAAI,CAAE,GAAG,MAAW;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAES,IAAI,CAAE,EAAU;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAES,MAAM,CAAE,SAAkB,EAAE,GAAG,MAAW;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAES,MAAM,CAAE,EAAU,EAAE,SAAkB;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAES,MAAM,CAAE,EAAU;QAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AAtBD,sCAsBC"}
|
|
@@ -2,7 +2,8 @@ import { Document } from 'mongoose';
|
|
|
2
2
|
export declare abstract class AppEntity extends Document {
|
|
3
3
|
static $index: string;
|
|
4
4
|
readonly _id = "";
|
|
5
|
-
readonly createdAt
|
|
5
|
+
readonly createdAt?: Date;
|
|
6
6
|
readonly updatedAt?: Date;
|
|
7
7
|
readonly deletedAt?: Date;
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=app.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.entity.d.ts","sourceRoot":"","sources":["../../src/configs/app.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAyB,MAAM,UAAU,CAAC;AAE3D,8BAAsB,SAAU,SAAQ,QAAQ;IAC9C,OAAc,MAAM,EAAE,MAAM,CAAC;IAE7B,SAAyB,GAAG,MAAM;IAElC,SACgB,SAAS,CAAC,EAAE,IAAI,CAAQ;IAExC,SACgB,SAAS,CAAC,EAAE,IAAI,CAAQ;IAExC,SACgB,SAAS,CAAC,EAAE,IAAI,CAAQ;CACzC"}
|
|
@@ -1,27 +1,20 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AppEntity = void 0;
|
|
13
4
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
5
|
const mongoose_2 = require("mongoose");
|
|
15
6
|
class AppEntity extends mongoose_2.Document {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this._id = '';
|
|
10
|
+
this.createdAt = null;
|
|
11
|
+
this.updatedAt = null;
|
|
12
|
+
this.deletedAt = null;
|
|
13
|
+
}
|
|
21
14
|
}
|
|
22
15
|
__decorate([
|
|
23
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date
|
|
24
|
-
__metadata("design:type",
|
|
16
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
17
|
+
__metadata("design:type", Date)
|
|
25
18
|
], AppEntity.prototype, "createdAt", void 0);
|
|
26
19
|
__decorate([
|
|
27
20
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
@@ -32,3 +25,4 @@ __decorate([
|
|
|
32
25
|
__metadata("design:type", Date)
|
|
33
26
|
], AppEntity.prototype, "deletedAt", void 0);
|
|
34
27
|
exports.AppEntity = AppEntity;
|
|
28
|
+
//# sourceMappingURL=app.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../../src/configs/app.entity.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uCAA2D;AAE3D,MAAsB,SAAU,SAAQ,mBAAQ;IAAhD;;QAG2B,QAAG,GAAG,EAAE,CAAC;QAGlB,cAAS,GAAU,IAAI,CAAC;QAGxB,cAAS,GAAU,IAAI,CAAC;QAGxB,cAAS,GAAU,IAAI,CAAC;IAC1C,CAAC;CAAA;AAPC;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;8BACX,IAAI;4CAAQ;AAGxC;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;8BACX,IAAI;4CAAQ;AAGxC;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;8BACX,IAAI;4CAAQ;AAZ1C,8BAaC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArgumentsHost, ExceptionFilter, HttpException, Logger } from '@nestjs/common';
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
export declare abstract class AppException implements ExceptionFilter {
|
|
4
|
+
protected request: Request;
|
|
5
|
+
protected response: Response;
|
|
6
|
+
protected host: ArgumentsHost;
|
|
7
|
+
protected logger: Logger;
|
|
8
|
+
catch(exception: HttpException, host: ArgumentsHost): Response<any, Record<string, any>>;
|
|
9
|
+
protected abstract handleError(exception: HttpException): HttpException;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app.exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.exception.d.ts","sourceRoot":"","sources":["../../src/configs/app.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAgC,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,8BAAsB,YAAa,YAAW,eAAe;IAC3D,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,MAAM,SAAgB;IAEzB,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa;IAkC1D,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa;CACxE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class AppException {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.logger = new common_1.Logger();
|
|
8
|
+
}
|
|
9
|
+
catch(exception, host) {
|
|
10
|
+
this.host = host;
|
|
11
|
+
const ctx = this.host.switchToHttp();
|
|
12
|
+
this.response = ctx.getResponse();
|
|
13
|
+
this.request = ctx.getRequest();
|
|
14
|
+
this.logger.error(exception);
|
|
15
|
+
const handledError = this.handleError(exception);
|
|
16
|
+
if (handledError instanceof common_1.HttpException) {
|
|
17
|
+
const { message: trace } = exception.getResponse();
|
|
18
|
+
this.response.statusMessage = handledError.name
|
|
19
|
+
.slice(0, -9)
|
|
20
|
+
.replace(/([A-Z])/g, ' $1')
|
|
21
|
+
.trim();
|
|
22
|
+
return this.response
|
|
23
|
+
.status(handledError.getStatus())
|
|
24
|
+
.json({
|
|
25
|
+
statusCode: handledError.getStatus(),
|
|
26
|
+
message: handledError.message,
|
|
27
|
+
error: this.response.statusMessage,
|
|
28
|
+
trace: trace,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return this.response
|
|
32
|
+
.status(500)
|
|
33
|
+
.json(new common_1.InternalServerErrorException(handledError));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AppException = AppException;
|
|
37
|
+
//# sourceMappingURL=app.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.exception.js","sourceRoot":"","sources":["../../src/configs/app.exception.ts"],"names":[],"mappings":";;;AAAA,2CAAqH;AAGrH,MAAsB,YAAY;IAAlC;QAIY,WAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAqClC,CAAC;IAnCQ,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAE7B,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEjD,IAAI,YAAY,YAAY,sBAAa,EAAE;YACzC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,WAAW,EAAS,CAAC;YAE1D,IAAI,CAAC,QAAQ,CAAC,aAAa,GAAG,YAAY,CAAC,IAAI;iBAC5C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBACZ,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;iBAC1B,IAAI,EAAE,CAAC;YAEV,OAAO,IAAI,CAAC,QAAQ;iBACjB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;iBAChC,IAAI,CAAC;gBACJ,UAAU,EAAE,YAAY,CAAC,SAAS,EAAE;gBACpC,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;gBAClC,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;SACN;QAED,OAAO,IAAI,CAAC,QAAQ;aACjB,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,IAAI,qCAA4B,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1D,CAAC;CAGF;AAzCD,oCAyCC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
import { Model, UpdateQuery } from 'mongoose';
|
|
3
|
+
import { DecodedUser } from '../decorators/user.decorator';
|
|
4
|
+
import { AppEntity } from './app.entity';
|
|
5
|
+
export declare abstract class AppRepository<E extends AppEntity> {
|
|
6
|
+
abstract readonly $model: Model<E>;
|
|
7
|
+
protected readonly $request: Request;
|
|
8
|
+
protected get $user(): DecodedUser | undefined;
|
|
9
|
+
find(...params: unknown[]): Promise<E[]>;
|
|
10
|
+
create(...params: any[]): Promise<E>;
|
|
11
|
+
read(id: string): Promise<E>;
|
|
12
|
+
update(id: string, ...params: unknown[]): Promise<E>;
|
|
13
|
+
delete(id: string): Promise<void>;
|
|
14
|
+
protected $find(): Promise<E[]>;
|
|
15
|
+
protected $read(id: string): Promise<E>;
|
|
16
|
+
protected $create(model: Partial<E>): Promise<E>;
|
|
17
|
+
protected $update(id: string, query: UpdateQuery<E>): Promise<E>;
|
|
18
|
+
protected $delete(id: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=app.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.repository.d.ts","sourceRoot":"","sources":["../../src/configs/app.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC9C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