@tc-libs/setting 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/package.json +29 -0
- package/src/constants/index.d.ts +3 -0
- package/src/constants/index.js +7 -0
- package/src/constants/index.js.map +1 -0
- package/src/constants/setting.doc.constant.d.ts +14 -0
- package/src/constants/setting.doc.constant.js +22 -0
- package/src/constants/setting.doc.constant.js.map +1 -0
- package/src/constants/setting.enum.constant.d.ts +9 -0
- package/src/constants/setting.enum.constant.js +14 -0
- package/src/constants/setting.enum.constant.js.map +1 -0
- package/src/constants/setting.list.constant.d.ts +6 -0
- package/src/constants/setting.list.constant.js +10 -0
- package/src/constants/setting.list.constant.js.map +1 -0
- package/src/constants/setting.permissions.constants.d.ts +2 -0
- package/src/constants/setting.permissions.constants.js +9 -0
- package/src/constants/setting.permissions.constants.js.map +1 -0
- package/src/controllers/index.d.ts +2 -0
- package/src/controllers/index.js +6 -0
- package/src/controllers/index.js.map +1 -0
- package/src/controllers/setting.admin.controller.d.ts +13 -0
- package/src/controllers/setting.admin.controller.js +107 -0
- package/src/controllers/setting.admin.controller.js.map +1 -0
- package/src/controllers/setting.controller.d.ts +7 -0
- package/src/controllers/setting.controller.js +36 -0
- package/src/controllers/setting.controller.js.map +1 -0
- package/src/decorators/setting.admin.decorator.d.ts +1 -0
- package/src/decorators/setting.admin.decorator.js +10 -0
- package/src/decorators/setting.admin.decorator.js.map +1 -0
- package/src/decorators/setting.decorator.d.ts +3 -0
- package/src/decorators/setting.decorator.js +19 -0
- package/src/decorators/setting.decorator.js.map +1 -0
- package/src/docs/index.d.ts +2 -0
- package/src/docs/index.js +6 -0
- package/src/docs/index.js.map +1 -0
- package/src/docs/setting.admin.doc.d.ts +1 -0
- package/src/docs/setting.admin.doc.js +19 -0
- package/src/docs/setting.admin.doc.js.map +1 -0
- package/src/docs/setting.doc.d.ts +3 -0
- package/src/docs/setting.doc.js +45 -0
- package/src/docs/setting.doc.js.map +1 -0
- package/src/dtos/index.d.ts +3 -0
- package/src/dtos/index.js +7 -0
- package/src/dtos/index.js.map +1 -0
- package/src/dtos/setting.create.dto.d.ts +7 -0
- package/src/dtos/setting.create.dto.js +58 -0
- package/src/dtos/setting.create.dto.js.map +1 -0
- package/src/dtos/setting.request.dto.d.ts +3 -0
- package/src/dtos/setting.request.dto.js +23 -0
- package/src/dtos/setting.request.dto.js.map +1 -0
- package/src/dtos/setting.update-value.dto.d.ts +5 -0
- package/src/dtos/setting.update-value.dto.js +11 -0
- package/src/dtos/setting.update-value.dto.js.map +1 -0
- package/src/errors/400/api.400.setting.error.d.ts +7 -0
- package/src/errors/400/api.400.setting.error.js +11 -0
- package/src/errors/400/api.400.setting.error.js.map +1 -0
- package/src/errors/400/index.d.ts +1 -0
- package/src/errors/400/index.js +5 -0
- package/src/errors/400/index.js.map +1 -0
- package/src/errors/index.d.ts +1 -0
- package/src/errors/index.js +5 -0
- package/src/errors/index.js.map +1 -0
- package/src/guards/setting.not-found.guard.d.ts +4 -0
- package/src/guards/setting.not-found.guard.js +20 -0
- package/src/guards/setting.not-found.guard.js.map +1 -0
- package/src/guards/setting.put-to-request.guard.d.ts +12 -0
- package/src/guards/setting.put-to-request.guard.js +43 -0
- package/src/guards/setting.put-to-request.guard.js.map +1 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +11 -0
- package/src/index.js.map +1 -0
- package/src/middleware/maintenance/setting.maintenance.middleware.d.ts +9 -0
- package/src/middleware/maintenance/setting.maintenance.middleware.js +25 -0
- package/src/middleware/maintenance/setting.maintenance.middleware.js.map +1 -0
- package/src/middleware/setting.middleware.module.d.ts +4 -0
- package/src/middleware/setting.middleware.module.js +55 -0
- package/src/middleware/setting.middleware.module.js.map +1 -0
- package/src/repository/entities/setting.entity.d.ts +21 -0
- package/src/repository/entities/setting.entity.js +62 -0
- package/src/repository/entities/setting.entity.js.map +1 -0
- package/src/repository/index.d.ts +3 -0
- package/src/repository/index.js +7 -0
- package/src/repository/index.js.map +1 -0
- package/src/repository/repositories/setting.repository.d.ts +11 -0
- package/src/repository/repositories/setting.repository.js +28 -0
- package/src/repository/repositories/setting.repository.js.map +1 -0
- package/src/repository/setting.repository.module.d.ts +2 -0
- package/src/repository/setting.repository.module.js +27 -0
- package/src/repository/setting.repository.module.js.map +1 -0
- package/src/serializations/index.d.ts +2 -0
- package/src/serializations/index.js +6 -0
- package/src/serializations/index.js.map +1 -0
- package/src/serializations/setting.get.serialization.d.ts +10 -0
- package/src/serializations/setting.get.serialization.js +85 -0
- package/src/serializations/setting.get.serialization.js.map +1 -0
- package/src/serializations/setting.list.serialization.d.ts +3 -0
- package/src/serializations/setting.list.serialization.js +8 -0
- package/src/serializations/setting.list.serialization.js.map +1 -0
- package/src/services/index.d.ts +1 -0
- package/src/services/index.js +5 -0
- package/src/services/index.js.map +1 -0
- package/src/services/setting.abstract.service.d.ts +30 -0
- package/src/services/setting.abstract.service.js +115 -0
- package/src/services/setting.abstract.service.js.map +1 -0
- package/src/setting.module.d.ts +2 -0
- package/src/setting.module.js +21 -0
- package/src/setting.module.js.map +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingRequestDto = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const class_validator_1 = require("class-validator");
|
|
8
|
+
class SettingRequestDto {
|
|
9
|
+
}
|
|
10
|
+
exports.SettingRequestDto = SettingRequestDto;
|
|
11
|
+
tslib_1.__decorate([
|
|
12
|
+
(0, swagger_1.ApiProperty)({
|
|
13
|
+
name: 'setting',
|
|
14
|
+
description: 'setting id',
|
|
15
|
+
required: true,
|
|
16
|
+
nullable: false,
|
|
17
|
+
}),
|
|
18
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
19
|
+
(0, class_validator_1.IsMongoId)(),
|
|
20
|
+
(0, class_transformer_1.Type)(() => String),
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
|
+
], SettingRequestDto.prototype, "setting", void 0);
|
|
23
|
+
//# sourceMappingURL=setting.request.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.request.dto.js","sourceRoot":"","sources":["../../../../../packages/setting/src/dtos/setting.request.dto.ts"],"names":[],"mappings":";;;;AAAA,6CAA8C;AAC9C,yDAAyC;AACzC,qDAAwD;AAExD,MAAa,iBAAiB;CAW7B;AAXD,8CAWC;AADC;IATC,IAAA,qBAAW,EAAC;QACX,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;kDACH"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingUpdateValueDto = void 0;
|
|
4
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
+
const setting_create_dto_1 = require("./setting.create.dto");
|
|
6
|
+
class SettingUpdateValueDto extends (0, swagger_1.OmitType)(setting_create_dto_1.SettingCreateDto, [
|
|
7
|
+
'name',
|
|
8
|
+
]) {
|
|
9
|
+
}
|
|
10
|
+
exports.SettingUpdateValueDto = SettingUpdateValueDto;
|
|
11
|
+
//# sourceMappingURL=setting.update-value.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.update-value.dto.js","sourceRoot":"","sources":["../../../../../packages/setting/src/dtos/setting.update-value.dto.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,6DAAwD;AAExD,MAAa,qBAAsB,SAAQ,IAAA,kBAAQ,EAAC,qCAAgB,EAAE;IACpE,MAAM;CACE,CAAC;CAAG;AAFd,sDAEc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Api400SettingValueNotAllowedError = void 0;
|
|
4
|
+
const errors_1 = require("@tc-libs/errors");
|
|
5
|
+
class Api400SettingValueNotAllowedError extends errors_1.Api400Error {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super('error.400.setting_value_not_allowed', `Setting value [${data.value}] is not allowed`, data);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.Api400SettingValueNotAllowedError = Api400SettingValueNotAllowedError;
|
|
11
|
+
//# sourceMappingURL=api.400.setting.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.400.setting.error.js","sourceRoot":"","sources":["../../../../../../packages/setting/src/errors/400/api.400.setting.error.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAG9C,MAAa,iCAAkC,SAAQ,oBAAW;IAChE,YAAY,IAAsC;QAChD,KAAK,CACH,qCAAqC,EACrC,kBAAkB,IAAI,CAAC,KAAK,kBAAkB,EAC9C,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AARD,8EAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api.400.setting.error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/setting/src/errors/400/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './400';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/setting/src/errors/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingNotFoundGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const errors_1 = require("@tc-libs/errors");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const repository_1 = require("../repository");
|
|
8
|
+
let SettingNotFoundGuard = class SettingNotFoundGuard {
|
|
9
|
+
async canActivate(context) {
|
|
10
|
+
const { __setting } = context.switchToHttp().getRequest();
|
|
11
|
+
if (!__setting)
|
|
12
|
+
throw new errors_1.Api404EntityNotFoundError({ entity: repository_1.SettingEntity.name });
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
exports.SettingNotFoundGuard = SettingNotFoundGuard;
|
|
17
|
+
exports.SettingNotFoundGuard = SettingNotFoundGuard = tslib_1.__decorate([
|
|
18
|
+
(0, common_1.Injectable)()
|
|
19
|
+
], SettingNotFoundGuard);
|
|
20
|
+
//# sourceMappingURL=setting.not-found.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.not-found.guard.js","sourceRoot":"","sources":["../../../../../packages/setting/src/guards/setting.not-found.guard.ts"],"names":[],"mappings":";;;;AAAA,4CAA4D;AAC5D,2CAA2E;AAC3E,8CAA8C;AAGvC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAE1D,IAAI,CAAC,SAAS;YACZ,MAAM,IAAI,kCAAyB,CAAC,EAAE,MAAM,EAAE,0BAAa,CAAC,IAAI,EAAE,CAAC,CAAC;QAEtE,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AATY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CAShC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { BaseSettingService } from '../services/setting.abstract.service';
|
|
3
|
+
export declare class SettingPutToRequestGuard implements CanActivate {
|
|
4
|
+
private readonly settingService;
|
|
5
|
+
constructor(settingService: BaseSettingService);
|
|
6
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare class SettingPutToRequestByNameGuard implements CanActivate {
|
|
9
|
+
private readonly settingService;
|
|
10
|
+
constructor(settingService: BaseSettingService);
|
|
11
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingPutToRequestByNameGuard = exports.SettingPutToRequestGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const setting_abstract_service_1 = require("../services/setting.abstract.service");
|
|
7
|
+
let SettingPutToRequestGuard = class SettingPutToRequestGuard {
|
|
8
|
+
constructor(settingService) {
|
|
9
|
+
this.settingService = settingService;
|
|
10
|
+
}
|
|
11
|
+
async canActivate(context) {
|
|
12
|
+
const request = context.switchToHttp().getRequest();
|
|
13
|
+
const { params } = request;
|
|
14
|
+
const { setting } = params;
|
|
15
|
+
const check = await this.settingService.findById(setting);
|
|
16
|
+
request.__setting = check;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.SettingPutToRequestGuard = SettingPutToRequestGuard;
|
|
21
|
+
exports.SettingPutToRequestGuard = SettingPutToRequestGuard = tslib_1.__decorate([
|
|
22
|
+
(0, common_1.Injectable)(),
|
|
23
|
+
tslib_1.__metadata("design:paramtypes", [setting_abstract_service_1.BaseSettingService])
|
|
24
|
+
], SettingPutToRequestGuard);
|
|
25
|
+
let SettingPutToRequestByNameGuard = class SettingPutToRequestByNameGuard {
|
|
26
|
+
constructor(settingService) {
|
|
27
|
+
this.settingService = settingService;
|
|
28
|
+
}
|
|
29
|
+
async canActivate(context) {
|
|
30
|
+
const request = context.switchToHttp().getRequest();
|
|
31
|
+
const { params } = request;
|
|
32
|
+
const { settingName } = params;
|
|
33
|
+
const check = await this.settingService.findOneByName(settingName);
|
|
34
|
+
request.__setting = check;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.SettingPutToRequestByNameGuard = SettingPutToRequestByNameGuard;
|
|
39
|
+
exports.SettingPutToRequestByNameGuard = SettingPutToRequestByNameGuard = tslib_1.__decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
tslib_1.__metadata("design:paramtypes", [setting_abstract_service_1.BaseSettingService])
|
|
42
|
+
], SettingPutToRequestByNameGuard);
|
|
43
|
+
//# sourceMappingURL=setting.put-to-request.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.put-to-request.guard.js","sourceRoot":"","sources":["../../../../../packages/setting/src/guards/setting.put-to-request.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAA2E;AAC3E,mFAA0E;AAInE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAA6B,cAAkC;QAAlC,mBAAc,GAAd,cAAc,CAAoB;IAAG,CAAC;IACnE,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAC3B,MAAM,KAAK,GAAe,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAVY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;6CAEkC,6CAAkB;GADpD,wBAAwB,CAUpC;AAGM,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACzC,YAA6B,cAAkC;QAAlC,mBAAc,GAAd,cAAc,CAAoB;IAAG,CAAC;IACnE,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;QAC/B,MAAM,KAAK,GACT,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACvD,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAXY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;6CAEkC,6CAAkB;GADpD,8BAA8B,CAW1C"}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./dtos"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./repository"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./serializations"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./services"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./setting.module"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./controllers"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/setting/src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,iDAAuB;AACvB,uDAA6B;AAC7B,2DAAiC;AACjC,qDAA2B;AAC3B,2DAAiC;AACjC,wDAA8B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IRequestApp } from '@tc-libs/request';
|
|
2
|
+
import { NestMiddleware } from '@nestjs/common';
|
|
3
|
+
import { NextFunction, Response } from 'express';
|
|
4
|
+
import { BaseSettingService } from '../../services/setting.abstract.service';
|
|
5
|
+
export declare class SettingMaintenanceMiddleware implements NestMiddleware {
|
|
6
|
+
private readonly settingService;
|
|
7
|
+
constructor(settingService: BaseSettingService);
|
|
8
|
+
use(req: IRequestApp, res: Response, next: NextFunction): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingMaintenanceMiddleware = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const errors_1 = require("@tc-libs/errors");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const setting_abstract_service_1 = require("../../services/setting.abstract.service");
|
|
8
|
+
let SettingMaintenanceMiddleware = class SettingMaintenanceMiddleware {
|
|
9
|
+
constructor(settingService) {
|
|
10
|
+
this.settingService = settingService;
|
|
11
|
+
}
|
|
12
|
+
async use(req, res, next) {
|
|
13
|
+
const maintenance = await this.settingService.getMaintenance();
|
|
14
|
+
if (maintenance) {
|
|
15
|
+
throw new errors_1.Api503ServiceUnavailableError(false);
|
|
16
|
+
}
|
|
17
|
+
next();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.SettingMaintenanceMiddleware = SettingMaintenanceMiddleware;
|
|
21
|
+
exports.SettingMaintenanceMiddleware = SettingMaintenanceMiddleware = tslib_1.__decorate([
|
|
22
|
+
(0, common_1.Injectable)(),
|
|
23
|
+
tslib_1.__metadata("design:paramtypes", [setting_abstract_service_1.BaseSettingService])
|
|
24
|
+
], SettingMaintenanceMiddleware);
|
|
25
|
+
//# sourceMappingURL=setting.maintenance.middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.maintenance.middleware.js","sourceRoot":"","sources":["../../../../../../packages/setting/src/middleware/maintenance/setting.maintenance.middleware.ts"],"names":[],"mappings":";;;;AAAA,4CAAgE;AAEhE,2CAA4D;AAE5D,sFAA6E;AAGtE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAA6B,cAAkC;QAAlC,mBAAc,GAAd,cAAc,CAAoB;IAAG,CAAC;IAEnE,KAAK,CAAC,GAAG,CACP,GAAgB,EAChB,GAAa,EACb,IAAkB;QAElB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC;QAC/D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,IAAI,sCAA6B,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,EAAE,CAAC;IACT,CAAC;CACF,CAAA;AAfY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;6CAEkC,6CAAkB;GADpD,4BAA4B,CAexC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingMiddlewareModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const setting_maintenance_middleware_1 = require("./maintenance/setting.maintenance.middleware");
|
|
7
|
+
let SettingMiddlewareModule = class SettingMiddlewareModule {
|
|
8
|
+
configure(consumer) {
|
|
9
|
+
consumer
|
|
10
|
+
.apply(setting_maintenance_middleware_1.SettingMaintenanceMiddleware)
|
|
11
|
+
.exclude(
|
|
12
|
+
// {
|
|
13
|
+
// path: 'api/v:version*/user/login',
|
|
14
|
+
// method: RequestMethod.POST,
|
|
15
|
+
// },
|
|
16
|
+
{
|
|
17
|
+
path: 'user/(.*)',
|
|
18
|
+
method: common_1.RequestMethod.POST,
|
|
19
|
+
},
|
|
20
|
+
// {
|
|
21
|
+
// path: 'api/v:version*/user/refresh',
|
|
22
|
+
// method: RequestMethod.POST,
|
|
23
|
+
// },
|
|
24
|
+
// {
|
|
25
|
+
// path: 'api/user/refresh',
|
|
26
|
+
// method: RequestMethod.POST,
|
|
27
|
+
// },
|
|
28
|
+
// {
|
|
29
|
+
// path: 'api/v:version*/admin/setting/(.*)',
|
|
30
|
+
// method: RequestMethod.ALL,
|
|
31
|
+
// },
|
|
32
|
+
// {
|
|
33
|
+
// path: 'api/admin/setting/(.*)',
|
|
34
|
+
// method: RequestMethod.ALL,
|
|
35
|
+
// },
|
|
36
|
+
// {
|
|
37
|
+
// path: 'api/v:version*/setting/(.*)',
|
|
38
|
+
// method: RequestMethod.ALL,
|
|
39
|
+
// },
|
|
40
|
+
// {
|
|
41
|
+
// path: 'api/setting/(.*)',
|
|
42
|
+
// method: RequestMethod.ALL,
|
|
43
|
+
// },
|
|
44
|
+
{
|
|
45
|
+
path: 'admin/(.*)',
|
|
46
|
+
method: common_1.RequestMethod.ALL,
|
|
47
|
+
})
|
|
48
|
+
.forRoutes('*');
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.SettingMiddlewareModule = SettingMiddlewareModule;
|
|
52
|
+
exports.SettingMiddlewareModule = SettingMiddlewareModule = tslib_1.__decorate([
|
|
53
|
+
(0, common_1.Module)({})
|
|
54
|
+
], SettingMiddlewareModule);
|
|
55
|
+
//# sourceMappingURL=setting.middleware.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.middleware.module.js","sourceRoot":"","sources":["../../../../../packages/setting/src/middleware/setting.middleware.module.ts"],"names":[],"mappings":";;;;AAAA,2CAKwB;AACxB,iGAA4F;AAGrF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,SAAS,CAAC,QAA4B;QACpC,QAAQ;aACL,KAAK,CAAC,6DAA4B,CAAC;aACnC,OAAO;QACN,IAAI;QACJ,uCAAuC;QACvC,gCAAgC;QAChC,KAAK;QACL;YACE,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,sBAAa,CAAC,IAAI;SAC3B;QACD,IAAI;QACJ,yCAAyC;QACzC,gCAAgC;QAChC,KAAK;QACL,IAAI;QACJ,8BAA8B;QAC9B,gCAAgC;QAChC,KAAK;QACL,IAAI;QACJ,+CAA+C;QAC/C,+BAA+B;QAC/B,KAAK;QACL,IAAI;QACJ,oCAAoC;QACpC,+BAA+B;QAC/B,KAAK;QACL,IAAI;QACJ,yCAAyC;QACzC,+BAA+B;QAC/B,KAAK;QACL,IAAI;QACJ,8BAA8B;QAC9B,+BAA+B;QAC/B,KAAK;QACL;YACE,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,sBAAa,CAAC,GAAG;SAC1B,CACF;aACA,SAAS,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;CACF,CAAA;AA5CY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,uBAAuB,CA4CnC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DatabaseMongoEntityAbstract } from '@tc-libs/database';
|
|
2
|
+
import { Document } from 'mongoose';
|
|
3
|
+
import { ENUM_SETTING_DATA_TYPE } from '../../constants/setting.enum.constant';
|
|
4
|
+
export declare class SettingEntity extends DatabaseMongoEntityAbstract {
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
type: ENUM_SETTING_DATA_TYPE;
|
|
8
|
+
value: any;
|
|
9
|
+
public?: boolean;
|
|
10
|
+
admin?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const SettingSchema: import("mongoose").Schema<SettingEntity, import("mongoose").Model<SettingEntity, any, any, any, Document<unknown, any, SettingEntity> & SettingEntity & Required<{
|
|
13
|
+
_id: import("mongoose").Types.ObjectId;
|
|
14
|
+
}> & {
|
|
15
|
+
__v: number;
|
|
16
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, SettingEntity, Document<unknown, {}, import("mongoose").FlatRecord<SettingEntity>> & import("mongoose").FlatRecord<SettingEntity> & Required<{
|
|
17
|
+
_id: import("mongoose").Types.ObjectId;
|
|
18
|
+
}> & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}>;
|
|
21
|
+
export type SettingDoc = SettingEntity & Document;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingSchema = exports.SettingEntity = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
6
|
+
const database_1 = require("@tc-libs/database");
|
|
7
|
+
const mongoose_2 = require("mongoose");
|
|
8
|
+
const setting_enum_constant_1 = require("../../constants/setting.enum.constant");
|
|
9
|
+
let SettingEntity = class SettingEntity extends database_1.DatabaseMongoEntityAbstract {
|
|
10
|
+
};
|
|
11
|
+
exports.SettingEntity = SettingEntity;
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, mongoose_1.Prop)({
|
|
14
|
+
required: true,
|
|
15
|
+
index: true,
|
|
16
|
+
unique: true,
|
|
17
|
+
trim: true,
|
|
18
|
+
type: String,
|
|
19
|
+
}),
|
|
20
|
+
tslib_1.__metadata("design:type", String)
|
|
21
|
+
], SettingEntity.prototype, "name", void 0);
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({
|
|
24
|
+
required: false,
|
|
25
|
+
type: String,
|
|
26
|
+
}),
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
28
|
+
], SettingEntity.prototype, "description", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({
|
|
31
|
+
required: false,
|
|
32
|
+
type: String,
|
|
33
|
+
enum: setting_enum_constant_1.ENUM_SETTING_DATA_TYPE,
|
|
34
|
+
}),
|
|
35
|
+
tslib_1.__metadata("design:type", String)
|
|
36
|
+
], SettingEntity.prototype, "type", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)({
|
|
39
|
+
required: true,
|
|
40
|
+
type: mongoose_2.SchemaTypes.Mixed,
|
|
41
|
+
}),
|
|
42
|
+
tslib_1.__metadata("design:type", Object)
|
|
43
|
+
], SettingEntity.prototype, "value", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, mongoose_1.Prop)({
|
|
46
|
+
required: false,
|
|
47
|
+
default: false,
|
|
48
|
+
}),
|
|
49
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
50
|
+
], SettingEntity.prototype, "public", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, mongoose_1.Prop)({
|
|
53
|
+
required: false,
|
|
54
|
+
default: true,
|
|
55
|
+
}),
|
|
56
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
57
|
+
], SettingEntity.prototype, "admin", void 0);
|
|
58
|
+
exports.SettingEntity = SettingEntity = tslib_1.__decorate([
|
|
59
|
+
(0, database_1.DatabaseEntity)({ collection: 'settings' })
|
|
60
|
+
], SettingEntity);
|
|
61
|
+
exports.SettingSchema = mongoose_1.SchemaFactory.createForClass(SettingEntity);
|
|
62
|
+
//# sourceMappingURL=setting.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.entity.js","sourceRoot":"","sources":["../../../../../../packages/setting/src/repository/entities/setting.entity.ts"],"names":[],"mappings":";;;;AAAA,+CAAuD;AACvD,gDAAgF;AAEhF,uCAAiD;AACjD,iFAA+E;AAGxE,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,sCAA2B;CAwC7D,CAAA;AAxCY,sCAAa;AAQxB;IAPC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,MAAM;KACb,CAAC;;2CACW;AAMb;IAJC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;KACb,CAAC;;kDACmB;AAOrB;IALC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,8CAAsB;KAC7B,CAAC;;2CAC2B;AAM7B;IAJC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,sBAAW,CAAC,KAAK;KACxB,CAAC;;4CACS;AAMX;IAJC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;KACf,CAAC;;6CACe;AAMjB;IAJC,IAAA,eAAI,EAAC;QACJ,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;KACd,CAAC;;4CACc;wBAvCL,aAAa;IADzB,IAAA,yBAAc,EAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;GAC9B,aAAa,CAwCzB;AAEY,QAAA,aAAa,GAAG,wBAAa,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./setting.repository.module"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./entities/setting.entity"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./repositories/setting.repository"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/setting/src/repository/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,oEAA0C;AAC1C,4EAAkD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { AppCacheService } from '@tc-libs/app-cache';
|
|
3
|
+
import { DatabaseMongoRepositoryAbstract } from '@tc-libs/database';
|
|
4
|
+
import { Connection, Model } from 'mongoose';
|
|
5
|
+
import { SettingDoc, SettingEntity } from '../entities/setting.entity';
|
|
6
|
+
export declare class SettingRepository extends DatabaseMongoRepositoryAbstract<SettingEntity, SettingDoc> {
|
|
7
|
+
protected readonly settingModel: Model<SettingEntity>;
|
|
8
|
+
protected readonly connection: Connection;
|
|
9
|
+
protected readonly _logger: Logger;
|
|
10
|
+
constructor(settingModel: Model<SettingEntity>, connection: Connection, _cache: AppCacheService);
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var SettingRepository_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SettingRepository = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const app_cache_1 = require("@tc-libs/app-cache");
|
|
8
|
+
const database_1 = require("@tc-libs/database");
|
|
9
|
+
const mongoose_1 = require("mongoose");
|
|
10
|
+
const setting_entity_1 = require("../entities/setting.entity");
|
|
11
|
+
let SettingRepository = SettingRepository_1 = class SettingRepository extends database_1.DatabaseMongoRepositoryAbstract {
|
|
12
|
+
constructor(settingModel, connection, _cache) {
|
|
13
|
+
super(settingModel, connection, _cache);
|
|
14
|
+
this.settingModel = settingModel;
|
|
15
|
+
this.connection = connection;
|
|
16
|
+
this._logger = new common_1.Logger(SettingRepository_1.name);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.SettingRepository = SettingRepository;
|
|
20
|
+
exports.SettingRepository = SettingRepository = SettingRepository_1 = tslib_1.__decorate([
|
|
21
|
+
(0, common_1.Injectable)(),
|
|
22
|
+
tslib_1.__param(0, (0, database_1.DatabaseModel)(setting_entity_1.SettingEntity.name)),
|
|
23
|
+
tslib_1.__param(1, (0, database_1.DatabaseConnection)()),
|
|
24
|
+
tslib_1.__metadata("design:paramtypes", [mongoose_1.Model,
|
|
25
|
+
mongoose_1.Connection,
|
|
26
|
+
app_cache_1.AppCacheService])
|
|
27
|
+
], SettingRepository);
|
|
28
|
+
//# sourceMappingURL=setting.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.repository.js","sourceRoot":"","sources":["../../../../../../packages/setting/src/repository/repositories/setting.repository.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,kDAAqD;AACrD,gDAI2B;AAC3B,uCAA6C;AAC7C,+DAAuE;AAGhE,IAAM,iBAAiB,yBAAvB,MAAM,iBAAkB,SAAQ,0CAGtC;IAEC,YAEE,YAAqD,EAErD,UAAyC,EACzC,MAAuB;QAEvB,KAAK,CAAC,YAAY,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QALrB,iBAAY,GAAZ,YAAY,CAAsB;QAElC,eAAU,GAAV,UAAU,CAAY;QALxB,YAAO,GAAW,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IASxE,CAAC;CACF,CAAA;AAdY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAOR,mBAAA,IAAA,wBAAa,EAAC,8BAAa,CAAC,IAAI,CAAC,CAAA;IAEjC,mBAAA,IAAA,6BAAkB,GAAE,CAAA;6CADY,gBAAK;QAEP,qBAAU;QACjC,2BAAe;GAVd,iBAAiB,CAc7B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingRepositoryModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
7
|
+
const setting_entity_1 = require("./entities/setting.entity");
|
|
8
|
+
const setting_repository_1 = require("./repositories/setting.repository");
|
|
9
|
+
let SettingRepositoryModule = class SettingRepositoryModule {
|
|
10
|
+
};
|
|
11
|
+
exports.SettingRepositoryModule = SettingRepositoryModule;
|
|
12
|
+
exports.SettingRepositoryModule = SettingRepositoryModule = tslib_1.__decorate([
|
|
13
|
+
(0, common_1.Module)({
|
|
14
|
+
providers: [setting_repository_1.SettingRepository],
|
|
15
|
+
exports: [setting_repository_1.SettingRepository],
|
|
16
|
+
controllers: [],
|
|
17
|
+
imports: [
|
|
18
|
+
mongoose_1.MongooseModule.forFeature([
|
|
19
|
+
{
|
|
20
|
+
name: setting_entity_1.SettingEntity.name,
|
|
21
|
+
schema: setting_entity_1.SettingSchema,
|
|
22
|
+
},
|
|
23
|
+
]),
|
|
24
|
+
],
|
|
25
|
+
})
|
|
26
|
+
], SettingRepositoryModule);
|
|
27
|
+
//# sourceMappingURL=setting.repository.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting.repository.module.js","sourceRoot":"","sources":["../../../../../packages/setting/src/repository/setting.repository.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,+CAAkD;AAClD,8DAAyE;AACzE,0EAAsE;AAe/D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAAG,CAAA;AAA1B,0DAAuB;kCAAvB,uBAAuB;IAbnC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,sCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,sCAAiB,CAAC;QAC5B,WAAW,EAAE,EAAE;QACf,OAAO,EAAE;YACP,yBAAc,CAAC,UAAU,CAAC;gBACxB;oBACE,IAAI,EAAE,8BAAa,CAAC,IAAI;oBACxB,MAAM,EAAE,8BAAa;iBACtB;aACF,CAAC;SACH;KACF,CAAC;GACW,uBAAuB,CAAG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./setting.get.serialization"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./setting.list.serialization"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/setting/src/serializations/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,uEAA6C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ENUM_SETTING_DATA_TYPE } from '../constants/setting.enum.constant';
|
|
2
|
+
import { ResponseIdSerialization } from '@tc-libs/response';
|
|
3
|
+
export declare class SettingGetSerialization extends ResponseIdSerialization {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description?: string;
|
|
6
|
+
readonly type: ENUM_SETTING_DATA_TYPE;
|
|
7
|
+
readonly value: string | number | boolean;
|
|
8
|
+
readonly createdAt: Date;
|
|
9
|
+
readonly updatedAt: Date;
|
|
10
|
+
}
|