@serene-dev/la-nest-library 0.0.128 → 0.0.129
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/libs/la-library/src/controllers/base.controller.d.ts +12 -1
- package/dist/libs/la-library/src/controllers/base.controller.js +94 -2
- package/dist/libs/la-library/src/controllers/base.controller.js.map +1 -1
- package/dist/libs/la-library/src/enums/base.enum.d.ts +2 -1
- package/dist/libs/la-library/src/enums/base.enum.js +1 -0
- package/dist/libs/la-library/src/enums/base.enum.js.map +1 -1
- package/dist/libs/la-library/src/index.d.ts +6 -1
- package/dist/libs/la-library/src/index.js +17 -3
- package/dist/libs/la-library/src/index.js.map +1 -1
- package/dist/libs/la-library/src/modules/base.module.js.map +1 -1
- package/dist/libs/la-library/src/modules/category/category.controller.d.ts +13 -0
- package/dist/libs/la-library/src/modules/category/category.controller.js +90 -0
- package/dist/libs/la-library/src/modules/category/category.controller.js.map +1 -0
- package/dist/libs/la-library/src/modules/category/category.controller.spec.d.ts +1 -0
- package/dist/libs/la-library/src/modules/category/category.controller.spec.js +19 -0
- package/dist/libs/la-library/src/modules/category/category.controller.spec.js.map +1 -0
- package/dist/libs/la-library/src/modules/category/category.dto.d.ts +26 -0
- package/dist/libs/la-library/src/modules/category/category.dto.js +87 -0
- package/dist/libs/la-library/src/modules/category/category.dto.js.map +1 -0
- package/dist/libs/la-library/src/modules/category/category.entity.d.ts +10 -0
- package/dist/libs/la-library/src/modules/category/category.entity.js +46 -0
- package/dist/libs/la-library/src/modules/category/category.entity.js.map +1 -0
- package/dist/libs/la-library/src/modules/category/category.module.d.ts +9 -0
- package/dist/libs/la-library/src/modules/category/category.module.js +29 -0
- package/dist/libs/la-library/src/modules/category/category.module.js.map +1 -0
- package/dist/libs/la-library/src/modules/category/category.service.d.ts +11 -0
- package/dist/libs/la-library/src/modules/category/category.service.js +95 -0
- package/dist/libs/la-library/src/modules/category/category.service.js.map +1 -0
- package/dist/libs/la-library/src/modules/category/category.service.spec.d.ts +1 -0
- package/dist/libs/la-library/src/modules/category/category.service.spec.js +17 -0
- package/dist/libs/la-library/src/modules/category/category.service.spec.js.map +1 -0
- package/dist/libs/la-library/src/modules/cron/cron.controller.d.ts +1 -1
- package/dist/libs/la-library/src/modules/logs/logs.controller.d.ts +1 -1
- package/dist/libs/la-library/src/modules/messages/messages.controller.d.ts +1 -1
- package/dist/libs/la-library/src/modules/notifications/notification.controller.d.ts +1 -1
- package/dist/libs/la-library/src/services/base.service.d.ts +6 -0
- package/dist/libs/la-library/src/services/base.service.js +29 -4
- package/dist/libs/la-library/src/services/base.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,11 +2,22 @@ import { BaseEntity } from '../entities/base.entity';
|
|
|
2
2
|
import { SearchQueryDto } from '../dtos/search.dto';
|
|
3
3
|
import { BaseService } from '../services/base.service';
|
|
4
4
|
import { IItemID } from '../interfaces/index.interface';
|
|
5
|
+
import { BatchDeleteDto, IDDto } from '../dtos/base.dto';
|
|
6
|
+
import { IAuthParam } from '../modules/authentication/authentication.interface';
|
|
5
7
|
export declare class BaseController<TEntity extends BaseEntity, TSearchDto extends SearchQueryDto = SearchQueryDto> {
|
|
6
8
|
protected readonly service: BaseService<TEntity, TSearchDto>;
|
|
7
9
|
subject: string;
|
|
8
10
|
idParam: string;
|
|
9
11
|
constructor(service: BaseService<TEntity, TSearchDto>);
|
|
10
12
|
getByID(params: IItemID): Promise<string | TEntity>;
|
|
11
|
-
search(query: TSearchDto): Promise<import("..").ISearchResponse<TEntity>>;
|
|
13
|
+
search(query: TSearchDto): Promise<string | import("..").ISearchResponse<TEntity>>;
|
|
14
|
+
}
|
|
15
|
+
export declare class BaseCRUController<TEntity extends BaseEntity, TSearchDto extends SearchQueryDto = SearchQueryDto> extends BaseController<TEntity, TSearchDto> {
|
|
16
|
+
create<TAuthParam extends IAuthParam>(body: any, auth: TAuthParam, createFunction?: (data: any) => Promise<TEntity>): string | Promise<TEntity>;
|
|
17
|
+
updateByID<TUpdateDto extends Partial<TEntity>, TAuthParam extends IAuthParam>(param: IDDto, body: TUpdateDto, auth: TAuthParam, updateFunction?: (id: string, data: TUpdateDto) => Promise<TEntity>): string | Promise<TEntity>;
|
|
18
|
+
update<TUpdateFunction extends (...params: any) => Promise<any>>(updateFunction: TUpdateFunction, ...params: Parameters<TUpdateFunction>): string | Promise<any>;
|
|
19
|
+
}
|
|
20
|
+
export declare class BaseCRUDController<TEntity extends BaseEntity, TSearchDto extends SearchQueryDto = SearchQueryDto> extends BaseCRUController<TEntity, TSearchDto> {
|
|
21
|
+
deleteByID(param: IDDto, deleteFunction?: (id: string) => Promise<any>): string | Promise<any>;
|
|
22
|
+
deleteByIDs(body: BatchDeleteDto, deleteFunction?: (ids: string[]) => Promise<boolean>): string | Promise<boolean>;
|
|
12
23
|
}
|
|
@@ -11,11 +11,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
+
var _a;
|
|
14
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BaseController = void 0;
|
|
16
|
+
exports.BaseCRUDController = exports.BaseCRUController = exports.BaseController = void 0;
|
|
16
17
|
const common_1 = require("@nestjs/common");
|
|
17
18
|
const swagger_1 = require("@nestjs/swagger");
|
|
19
|
+
const search_dto_1 = require("../dtos/search.dto");
|
|
18
20
|
const utility_service_1 = require("../services/utility.service");
|
|
21
|
+
const base_dto_1 = require("../dtos/base.dto");
|
|
22
|
+
const authentication_guard_1 = require("../modules/authentication/authentication.guard");
|
|
19
23
|
class BaseController {
|
|
20
24
|
constructor(service) {
|
|
21
25
|
this.service = service;
|
|
@@ -28,7 +32,14 @@ class BaseController {
|
|
|
28
32
|
});
|
|
29
33
|
}
|
|
30
34
|
async search(query) {
|
|
31
|
-
|
|
35
|
+
try {
|
|
36
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
37
|
+
data: this.service.search(query),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
42
|
+
}
|
|
32
43
|
}
|
|
33
44
|
}
|
|
34
45
|
exports.BaseController = BaseController;
|
|
@@ -45,9 +56,90 @@ __decorate([
|
|
|
45
56
|
], BaseController.prototype, "getByID", null);
|
|
46
57
|
__decorate([
|
|
47
58
|
(0, common_1.Get)('search'),
|
|
59
|
+
(0, swagger_1.ApiResponse)({ type: search_dto_1.SearchResponseDto }),
|
|
48
60
|
__param(0, (0, common_1.Query)()),
|
|
49
61
|
__metadata("design:type", Function),
|
|
50
62
|
__metadata("design:paramtypes", [Object]),
|
|
51
63
|
__metadata("design:returntype", Promise)
|
|
52
64
|
], BaseController.prototype, "search", null);
|
|
65
|
+
class BaseCRUController extends BaseController {
|
|
66
|
+
create(body, auth, createFunction = (data) => this.service._create(data)) {
|
|
67
|
+
try {
|
|
68
|
+
utility_service_1.UtilityClass.patchCreator(body, auth);
|
|
69
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
70
|
+
data: createFunction(body),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
updateByID(param, body, auth, updateFunction = (id, data) => this.service._updateByID(id, data)) {
|
|
78
|
+
try {
|
|
79
|
+
utility_service_1.UtilityClass.patchUpdater(body, auth);
|
|
80
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
81
|
+
data: updateFunction(param.id, body),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
update(updateFunction, ...params) {
|
|
89
|
+
try {
|
|
90
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
91
|
+
data: updateFunction(params),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.BaseCRUController = BaseCRUController;
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, common_1.Post)(),
|
|
102
|
+
__param(0, (0, common_1.Body)()),
|
|
103
|
+
__param(1, (0, authentication_guard_1.AuthParam)()),
|
|
104
|
+
__metadata("design:type", Function),
|
|
105
|
+
__metadata("design:paramtypes", [Object, typeof (_a = typeof TAuthParam !== "undefined" && TAuthParam) === "function" ? _a : Object, Function]),
|
|
106
|
+
__metadata("design:returntype", void 0)
|
|
107
|
+
], BaseCRUController.prototype, "create", null);
|
|
108
|
+
class BaseCRUDController extends BaseCRUController {
|
|
109
|
+
deleteByID(param, deleteFunction = (id) => this.service._deleteByID(id)) {
|
|
110
|
+
try {
|
|
111
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
112
|
+
data: deleteFunction(param.id),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
deleteByIDs(body, deleteFunction = (ids) => this.service._deleteByIDs(ids)) {
|
|
120
|
+
try {
|
|
121
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
122
|
+
data: deleteFunction(body.ids),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.BaseCRUDController = BaseCRUDController;
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, common_1.Delete)(':id'),
|
|
133
|
+
__param(0, (0, common_1.Param)()),
|
|
134
|
+
__metadata("design:type", Function),
|
|
135
|
+
__metadata("design:paramtypes", [base_dto_1.IDDto, Function]),
|
|
136
|
+
__metadata("design:returntype", void 0)
|
|
137
|
+
], BaseCRUDController.prototype, "deleteByID", null);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, common_1.Delete)(''),
|
|
140
|
+
__param(0, (0, common_1.Body)()),
|
|
141
|
+
__metadata("design:type", Function),
|
|
142
|
+
__metadata("design:paramtypes", [base_dto_1.BatchDeleteDto, Function]),
|
|
143
|
+
__metadata("design:returntype", void 0)
|
|
144
|
+
], BaseCRUDController.prototype, "deleteByIDs", null);
|
|
53
145
|
//# sourceMappingURL=base.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.controller.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/controllers/base.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.controller.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/controllers/base.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,6CAAwD;AAExD,mDAAuE;AAEvE,iEAA2D;AAE3D,+CAAyD;AAEzD,yFAA2E;AAE3E,MAAa,cAAc;IAMzB,YAA+B,OAAyC;QAAzC,YAAO,GAAP,OAAO,CAAkC;QAFxE,YAAO,GAAG,MAAM,CAAC;QACjB,YAAO,GAAG,IAAI,CAAC;IAC4D,CAAC;IAOtE,AAAN,KAAK,CAAC,OAAO,CAAU,MAAe;QACpC,OAAO,8BAAY,CAAC,aAAa,CAAC;YAChC,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAAU,KAAiB;QACrC,IAAI,CAAC;YACH,OAAO,8BAAY,CAAC,aAAa,CAAC;gBAChC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;aACjC,CA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,CAAC,IAAI,CAAC,GAAG,CAAC;aAC/B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,8BAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CACF;AAjCD,gDAiCC;AA5BC;IADC,IAAA,eAAM,EAAC,KAAK,CAAC;IAEX,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAQ,gBAAK;;oDAWtB;AAGD;IADC,IAAA,eAAM,EAAC,EAAE,CAAC;IAER,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,yBAAc;;qDAW7B"}
|
|
@@ -20,7 +20,8 @@ export declare enum ETableName {
|
|
|
20
20
|
notificationStatus = "notification_status",
|
|
21
21
|
formField = "form_field",
|
|
22
22
|
form = "form",
|
|
23
|
-
formFieldBank = "form_field_bank"
|
|
23
|
+
formFieldBank = "form_field_bank",
|
|
24
|
+
category = "category"
|
|
24
25
|
}
|
|
25
26
|
export declare enum ERefCat {
|
|
26
27
|
file = "file"
|
|
@@ -25,6 +25,7 @@ var ETableName;
|
|
|
25
25
|
ETableName["formField"] = "form_field";
|
|
26
26
|
ETableName["form"] = "form";
|
|
27
27
|
ETableName["formFieldBank"] = "form_field_bank";
|
|
28
|
+
ETableName["category"] = "category";
|
|
28
29
|
})(ETableName || (exports.ETableName = ETableName = {}));
|
|
29
30
|
var ERefCat;
|
|
30
31
|
(function (ERefCat) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.enum.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/enums/base.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"base.enum.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/enums/base.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAwBX;AAxBD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,+BAAiB,CAAA;IACjB,yDAA2C,CAAA;IAC3C,sDAAwC,CAAA;IACxC,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,oDAAsC,CAAA;IACtC,6BAAe,CAAA;IACf,2CAA6B,CAAA;IAC7B,+CAAiC,CAAA;IACjC,8CAAgC,CAAA;IAChC,4CAA8B,CAAA;IAC9B,oDAAsC,CAAA;IACtC,kCAAoB,CAAA;IACpB,2BAAa,CAAA;IACb,2CAA6B,CAAA;IAC7B,wDAA0C,CAAA;IAC1C,sCAAwB,CAAA;IACxB,2BAAa,CAAA;IACb,+CAAiC,CAAA;IACjC,mCAAqB,CAAA;AACvB,CAAC,EAxBW,UAAU,0BAAV,UAAU,QAwBrB;AAED,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,wBAAa,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
|
|
@@ -17,7 +17,7 @@ export { AuthSessionEntity as SDKAuthSessionEntity } from './modules/authenticat
|
|
|
17
17
|
export * from './modules/authentication/authentication.interface';
|
|
18
18
|
export * from './modules/authentication/authentication.enum';
|
|
19
19
|
export { LoginDTO as SDKLoginDTO, LogoutDTO as SDKLogoutDTO, RegisterDTO as SDKRegisterDTO, SystemLogoutDTO as SDKSystemLogoutDTO, ToggleAuthDTO as SDKToggleAuthDTO, RequestPasswordResetDTO as SDKRequestPasswordResetDTO, ResetPasswordDTO as SDKResetPasswordDTO, VerifyResetPasswordTokenDTO as SDKVerifyResetPasswordTokenDTO, VerifyResetPasswordTokenResponseDTO as SDKVerifyResetPasswordTokenResponseDTO, } from './modules/authentication/authentication.dto';
|
|
20
|
-
export { BaseController as SDKBaseController } from './controllers/base.controller';
|
|
20
|
+
export { BaseController as SDKBaseController, BaseCRUController as SDKBaseCRUController, BaseCRUDController as SDKBaseCRUDController, } from './controllers/base.controller';
|
|
21
21
|
export { SDKBaseService } from './services/base.service';
|
|
22
22
|
export { BaseEntity } from './entities/base.entity';
|
|
23
23
|
export { BaseDto as SDKBaseDto } from './dtos/base.dto';
|
|
@@ -33,6 +33,11 @@ export { FileBinEntity } from './entities/file-bin.entity';
|
|
|
33
33
|
export { FileEntity } from './entities/file.entity';
|
|
34
34
|
export { FileService as SDKFileService } from './services/file.service';
|
|
35
35
|
export { LikesService as SDKLikesService } from './services/likes.service';
|
|
36
|
+
export { CategoryController as SDKCategoryController } from './modules/category/category.controller';
|
|
37
|
+
export { CreateCategoryDto as SDKCreateCategoryDto, SearchCategoryDto as SDKSearchCategoryDto, UpdateCategoryDto as SDKUpdateCategoryDto, } from './modules/category/category.dto';
|
|
38
|
+
export { CategoryEntity as SDKCategoryEntity } from './modules/category/category.entity';
|
|
39
|
+
export { CategoryModule as SDKCategoryModule } from './modules/category/category.module';
|
|
40
|
+
export { CategoryService as SDKCategoryService } from './modules/category/category.service';
|
|
36
41
|
export { logger, stream, initLogger } from './services/logger.service';
|
|
37
42
|
export { LogsModule as SDKLogsModule } from './modules/logs/logs.module';
|
|
38
43
|
export { LogsService as SDKLogsService } from './modules/logs/logs.service';
|
|
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.SDKCustomValidationPipe = exports.SDKUtilityController = exports.ESortOrder = exports.ESearchCondition = exports.SDKSearchService = exports.SearchQueryDto = exports.SDKFileUploadDto = exports.SDKFileUpdateDto = exports.SDKFileSearchDto = exports.SDKFileActionDto = exports.SDKListsEntity = exports.SDKListOptionsEntity = exports.SDKListsController = exports.SDKSaveListOption = exports.SDKSaveListGroupDTO = exports.SDKListsService = exports.SDKListsModule = exports.SDKTelnetService = exports.SDKTelnetModule = exports.SDKTelnetRequestDTO = exports.SDKTelnetController = exports.SDKNotificationItemService = exports.SDKNotificationService = exports.SDKNotificationModule = void 0;
|
|
17
|
+
exports.SDKUpdateCategoryDto = exports.SDKSearchCategoryDto = exports.SDKCreateCategoryDto = exports.SDKCategoryController = exports.SDKLikesService = exports.SDKFileService = exports.FileEntity = exports.FileBinEntity = exports.LikesEntity = exports.SDKFileController = exports.SDKEFileSizeUnit = exports.SDKSample = exports.SDKBaseDto = exports.BaseEntity = exports.SDKBaseService = exports.SDKBaseCRUDController = exports.SDKBaseCRUController = exports.SDKBaseController = exports.SDKVerifyResetPasswordTokenResponseDTO = exports.SDKVerifyResetPasswordTokenDTO = exports.SDKResetPasswordDTO = exports.SDKRequestPasswordResetDTO = exports.SDKToggleAuthDTO = exports.SDKSystemLogoutDTO = exports.SDKRegisterDTO = exports.SDKLogoutDTO = exports.SDKLoginDTO = exports.SDKAuthSessionEntity = exports.SDKAuthEntity = exports.SDKAuthenticationController = exports.SDKAuthenticationSessionService = exports.SDKAuthenticationService = exports.AuthParam = exports.SDKPublicAuth = exports.SDKAuthenticationGuard = exports.SDKAuthenticationModule = exports.SDKTokenSessionEntity = exports.SDKTokenSessionService = exports.SDKTokenService = exports.SDKAPIService = exports.SMSService = exports.MailService = exports.SDKUtilityClass = exports.SDKETableName = exports.SDKERefCat = exports.SDKEvt = exports.setSDKEnvironment = exports.ISDKEnvironment = exports.SDKEnvironmentService = exports.SDKConfig = void 0;
|
|
18
|
+
exports.MessageModule = exports.MessageRecipientEntity = exports.MessageEntity = exports.MessageController = exports.SDKFormFieldBankDTO = exports.SDKSearchFormFieldDTO = exports.SDKSearchFormFieldBankDTO = exports.SDKSearchFormDTO = exports.SDKUpdateFormFieldDTO = exports.SDKUpdateFormFieldBankDTO = exports.SDKUpdateFormDTO = exports.SDKSaveFormFieldDTO = exports.SDKSaveFormFieldBankDTO = exports.SDKSaveFormDTO = exports.SDKRequirementOption = exports.SDKFormIDDto = exports.SDKEInputType = exports.SDKFormGeneratorService = exports.SDKFormGeneratorModule = exports.SDKFormFieldEntity = exports.SDKFormFieldBankEntity = exports.SDKFormEntity = exports.SDKFormGeneratorController = exports.SDKWalletService = exports.SDKETransactionType = exports.SDKETransMethod = exports.SDKECurrency = exports.SDKWalletTransaction = exports.SDKWalletNetBalanceView = exports.SDKWalletGrossBalanceView = exports.SDKWalletExternalBank = exports.SDKWalletEntity = exports.SDKWalletEntities = exports.SDKWalletSearchDTO = exports.SDKSaveWalletDTO = exports.SDKWalletController = exports.SDKWalletModule = exports.SDKLogEntity = exports.SDKLogsController = exports.SDKLogCreateSingleDTO = exports.SDKLogCreateMultipleDTO = exports.SDKLogSerarchDTO = exports.SDKLogsService = exports.SDKLogsModule = exports.initLogger = exports.stream = exports.logger = exports.SDKCategoryService = exports.SDKCategoryModule = exports.SDKCategoryEntity = void 0;
|
|
19
|
+
exports.SDKCustomValidationPipe = exports.SDKUtilityController = exports.ESortOrder = exports.ESearchCondition = exports.SDKSearchService = exports.SearchQueryDto = exports.SDKFileUploadDto = exports.SDKFileUpdateDto = exports.SDKFileSearchDto = exports.SDKFileActionDto = exports.SDKListsEntity = exports.SDKListOptionsEntity = exports.SDKListsController = exports.SDKSaveListOption = exports.SDKSaveListGroupDTO = exports.SDKListsService = exports.SDKListsModule = exports.SDKTelnetService = exports.SDKTelnetModule = exports.SDKTelnetRequestDTO = exports.SDKTelnetController = exports.SDKNotificationItemService = exports.SDKNotificationService = exports.SDKNotificationModule = exports.SDKnotificationEntities = exports.SDKNotificationItemEntity = exports.SDKNotificationEntity = exports.SDKNotificationToggleActiveStatusDTO = exports.SDKNotificationQueryDTO = exports.SDKNotificationItemQueryDTO = exports.SDKCreateNotificationDTO = exports.SDKNotificationController = exports.MessageService = void 0;
|
|
20
20
|
__exportStar(require("./la-library.module"), exports);
|
|
21
21
|
var index_config_1 = require("./configs/index.config");
|
|
22
22
|
Object.defineProperty(exports, "SDKConfig", { enumerable: true, get: function () { return index_config_1.SDKConfig; } });
|
|
@@ -70,6 +70,8 @@ Object.defineProperty(exports, "SDKVerifyResetPasswordTokenDTO", { enumerable: t
|
|
|
70
70
|
Object.defineProperty(exports, "SDKVerifyResetPasswordTokenResponseDTO", { enumerable: true, get: function () { return authentication_dto_1.VerifyResetPasswordTokenResponseDTO; } });
|
|
71
71
|
var base_controller_1 = require("./controllers/base.controller");
|
|
72
72
|
Object.defineProperty(exports, "SDKBaseController", { enumerable: true, get: function () { return base_controller_1.BaseController; } });
|
|
73
|
+
Object.defineProperty(exports, "SDKBaseCRUController", { enumerable: true, get: function () { return base_controller_1.BaseCRUController; } });
|
|
74
|
+
Object.defineProperty(exports, "SDKBaseCRUDController", { enumerable: true, get: function () { return base_controller_1.BaseCRUDController; } });
|
|
73
75
|
var base_service_1 = require("./services/base.service");
|
|
74
76
|
Object.defineProperty(exports, "SDKBaseService", { enumerable: true, get: function () { return base_service_1.SDKBaseService; } });
|
|
75
77
|
var base_entity_1 = require("./entities/base.entity");
|
|
@@ -95,6 +97,18 @@ var file_service_1 = require("./services/file.service");
|
|
|
95
97
|
Object.defineProperty(exports, "SDKFileService", { enumerable: true, get: function () { return file_service_1.FileService; } });
|
|
96
98
|
var likes_service_1 = require("./services/likes.service");
|
|
97
99
|
Object.defineProperty(exports, "SDKLikesService", { enumerable: true, get: function () { return likes_service_1.LikesService; } });
|
|
100
|
+
var category_controller_1 = require("./modules/category/category.controller");
|
|
101
|
+
Object.defineProperty(exports, "SDKCategoryController", { enumerable: true, get: function () { return category_controller_1.CategoryController; } });
|
|
102
|
+
var category_dto_1 = require("./modules/category/category.dto");
|
|
103
|
+
Object.defineProperty(exports, "SDKCreateCategoryDto", { enumerable: true, get: function () { return category_dto_1.CreateCategoryDto; } });
|
|
104
|
+
Object.defineProperty(exports, "SDKSearchCategoryDto", { enumerable: true, get: function () { return category_dto_1.SearchCategoryDto; } });
|
|
105
|
+
Object.defineProperty(exports, "SDKUpdateCategoryDto", { enumerable: true, get: function () { return category_dto_1.UpdateCategoryDto; } });
|
|
106
|
+
var category_entity_1 = require("./modules/category/category.entity");
|
|
107
|
+
Object.defineProperty(exports, "SDKCategoryEntity", { enumerable: true, get: function () { return category_entity_1.CategoryEntity; } });
|
|
108
|
+
var category_module_1 = require("./modules/category/category.module");
|
|
109
|
+
Object.defineProperty(exports, "SDKCategoryModule", { enumerable: true, get: function () { return category_module_1.CategoryModule; } });
|
|
110
|
+
var category_service_1 = require("./modules/category/category.service");
|
|
111
|
+
Object.defineProperty(exports, "SDKCategoryService", { enumerable: true, get: function () { return category_service_1.CategoryService; } });
|
|
98
112
|
var logger_service_1 = require("./services/logger.service");
|
|
99
113
|
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_service_1.logger; } });
|
|
100
114
|
Object.defineProperty(exports, "stream", { enumerable: true, get: function () { return logger_service_1.stream; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/la-library/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,sDAAoC;AAEpC,uDAAmD;AAA1C,yGAAA,SAAS,OAAA;AAClB,sEAKwC;AAJtC,4HAAA,qBAAqB,OAAA;AACrB,sHAAA,eAAe,OAAA;AACf,wHAAA,iBAAiB,OAAA;AACjB,6GAAA,GAAG,OAAU;AAEf,+CAG2B;AAFzB,uGAAA,OAAO,OAAc;AACrB,0GAAA,UAAU,OAAiB;AAE7B,8DAA6E;AAApE,kHAAA,YAAY,OAAmB;AACxC,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,0DAAwD;AAA/C,yGAAA,UAAU,OAAA;AACnB,sDAAqE;AAA5D,4GAAA,UAAU,OAAiB;AAGpC,0DAGkC;AAFhC,gHAAA,YAAY,OAAmB;AAC/B,uHAAA,mBAAmB,OAA0B;AAE/C,wEAA8F;AAArF,6HAAA,kBAAkB,OAAyB;AAIpD,wFAAiH;AAAxG,gIAAA,oBAAoB,OAA2B;AACxD,sFAIuD;AAHrD,8HAAA,mBAAmB,OAA0B;AAC7C,qHAAA,UAAU,OAAiB;AAC3B,iHA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AACxC,kEAAoF;AAA3E,kHAAA,aAAa,OAAoB;AAI1C,6DAA6E;AAApE,8GAAA,WAAW,OAAkB;AACtC,+DAAgF;AAAvE,gHAAA,YAAY,OAAmB;AACxC,uDAGmC;AAFjC,gHAAA,gBAAgB,OAAuB;AACvC,8GAAA,cAAc,OAAqB;AAErC,qEAAyF;AAAhF,sHAAA,eAAe,OAAsB;AAC9C,6DAGsC;AAFpC,oHAAA,iBAAiB,OAAwB;AACzC,8GAAA,WAAW,OAAkB;AAK/B,4CAKyB;AAJvB,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AAEnC,gDAAmD;AAA1C,4GAAA,cAAc,OAAA;AACvB,4DAA8E;AAArE,kHAAA,aAAa,OAAoB;AAC1C,mDAAmE;AAA1D,+GAAA,gBAAgB,OAAA;AAAE,yGAAA,UAAU,OAAA;AACrC,gEAA8C;AAG9C,uEAA6F;AAApF,0HAAA,iBAAiB,OAAwB;AAClD,iEAAgG;AAAvF,0HAAA,oBAAoB,OAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.module.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/modules/base.module.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base.module.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/modules/base.module.ts"],"names":[],"mappings":";;;AAKA,MAAa,UAAU;CAItB;AAJD,gCAIC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CategoryService } from './category.service';
|
|
2
|
+
import { CreateCategoryDto, GetCategoryBySlugDto, GetCategoryBySlugQueryDto, SearchCategoryDto, UpdateCategoryDto } from './category.dto';
|
|
3
|
+
import { CategoryEntity } from './category.entity';
|
|
4
|
+
import { BaseCRUDController } from '../../controllers/base.controller';
|
|
5
|
+
import { IDDto } from '../../dtos/base.dto';
|
|
6
|
+
export declare class CategoryController extends BaseCRUDController<CategoryEntity, SearchCategoryDto> {
|
|
7
|
+
protected readonly service: CategoryService;
|
|
8
|
+
constructor(service: CategoryService);
|
|
9
|
+
create(createCategoryDto: CreateCategoryDto, auth: any): string | Promise<CategoryEntity>;
|
|
10
|
+
search(query: SearchCategoryDto): Promise<string | import("../..").ISearchResponse<CategoryEntity>>;
|
|
11
|
+
getBySlug(query: GetCategoryBySlugQueryDto): string | Promise<GetCategoryBySlugDto[]>;
|
|
12
|
+
updateByID(param: IDDto, updateCategoryDto: UpdateCategoryDto, auth: any): string | Promise<CategoryEntity>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CategoryController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const category_service_1 = require("./category.service");
|
|
18
|
+
const category_dto_1 = require("./category.dto");
|
|
19
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
20
|
+
const base_controller_1 = require("../../controllers/base.controller");
|
|
21
|
+
const authentication_guard_1 = require("../authentication/authentication.guard");
|
|
22
|
+
const base_dto_1 = require("../../dtos/base.dto");
|
|
23
|
+
const utility_service_1 = require("../../services/utility.service");
|
|
24
|
+
const search_dto_1 = require("../../dtos/search.dto");
|
|
25
|
+
let CategoryController = class CategoryController extends base_controller_1.BaseCRUDController {
|
|
26
|
+
constructor(service) {
|
|
27
|
+
super(service);
|
|
28
|
+
this.service = service;
|
|
29
|
+
}
|
|
30
|
+
create(createCategoryDto, auth) {
|
|
31
|
+
return super.create(createCategoryDto, auth);
|
|
32
|
+
}
|
|
33
|
+
search(query) {
|
|
34
|
+
return super.search(query);
|
|
35
|
+
}
|
|
36
|
+
getBySlug(query) {
|
|
37
|
+
try {
|
|
38
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
39
|
+
data: this.service.getBySlug(query),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return utility_service_1.UtilityClass.handleError(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
updateByID(param, updateCategoryDto, auth) {
|
|
47
|
+
return super.updateByID(param, updateCategoryDto, auth);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.CategoryController = CategoryController;
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, common_1.Post)(),
|
|
53
|
+
__param(0, (0, common_1.Body)()),
|
|
54
|
+
__param(1, (0, authentication_guard_1.AuthParam)()),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", [category_dto_1.CreateCategoryDto, Object]),
|
|
57
|
+
__metadata("design:returntype", void 0)
|
|
58
|
+
], CategoryController.prototype, "create", null);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, common_1.Get)('search'),
|
|
61
|
+
(0, swagger_1.ApiResponse)({ type: search_dto_1.SearchResponseDto }),
|
|
62
|
+
__param(0, (0, common_1.Query)()),
|
|
63
|
+
__metadata("design:type", Function),
|
|
64
|
+
__metadata("design:paramtypes", [category_dto_1.SearchCategoryDto]),
|
|
65
|
+
__metadata("design:returntype", void 0)
|
|
66
|
+
], CategoryController.prototype, "search", null);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, common_1.Get)('slug'),
|
|
69
|
+
(0, swagger_1.ApiResponse)({ type: [category_dto_1.GetCategoryBySlugDto] }),
|
|
70
|
+
__param(0, (0, common_1.Query)()),
|
|
71
|
+
__metadata("design:type", Function),
|
|
72
|
+
__metadata("design:paramtypes", [category_dto_1.GetCategoryBySlugQueryDto]),
|
|
73
|
+
__metadata("design:returntype", void 0)
|
|
74
|
+
], CategoryController.prototype, "getBySlug", null);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, common_1.Patch)(':id'),
|
|
77
|
+
__param(0, (0, common_1.Param)()),
|
|
78
|
+
__param(1, (0, common_1.Body)()),
|
|
79
|
+
__param(2, (0, authentication_guard_1.AuthParam)()),
|
|
80
|
+
__metadata("design:type", Function),
|
|
81
|
+
__metadata("design:paramtypes", [base_dto_1.IDDto,
|
|
82
|
+
category_dto_1.UpdateCategoryDto, Object]),
|
|
83
|
+
__metadata("design:returntype", void 0)
|
|
84
|
+
], CategoryController.prototype, "updateByID", null);
|
|
85
|
+
exports.CategoryController = CategoryController = __decorate([
|
|
86
|
+
(0, swagger_1.ApiTags)('Category'),
|
|
87
|
+
(0, common_1.Controller)('category'),
|
|
88
|
+
__metadata("design:paramtypes", [category_service_1.CategoryService])
|
|
89
|
+
], CategoryController);
|
|
90
|
+
//# sourceMappingURL=category.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.controller.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAQwB;AACxB,yDAAqD;AACrD,iDAMwB;AAExB,6CAAuD;AACvD,uEAAuE;AACvE,iFAAmE;AACnE,kDAA4C;AAC5C,oEA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CAAC,mCAAoB,CAAC,EAAE,CAAC;IACnC,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAQ,wCAAyB;;mDAQlD;AAGQ;IADR,IAAA,cAAK,EAAC,KAAK,CAAC;IAEV,WAAA,IAAA,cAAK,GAAE,CAAA;IACP,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,gCAAS,GAAE,CAAA;;qCAFI,gBAAK;QACM,gCAAiB;;oDAI7C;6BAzCU,kBAAkB;IAF9B,IAAA,iBAAO,EAAC,UAAU,CAAC;IACnB,IAAA,mBAAU,EAAC,UAAU,CAAC;qCAK4B,kCAAe;GAJrD,kBAAkB,CA0C9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const category_controller_1 = require("./category.controller");
|
|
5
|
+
const category_service_1 = require("./category.service");
|
|
6
|
+
describe('CategoryController', () => {
|
|
7
|
+
let controller;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const module = await testing_1.Test.createTestingModule({
|
|
10
|
+
controllers: [category_controller_1.CategoryController],
|
|
11
|
+
providers: [category_service_1.CategoryService],
|
|
12
|
+
}).compile();
|
|
13
|
+
controller = module.get(category_controller_1.CategoryController);
|
|
14
|
+
});
|
|
15
|
+
it('should be defined', () => {
|
|
16
|
+
expect(controller).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=category.controller.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.controller.spec.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.controller.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,+DAA2D;AAC3D,yDAAqD;AAErD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAI,UAA8B,CAAC;IAEnC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,WAAW,EAAE,CAAC,wCAAkB,CAAC;YACjC,SAAS,EAAE,CAAC,kCAAe,CAAC;SAC7B,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,UAAU,GAAG,MAAM,CAAC,GAAG,CAAqB,wCAAkB,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SearchQueryDto } from '../../dtos/search.dto';
|
|
2
|
+
import { CategoryEntity } from './category.entity';
|
|
3
|
+
export declare class CreateCategoryDto implements CategoryEntity {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
parentId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const UpdateCategoryDto_base: import("@nestjs/common").Type<Partial<CreateCategoryDto>>;
|
|
10
|
+
export declare class UpdateCategoryDto extends UpdateCategoryDto_base {
|
|
11
|
+
}
|
|
12
|
+
declare const SearchCategoryDto_base: import("@nestjs/common").Type<UpdateCategoryDto & SearchQueryDto<CategoryEntity>>;
|
|
13
|
+
export declare class SearchCategoryDto extends SearchCategoryDto_base implements Partial<CategoryEntity> {
|
|
14
|
+
parentSlug?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class GetCategoryBySlugQueryDto {
|
|
17
|
+
slug?: string;
|
|
18
|
+
parentSlug?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class GetCategoryBySlugDto implements Partial<CategoryEntity> {
|
|
21
|
+
title: string;
|
|
22
|
+
id: string;
|
|
23
|
+
slug: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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.GetCategoryBySlugDto = exports.GetCategoryBySlugQueryDto = exports.SearchCategoryDto = exports.UpdateCategoryDto = exports.CreateCategoryDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const search_dto_1 = require("../../dtos/search.dto");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
class CreateCategoryDto {
|
|
17
|
+
}
|
|
18
|
+
exports.CreateCategoryDto = CreateCategoryDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiProperty)(),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], CreateCategoryDto.prototype, "title", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], CreateCategoryDto.prototype, "description", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, swagger_1.ApiProperty)(),
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CreateCategoryDto.prototype, "slug", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
37
|
+
(0, class_validator_1.IsString)(),
|
|
38
|
+
(0, class_validator_1.IsOptional)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], CreateCategoryDto.prototype, "parentId", void 0);
|
|
41
|
+
class UpdateCategoryDto extends (0, swagger_1.PartialType)(CreateCategoryDto) {
|
|
42
|
+
}
|
|
43
|
+
exports.UpdateCategoryDto = UpdateCategoryDto;
|
|
44
|
+
class SearchCategoryDto extends (0, swagger_1.IntersectionType)((search_dto_1.SearchQueryDto), UpdateCategoryDto) {
|
|
45
|
+
}
|
|
46
|
+
exports.SearchCategoryDto = SearchCategoryDto;
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
49
|
+
(0, class_validator_1.IsString)(),
|
|
50
|
+
(0, class_validator_1.IsOptional)(),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], SearchCategoryDto.prototype, "parentSlug", void 0);
|
|
53
|
+
class GetCategoryBySlugQueryDto {
|
|
54
|
+
}
|
|
55
|
+
exports.GetCategoryBySlugQueryDto = GetCategoryBySlugQueryDto;
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
58
|
+
(0, class_validator_1.IsString)(),
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], GetCategoryBySlugQueryDto.prototype, "slug", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
64
|
+
(0, class_validator_1.IsString)(),
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], GetCategoryBySlugQueryDto.prototype, "parentSlug", void 0);
|
|
68
|
+
class GetCategoryBySlugDto {
|
|
69
|
+
}
|
|
70
|
+
exports.GetCategoryBySlugDto = GetCategoryBySlugDto;
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], GetCategoryBySlugDto.prototype, "title", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], GetCategoryBySlugDto.prototype, "id", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], GetCategoryBySlugDto.prototype, "slug", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], GetCategoryBySlugDto.prototype, "description", void 0);
|
|
87
|
+
//# sourceMappingURL=category.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.dto.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAKyB;AACzB,sDAAuD;AAEvD,qDAAuD;AAEvD,MAAa,iBAAiB;CAK7B;AALD,8CAKC;AAJ4B;IAA1B,IAAA,qBAAW,GAAE;IAAE,IAAA,0BAAQ,GAAE;;gDAAe;AACQ;IAAhD,IAAA,6BAAmB,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,4BAAU,GAAE;;sDAAsB;AAC3C;IAA1B,IAAA,qBAAW,GAAE;IAAE,IAAA,0BAAQ,GAAE;;+CAAc;AACS;IAAhD,IAAA,6BAAmB,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,4BAAU,GAAE;;mDAAmB;AAGrE,MAAa,iBAAkB,SAAQ,IAAA,qBAAW,EAAC,iBAAiB,CAAC;CAAG;AAAxE,8CAAwE;AAExE,MAAa,iBACX,SAAQ,IAAA,0BAAgB,EAAC,CAAA,2BAA8B,CAAA,EAAE,iBAAiB,CAAC;CAI5E;AALD,8CAKC;AADkD;IAAhD,IAAA,6BAAmB,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,4BAAU,GAAE;;qDAAqB;AAGvE,MAAa,yBAAyB;CAGrC;AAHD,8DAGC;AAFkD;IAAhD,IAAA,6BAAmB,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,4BAAU,GAAE;;uDAAe;AACd;IAAhD,IAAA,6BAAmB,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,4BAAU,GAAE;;6DAAqB;AAGvE,MAAa,oBAAoB;CAKhC;AALD,oDAKC;AAJwB;IAAtB,IAAA,6BAAmB,GAAE;;mDAAe;AACd;IAAtB,IAAA,6BAAmB,GAAE;;gDAAY;AACX;IAAtB,IAAA,6BAAmB,GAAE;;kDAAc;AACb;IAAtB,IAAA,6BAAmB,GAAE;;yDAAqB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Relation } from 'typeorm';
|
|
2
|
+
import { BaseEntity } from '../../entities/base.entity';
|
|
3
|
+
export declare class CategoryEntity extends BaseEntity<CategoryEntity> {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
parentId?: string;
|
|
8
|
+
parent?: Relation<CategoryEntity>;
|
|
9
|
+
children?: Relation<CategoryEntity[]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.CategoryEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const base_enum_1 = require("../../enums/base.enum");
|
|
15
|
+
const base_entity_1 = require("../../entities/base.entity");
|
|
16
|
+
let CategoryEntity = class CategoryEntity extends base_entity_1.BaseEntity {
|
|
17
|
+
};
|
|
18
|
+
exports.CategoryEntity = CategoryEntity;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], CategoryEntity.prototype, "title", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], CategoryEntity.prototype, "description", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], CategoryEntity.prototype, "slug", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CategoryEntity.prototype, "parentId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.ManyToOne)(() => CategoryEntity, (item) => item.children),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], CategoryEntity.prototype, "parent", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.OneToMany)(() => CategoryEntity, (item) => item.parent),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], CategoryEntity.prototype, "children", void 0);
|
|
43
|
+
exports.CategoryEntity = CategoryEntity = __decorate([
|
|
44
|
+
(0, typeorm_1.Entity)(base_enum_1.ETableName.category)
|
|
45
|
+
], CategoryEntity);
|
|
46
|
+
//# sourceMappingURL=category.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.entity.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyE;AACzE,qDAAmD;AACnD,4DAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,wBAA0B;CAkB7D,CAAA;AAlBY,wCAAc;AAEzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACX;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACJ;AAGrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACZ;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACT;AAGlB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;;8CACvB;AAGlC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;;gDACjB;yBAjB3B,cAAc;IAD1B,IAAA,gBAAM,EAAC,sBAAU,CAAC,QAAQ,CAAC;GACf,cAAc,CAkB1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CategoryService } from './category.service';
|
|
2
|
+
import { CategoryController } from './category.controller';
|
|
3
|
+
import { BaseModule } from '../base.module';
|
|
4
|
+
import { CategoryEntity } from './category.entity';
|
|
5
|
+
export declare class CategoryModule extends BaseModule {
|
|
6
|
+
static entities: (typeof CategoryEntity)[];
|
|
7
|
+
static services: (typeof CategoryService)[];
|
|
8
|
+
static controllers: (typeof CategoryController)[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CategoryModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const category_service_1 = require("./category.service");
|
|
12
|
+
const category_controller_1 = require("./category.controller");
|
|
13
|
+
const base_module_1 = require("../base.module");
|
|
14
|
+
const category_entity_1 = require("./category.entity");
|
|
15
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
16
|
+
let CategoryModule = class CategoryModule extends base_module_1.BaseModule {
|
|
17
|
+
};
|
|
18
|
+
exports.CategoryModule = CategoryModule;
|
|
19
|
+
CategoryModule.entities = [category_entity_1.CategoryEntity];
|
|
20
|
+
CategoryModule.services = [category_service_1.CategoryService];
|
|
21
|
+
CategoryModule.controllers = [category_controller_1.CategoryController];
|
|
22
|
+
exports.CategoryModule = CategoryModule = __decorate([
|
|
23
|
+
(0, common_1.Module)({
|
|
24
|
+
imports: [typeorm_1.TypeOrmModule.forFeature(CategoryModule.entities)],
|
|
25
|
+
controllers: [category_controller_1.CategoryController],
|
|
26
|
+
providers: [category_service_1.CategoryService],
|
|
27
|
+
})
|
|
28
|
+
], CategoryModule);
|
|
29
|
+
//# sourceMappingURL=category.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.module.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yDAAqD;AACrD,+DAA2D;AAC3D,gDAA4C;AAC5C,uDAAmD;AACnD,6CAAgD;AAOzC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,wBAAU;;AAAjC,wCAAc;AACT,uBAAQ,GAAG,CAAC,gCAAc,CAAC,AAAnB,CAAoB;AAC5B,uBAAQ,GAAG,CAAC,kCAAe,CAAC,AAApB,CAAqB;AAC7B,0BAAW,GAAG,CAAC,wCAAkB,CAAC,AAAvB,CAAwB;yBAHxC,cAAc;IAL1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC5D,WAAW,EAAE,CAAC,wCAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,kCAAe,CAAC;KAC7B,CAAC;GACW,cAAc,CAI1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseService } from '../../services/base.service';
|
|
2
|
+
import { CategoryEntity } from './category.entity';
|
|
3
|
+
import { Repository } from 'typeorm';
|
|
4
|
+
import { CreateCategoryDto, GetCategoryBySlugDto, GetCategoryBySlugQueryDto, SearchCategoryDto } from './category.dto';
|
|
5
|
+
export declare class CategoryService extends BaseService<CategoryEntity, SearchCategoryDto> {
|
|
6
|
+
repo: Repository<CategoryEntity>;
|
|
7
|
+
constructor(repo: Repository<CategoryEntity>);
|
|
8
|
+
_createChecks(data: CreateCategoryDto): Promise<void>;
|
|
9
|
+
_updateChecks(id: string, data: CreateCategoryDto): Promise<void>;
|
|
10
|
+
getBySlug(query: GetCategoryBySlugQueryDto): Promise<GetCategoryBySlugDto[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CategoryService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const base_service_1 = require("../../services/base.service");
|
|
18
|
+
const category_entity_1 = require("./category.entity");
|
|
19
|
+
const typeorm_1 = require("typeorm");
|
|
20
|
+
const typeorm_2 = require("@nestjs/typeorm");
|
|
21
|
+
const base_enum_1 = require("../../enums/base.enum");
|
|
22
|
+
const utility_service_1 = require("../../services/utility.service");
|
|
23
|
+
const search_enum_1 = require("../../enums/search.enum");
|
|
24
|
+
let CategoryService = class CategoryService extends base_service_1.BaseService {
|
|
25
|
+
constructor(repo) {
|
|
26
|
+
super(repo, base_enum_1.ETableName.category);
|
|
27
|
+
this.repo = repo;
|
|
28
|
+
this.queryStruct = [
|
|
29
|
+
{ field: 'title', condition: search_enum_1.ESearchCondition.contains },
|
|
30
|
+
{ field: 'description', condition: search_enum_1.ESearchCondition.contains },
|
|
31
|
+
{ field: 'slug', condition: search_enum_1.ESearchCondition.equal },
|
|
32
|
+
{ field: 'parentId', condition: search_enum_1.ESearchCondition.equal },
|
|
33
|
+
];
|
|
34
|
+
this.formatSearchQuery = async ({ parentSlug, ...query }) => {
|
|
35
|
+
if (parentSlug) {
|
|
36
|
+
const parent = await this.repo.findOne({
|
|
37
|
+
where: { slug: parentSlug },
|
|
38
|
+
select: { id: true },
|
|
39
|
+
});
|
|
40
|
+
if (!parent)
|
|
41
|
+
utility_service_1.UtilityClass.throwError({
|
|
42
|
+
message: `Parent ${parentSlug} could not be found`,
|
|
43
|
+
});
|
|
44
|
+
query.parentId = parent.id;
|
|
45
|
+
}
|
|
46
|
+
return query;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async _createChecks(data) {
|
|
50
|
+
if (data.parentId && !(await this.checkIfExistsBy({ id: data.parentId })))
|
|
51
|
+
utility_service_1.UtilityClass.throwError({
|
|
52
|
+
statusCode: 404,
|
|
53
|
+
message: `Parent does not exist`,
|
|
54
|
+
});
|
|
55
|
+
if (await this.checkIfExistsBy({ parentId: data.parentId, slug: data.slug }))
|
|
56
|
+
utility_service_1.UtilityClass.throwError({
|
|
57
|
+
statusCode: 409,
|
|
58
|
+
message: `Slug already exists`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async _updateChecks(id, data) {
|
|
62
|
+
if (data.parentId && !(await this.checkIfExistsBy({ id: data.parentId })))
|
|
63
|
+
utility_service_1.UtilityClass.throwError({
|
|
64
|
+
statusCode: 404,
|
|
65
|
+
message: `Parent does not exist`,
|
|
66
|
+
});
|
|
67
|
+
if (await this.checkIfExistsBy({
|
|
68
|
+
parentId: data.parentId,
|
|
69
|
+
slug: data.slug,
|
|
70
|
+
id: (0, typeorm_1.Not)(id),
|
|
71
|
+
}))
|
|
72
|
+
utility_service_1.UtilityClass.throwError({
|
|
73
|
+
statusCode: 409,
|
|
74
|
+
message: `Slug already exists`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getBySlug(query) {
|
|
78
|
+
return this.repo.find({
|
|
79
|
+
where: { slug: query.slug, parent: { slug: query.parentSlug } },
|
|
80
|
+
select: {
|
|
81
|
+
title: true,
|
|
82
|
+
id: true,
|
|
83
|
+
slug: true,
|
|
84
|
+
description: true,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.CategoryService = CategoryService;
|
|
90
|
+
exports.CategoryService = CategoryService = __decorate([
|
|
91
|
+
(0, common_1.Injectable)(),
|
|
92
|
+
__param(0, (0, typeorm_2.InjectRepository)(category_entity_1.CategoryEntity)),
|
|
93
|
+
__metadata("design:paramtypes", [typeorm_1.Repository])
|
|
94
|
+
], CategoryService);
|
|
95
|
+
//# sourceMappingURL=category.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.service.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,8DAA0D;AAC1D,uDAAmD;AACnD,qCAA0C;AAC1C,6CAAmD;AACnD,qDAAmD;AAOnD,oEAA8D;AAC9D,yDAA2D;AAGpD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,0BAGpC;IACC,YAEkB,IAAgC;QAEhD,KAAK,CAAC,IAAI,EAAE,sBAAU,CAAC,QAAQ,CAAC,CAAC;QAFjB,SAAI,GAAJ,IAAI,CAA4B;QAGhD,IAAI,CAAC,WAAW,GAAG;YACjB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
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const category_service_1 = require("./category.service");
|
|
5
|
+
describe('CategoryService', () => {
|
|
6
|
+
let service;
|
|
7
|
+
beforeEach(async () => {
|
|
8
|
+
const module = await testing_1.Test.createTestingModule({
|
|
9
|
+
providers: [category_service_1.CategoryService],
|
|
10
|
+
}).compile();
|
|
11
|
+
service = module.get(category_service_1.CategoryService);
|
|
12
|
+
});
|
|
13
|
+
it('should be defined', () => {
|
|
14
|
+
expect(service).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=category.service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.service.spec.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/category/category.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,yDAAqD;AAErD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,OAAwB,CAAC;IAE7B,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE,CAAC,kCAAe,CAAC;SAC7B,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,GAAG,MAAM,CAAC,GAAG,CAAkB,kCAAe,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -8,5 +8,5 @@ export declare class CronController extends BaseController<CronEntity, CronSearc
|
|
|
8
8
|
subject: string;
|
|
9
9
|
constructor(service: CronService);
|
|
10
10
|
getCronTypes(): Promise<string | (string | ECronType)[]>;
|
|
11
|
-
search(query: CronSearchQueryDTO): Promise<import("../..").ISearchResponse<CronEntity>>;
|
|
11
|
+
search(query: CronSearchQueryDTO): Promise<string | import("../..").ISearchResponse<CronEntity>>;
|
|
12
12
|
}
|
|
@@ -7,5 +7,5 @@ export declare class LogsController extends BaseController<LogEntity, LogSerarch
|
|
|
7
7
|
constructor(service: LogsService);
|
|
8
8
|
create(body: LogCreateSingleDTO): Promise<string | LogEntity>;
|
|
9
9
|
multiple(body: LogCreateMultipleDTO): Promise<string>;
|
|
10
|
-
search(query: LogSerarchDTO): Promise<import("../..").ISearchResponse<LogEntity>>;
|
|
10
|
+
search(query: LogSerarchDTO): Promise<string | import("../..").ISearchResponse<LogEntity>>;
|
|
11
11
|
}
|
|
@@ -7,5 +7,5 @@ export declare class MessageController extends BaseController<MessageEntity, Mes
|
|
|
7
7
|
constructor(service: MessageService);
|
|
8
8
|
create(body: CreateMessageDTO): Promise<string | MessageEntity[]>;
|
|
9
9
|
multiple(body: CreateBatchMessagesDTO): Promise<string | MessageEntity[]>;
|
|
10
|
-
search(query: MessageSearchDTO): Promise<import("../..").ISearchResponse<MessageEntity>>;
|
|
10
|
+
search(query: MessageSearchDTO): Promise<string | import("../..").ISearchResponse<MessageEntity>>;
|
|
11
11
|
}
|
|
@@ -10,7 +10,7 @@ export declare class NotificationController extends BaseController<NotificationE
|
|
|
10
10
|
protected itemService: NotificationItemService;
|
|
11
11
|
constructor(service: NotificationService, itemService: NotificationItemService);
|
|
12
12
|
create(body: CreateNotificationDTO, auth: IAuthParam): Promise<string | NotificationEntity>;
|
|
13
|
-
search(query: NotificationQueryDTO): Promise<import("../..").ISearchResponse<NotificationEntity>>;
|
|
13
|
+
search(query: NotificationQueryDTO): Promise<string | import("../..").ISearchResponse<NotificationEntity>>;
|
|
14
14
|
getMySentNotifications(query: SearchQueryDto, auth: IAuthParam): Promise<string | import("../..").ISearchResponse<NotificationEntity>>;
|
|
15
15
|
getMyUnreadNotificationsCount(auth: IAuthParam): Promise<string | {
|
|
16
16
|
count: number;
|
|
@@ -15,15 +15,21 @@ export declare class SDKBaseService<TEntity extends BaseEntity, TSearchDto exten
|
|
|
15
15
|
getById(id: string): Promise<TEntity>;
|
|
16
16
|
getWhere(where: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[]): Promise<TEntity[]>;
|
|
17
17
|
checkIfExistsById(id: string): Promise<boolean>;
|
|
18
|
+
checkIfExistsBy(where: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[]): Promise<boolean>;
|
|
18
19
|
find(where?: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[]): Promise<TEntity[]>;
|
|
19
20
|
getAllIDs(where?: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[]): Promise<string[]>;
|
|
20
21
|
findOne(data: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[]): Promise<TEntity>;
|
|
21
22
|
_updateByID(id: string, data: Partial<TEntity>): Promise<TEntity>;
|
|
22
23
|
_deleteByID(id: string): Promise<boolean>;
|
|
24
|
+
_deleteByIDs(ids: string[]): Promise<boolean>;
|
|
23
25
|
formatSearchQuery: (query: TSearchDto) => Promise<TSearchDto>;
|
|
24
26
|
formatSearchResults: (results: ISearchResponse<TEntity>) => Promise<ISearchResponse<TEntity>>;
|
|
25
27
|
search(query: TSearchDto): Promise<ISearchResponse<TEntity>>;
|
|
26
28
|
protected _save(data: Partial<TEntity>): Promise<Partial<TEntity> & BaseEntity<any>>;
|
|
29
|
+
_deleteByIDChecks(id: string): Promise<string>;
|
|
30
|
+
_deleteChecks(ids: string[]): Promise<string[]>;
|
|
31
|
+
_updateChecks(id: string, data: any): Promise<any>;
|
|
32
|
+
_createChecks(data: any): Promise<any>;
|
|
27
33
|
_create(data: Partial<TEntity>): Promise<TEntity>;
|
|
28
34
|
count(where?: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[]): Promise<number>;
|
|
29
35
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseService = exports.SDKBaseService = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
4
5
|
const search_service_1 = require("./search.service");
|
|
5
6
|
class SDKBaseService {
|
|
6
7
|
get queryStruct() {
|
|
@@ -29,11 +30,14 @@ class SDKBaseService {
|
|
|
29
30
|
return (await this.repo.findBy(where));
|
|
30
31
|
}
|
|
31
32
|
async checkIfExistsById(id) {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
return this.checkIfExistsBy({ id });
|
|
34
|
+
}
|
|
35
|
+
async checkIfExistsBy(where) {
|
|
36
|
+
const exists = await this.repo.exist({
|
|
37
|
+
where,
|
|
34
38
|
select: { id: true },
|
|
35
39
|
});
|
|
36
|
-
return
|
|
40
|
+
return exists;
|
|
37
41
|
}
|
|
38
42
|
async find(where) {
|
|
39
43
|
const item = await this.repo.findBy(where);
|
|
@@ -46,13 +50,20 @@ class SDKBaseService {
|
|
|
46
50
|
return (await this.find(data))?.[0];
|
|
47
51
|
}
|
|
48
52
|
async _updateByID(id, data) {
|
|
53
|
+
await this._updateChecks?.(id, data);
|
|
49
54
|
await this.repo.update({ id }, data);
|
|
50
55
|
return this.getById(id);
|
|
51
56
|
}
|
|
52
57
|
async _deleteByID(id) {
|
|
58
|
+
await this._deleteByIDChecks?.(id);
|
|
53
59
|
await this.repo.delete({ id });
|
|
54
60
|
return true;
|
|
55
61
|
}
|
|
62
|
+
async _deleteByIDs(ids) {
|
|
63
|
+
await this._deleteChecks?.(ids);
|
|
64
|
+
await this.repo.delete({ id: (0, typeorm_1.In)(ids) });
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
56
67
|
async search(query) {
|
|
57
68
|
const res = await search_service_1.SearchService.search({
|
|
58
69
|
repository: this.repo,
|
|
@@ -73,9 +84,23 @@ class SDKBaseService {
|
|
|
73
84
|
? this._updateByID(data.id, data)
|
|
74
85
|
: this.repo.save(data));
|
|
75
86
|
}
|
|
87
|
+
async _deleteByIDChecks(id) {
|
|
88
|
+
return id;
|
|
89
|
+
}
|
|
90
|
+
async _deleteChecks(ids) {
|
|
91
|
+
return ids;
|
|
92
|
+
}
|
|
93
|
+
async _updateChecks(id, data) {
|
|
94
|
+
return data;
|
|
95
|
+
}
|
|
96
|
+
async _createChecks(data) {
|
|
97
|
+
return data;
|
|
98
|
+
}
|
|
76
99
|
async _create(data) {
|
|
77
100
|
delete data.id;
|
|
78
|
-
|
|
101
|
+
await this._createChecks?.(data);
|
|
102
|
+
const entity = (await this._save(data));
|
|
103
|
+
return this.getById(entity.id);
|
|
79
104
|
}
|
|
80
105
|
async count(where) {
|
|
81
106
|
return this.repo.count({ where });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.service.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/services/base.service.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base.service.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/services/base.service.ts"],"names":[],"mappings":";;;AAAA,qCAA2D;AAC3D,qDAAiD;AASjD,MAAa,cAAc;IAKzB,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAW,WAAW,CAAC,KAAqC;QAC1D,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,OAAO,CACL,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACjE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,YACqB,IAA4B,EACxC,SAAiB;QADL,SAAI,GAAJ,IAA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