@serene-dev/la-nest-library 0.0.92 → 0.0.93

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.
Files changed (22) hide show
  1. package/dist/libs/la-library/src/enums/base.enum.d.ts +3 -1
  2. package/dist/libs/la-library/src/enums/base.enum.js +2 -0
  3. package/dist/libs/la-library/src/enums/base.enum.js.map +1 -1
  4. package/dist/libs/la-library/src/index.d.ts +5 -0
  5. package/dist/libs/la-library/src/index.js +18 -2
  6. package/dist/libs/la-library/src/index.js.map +1 -1
  7. package/dist/libs/la-library/src/modules/notifications/notification.controller.d.ts +22 -0
  8. package/dist/libs/la-library/src/modules/notifications/notification.controller.js +179 -0
  9. package/dist/libs/la-library/src/modules/notifications/notification.controller.js.map +1 -0
  10. package/dist/libs/la-library/src/modules/notifications/notification.dto.d.ts +24 -0
  11. package/dist/libs/la-library/src/modules/notifications/notification.dto.js +101 -0
  12. package/dist/libs/la-library/src/modules/notifications/notification.dto.js.map +1 -0
  13. package/dist/libs/la-library/src/modules/notifications/notification.entity.d.ts +23 -0
  14. package/dist/libs/la-library/src/modules/notifications/notification.entity.js +97 -0
  15. package/dist/libs/la-library/src/modules/notifications/notification.entity.js.map +1 -0
  16. package/dist/libs/la-library/src/modules/notifications/notification.module.d.ts +4 -0
  17. package/dist/libs/la-library/src/modules/notifications/notification.module.js +30 -0
  18. package/dist/libs/la-library/src/modules/notifications/notification.module.js.map +1 -0
  19. package/dist/libs/la-library/src/modules/notifications/notification.service.d.ts +36 -0
  20. package/dist/libs/la-library/src/modules/notifications/notification.service.js +161 -0
  21. package/dist/libs/la-library/src/modules/notifications/notification.service.js.map +1 -0
  22. package/package.json +1 -1
@@ -8,7 +8,9 @@ export declare enum ETableName {
8
8
  tokenSession = "token_session",
9
9
  authSession = "authentication_session",
10
10
  fileBin = "file_bin",
11
- user = "user"
11
+ user = "user",
12
+ notification = "notification",
13
+ notificationStatus = "notificationStatus"
12
14
  }
13
15
  export declare enum ERefCat {
14
16
  file = "file"
@@ -13,6 +13,8 @@ var ETableName;
13
13
  ETableName["authSession"] = "authentication_session";
14
14
  ETableName["fileBin"] = "file_bin";
15
15
  ETableName["user"] = "user";
16
+ ETableName["notification"] = "notification";
17
+ ETableName["notificationStatus"] = "notificationStatus";
16
18
  })(ETableName || (exports.ETableName = ETableName = {}));
17
19
  var ERefCat;
18
20
  (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,UAWX;AAXD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,2CAA6B,CAAA;IAC7B,+CAAiC,CAAA;IACjC,4CAA8B,CAAA;IAC9B,oDAAsC,CAAA;IACtC,kCAAoB,CAAA;IACpB,2BAAa,CAAA;AACf,CAAC,EAXW,UAAU,0BAAV,UAAU,QAWrB;AAED,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,wBAAa,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
1
+ {"version":3,"file":"base.enum.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/enums/base.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,2CAA6B,CAAA;IAC7B,+CAAiC,CAAA;IACjC,4CAA8B,CAAA;IAC9B,oDAAsC,CAAA;IACtC,kCAAoB,CAAA;IACpB,2BAAa,CAAA;IACb,2CAA6B,CAAA;IAC7B,uDAAyC,CAAA;AAC3C,CAAC,EAbW,UAAU,0BAAV,UAAU,QAarB;AAED,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,wBAAa,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
@@ -38,6 +38,11 @@ export { LogsService as SDKLogsService } from './modules/logs/logs.service';
38
38
  export { LogSerarchDTO as SDKLogSerarchDTO, LogCreateMultipleDTO as SDKLogCreateMultipleDTO, LogCreateSingleDTO as SDKLogCreateSingleDTO, } from './modules/logs/logs.dto';
39
39
  export { LogsController as SDKLogsController } from './modules/logs/logs.controller';
40
40
  export { LogEntity as SDKLogEntity } from './modules/logs/logs.entity';
41
+ export { NotificationController as SDKNotificationController } from './modules/notifications/notification.controller';
42
+ export { CreateNotificationDTO as SDKCreateNotificationDTO, NotificationItemQueryDTO as SDKNotificationItemQueryDTO, NotificationQueryDTO as SDKNotificationQueryDTO, NotificationToggleActiveStatusDTO as SDKNotificationToggleActiveStatusDTO, } from './modules/notifications/notification.dto';
43
+ export { NotificationEntity as SDKNotificationEntity, NotificationItemEntity as SDKNotificationItemEntity, notificationEntities as SDKnotificationEntities, } from './modules/notifications/notification.entity';
44
+ export { NotificationModule as SDKNotificationModule } from './modules/notifications/notification.module';
45
+ export { NotificationService as SDKNotificationService, NotificationItemService as SDKNotificationItemService, } from './modules/notifications/notification.service';
41
46
  export { ListsModule as SDKListsModule } from './modules/lists/lists.module';
42
47
  export { ListsService as SDKListsService } from './modules/lists/lists.service';
43
48
  export { SaveListGroupDTO as SDKSaveListGroupDTO, SaveListOption as SDKSaveListOption, } from './modules/lists/lists.dto';
@@ -14,8 +14,8 @@ 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.SDKListsController = exports.SDKSaveListOption = exports.SDKSaveListGroupDTO = exports.SDKListsService = exports.SDKListsModule = exports.SDKLogEntity = exports.SDKLogsController = exports.SDKLogCreateSingleDTO = exports.SDKLogCreateMultipleDTO = exports.SDKLogSerarchDTO = exports.SDKLogsService = exports.SDKLogsModule = exports.stream = exports.logger = exports.SDKLikesService = exports.SDKFileService = exports.FileEntity = exports.FileBinEntity = exports.LikesEntity = exports.SDKFileController = exports.SDKEFileSizeUnit = exports.SDKSample = exports.SDKBaseDto = exports.BaseEntity = exports.SDKBaseService = exports.SDKBaseController = 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.MailService = exports.SDKUtilityClass = exports.SDKETableName = exports.SDKERefCat = exports.SDKEnvironmentService = exports.SDKConfig = void 0;
18
- exports.ESortOrder = exports.ESearchCondition = exports.SDKSearchService = exports.SearchQueryDto = exports.SDKFileUploadDto = exports.SDKFileUpdateDto = exports.SDKFileSearchDto = exports.SDKFileActionDto = exports.SDKListsEntity = exports.SDKListOptionsEntity = void 0;
17
+ exports.SDKNotificationToggleActiveStatusDTO = exports.SDKNotificationQueryDTO = exports.SDKNotificationItemQueryDTO = exports.SDKCreateNotificationDTO = exports.SDKNotificationController = exports.SDKLogEntity = exports.SDKLogsController = exports.SDKLogCreateSingleDTO = exports.SDKLogCreateMultipleDTO = exports.SDKLogSerarchDTO = exports.SDKLogsService = exports.SDKLogsModule = exports.stream = exports.logger = exports.SDKLikesService = exports.SDKFileService = exports.FileEntity = exports.FileBinEntity = exports.LikesEntity = exports.SDKFileController = exports.SDKEFileSizeUnit = exports.SDKSample = exports.SDKBaseDto = exports.BaseEntity = exports.SDKBaseService = exports.SDKBaseController = 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.MailService = exports.SDKUtilityClass = exports.SDKETableName = exports.SDKERefCat = exports.SDKEnvironmentService = exports.SDKConfig = void 0;
18
+ 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.SDKNotificationItemService = exports.SDKNotificationService = exports.SDKNotificationModule = exports.SDKnotificationEntities = exports.SDKNotificationItemEntity = exports.SDKNotificationEntity = void 0;
19
19
  __exportStar(require("./la-library.module"), exports);
20
20
  var index_config_1 = require("./configs/index.config");
21
21
  Object.defineProperty(exports, "SDKConfig", { enumerable: true, get: function () { return index_config_1.SDKConfig; } });
@@ -100,6 +100,22 @@ var logs_controller_1 = require("./modules/logs/logs.controller");
100
100
  Object.defineProperty(exports, "SDKLogsController", { enumerable: true, get: function () { return logs_controller_1.LogsController; } });
101
101
  var logs_entity_1 = require("./modules/logs/logs.entity");
102
102
  Object.defineProperty(exports, "SDKLogEntity", { enumerable: true, get: function () { return logs_entity_1.LogEntity; } });
103
+ var notification_controller_1 = require("./modules/notifications/notification.controller");
104
+ Object.defineProperty(exports, "SDKNotificationController", { enumerable: true, get: function () { return notification_controller_1.NotificationController; } });
105
+ var notification_dto_1 = require("./modules/notifications/notification.dto");
106
+ Object.defineProperty(exports, "SDKCreateNotificationDTO", { enumerable: true, get: function () { return notification_dto_1.CreateNotificationDTO; } });
107
+ Object.defineProperty(exports, "SDKNotificationItemQueryDTO", { enumerable: true, get: function () { return notification_dto_1.NotificationItemQueryDTO; } });
108
+ Object.defineProperty(exports, "SDKNotificationQueryDTO", { enumerable: true, get: function () { return notification_dto_1.NotificationQueryDTO; } });
109
+ Object.defineProperty(exports, "SDKNotificationToggleActiveStatusDTO", { enumerable: true, get: function () { return notification_dto_1.NotificationToggleActiveStatusDTO; } });
110
+ var notification_entity_1 = require("./modules/notifications/notification.entity");
111
+ Object.defineProperty(exports, "SDKNotificationEntity", { enumerable: true, get: function () { return notification_entity_1.NotificationEntity; } });
112
+ Object.defineProperty(exports, "SDKNotificationItemEntity", { enumerable: true, get: function () { return notification_entity_1.NotificationItemEntity; } });
113
+ Object.defineProperty(exports, "SDKnotificationEntities", { enumerable: true, get: function () { return notification_entity_1.notificationEntities; } });
114
+ var notification_module_1 = require("./modules/notifications/notification.module");
115
+ Object.defineProperty(exports, "SDKNotificationModule", { enumerable: true, get: function () { return notification_module_1.NotificationModule; } });
116
+ var notification_service_1 = require("./modules/notifications/notification.service");
117
+ Object.defineProperty(exports, "SDKNotificationService", { enumerable: true, get: function () { return notification_service_1.NotificationService; } });
118
+ Object.defineProperty(exports, "SDKNotificationItemService", { enumerable: true, get: function () { return notification_service_1.NotificationItemService; } });
103
119
  var lists_module_1 = require("./modules/lists/lists.module");
104
120
  Object.defineProperty(exports, "SDKListsModule", { enumerable: true, get: function () { return lists_module_1.ListsModule; } });
105
121
  var lists_service_1 = require("./modules/lists/lists.service");
@@ -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,sEAGwC;AAFtC,4HAAA,qBAAqB,OAAA;AAGvB,+CAG2B;AAFzB,uGAAA,OAAO,OAAc;AACrB,0GAAA,UAAU,OAAiB;AAE7B,8DAA6E;AAApE,kHAAA,YAAY,OAAmB;AACxC,wDAAsD;AAA7C,2GAAA,WAA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AA,aAAa,OAAoB;AAC1C,mDAAmE;AAA1D,+GAAA,gBAAgB,OAAA;AAAE,yGAAA,UAAU,OAAA;AACrC,gEAA8C"}
@@ -0,0 +1,22 @@
1
+ import { NotificationItemService, NotificationService } from './notification.service';
2
+ import { NotificationEntity } from './notification.entity';
3
+ import { CreateNotificationDTO, NotificationQueryDTO, NotificationToggleActiveStatusDTO } from './notification.dto';
4
+ import { BaseController } from '../../controllers/base.controller';
5
+ import { IAuthParam } from '../authentication/authentication.interface';
6
+ import { SearchQueryDto } from '../../dtos/search.dto';
7
+ import { IDDto } from '../../dtos/base.dto';
8
+ export declare class NotificationController extends BaseController<NotificationEntity, NotificationQueryDTO> {
9
+ protected service: NotificationService;
10
+ protected itemService: NotificationItemService;
11
+ constructor(service: NotificationService, itemService: NotificationItemService);
12
+ create(body: CreateNotificationDTO, auth: IAuthParam): Promise<string | NotificationEntity>;
13
+ search(query: NotificationQueryDTO): Promise<import("../..").ISearchResponse<NotificationEntity>>;
14
+ getMySentNotifications(query: SearchQueryDto, auth: IAuthParam): Promise<string | import("../..").ISearchResponse<NotificationEntity>>;
15
+ getMyUnreadNotificationsCount(auth: IAuthParam): Promise<string | {
16
+ count: number;
17
+ }>;
18
+ getMyRecievedNotifications(query: SearchQueryDto, auth: IAuthParam): Promise<string | import("../..").ISearchResponse<import("./notification.entity").NotificationItemEntity>>;
19
+ toggleStatus(body: NotificationToggleActiveStatusDTO, auth: IAuthParam, param: IDDto): Promise<string | NotificationEntity>;
20
+ resend(auth: IAuthParam, param: IDDto): Promise<string | NotificationEntity>;
21
+ markAsRead(auth: IAuthParam, param: IDDto): Promise<string | import("./notification.entity").NotificationItemEntity>;
22
+ }
@@ -0,0 +1,179 @@
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.NotificationController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const swagger_1 = require("@nestjs/swagger");
18
+ const notification_service_1 = require("./notification.service");
19
+ const notification_dto_1 = require("./notification.dto");
20
+ const base_controller_1 = require("../../controllers/base.controller");
21
+ const authentication_guard_1 = require("../authentication/authentication.guard");
22
+ const utility_service_1 = require("../../services/utility.service");
23
+ const search_dto_1 = require("../../dtos/search.dto");
24
+ const base_dto_1 = require("../../dtos/base.dto");
25
+ let NotificationController = class NotificationController extends base_controller_1.BaseController {
26
+ constructor(service, itemService) {
27
+ super(service);
28
+ this.service = service;
29
+ this.itemService = itemService;
30
+ }
31
+ async create(body, auth) {
32
+ try {
33
+ body.creatorId = auth?.id;
34
+ return utility_service_1.UtilityClass.handleSuccess({
35
+ data: await this.service.create(body),
36
+ });
37
+ }
38
+ catch (error) {
39
+ return utility_service_1.UtilityClass.handleError(error);
40
+ }
41
+ }
42
+ async search(query) {
43
+ return super.search(query);
44
+ }
45
+ async getMySentNotifications(query, auth) {
46
+ try {
47
+ return utility_service_1.UtilityClass.handleSuccess({
48
+ data: await this.service.getMySentNotifications(auth.id, query),
49
+ });
50
+ }
51
+ catch (error) {
52
+ return utility_service_1.UtilityClass.handleError(error);
53
+ }
54
+ }
55
+ async getMyUnreadNotificationsCount(auth) {
56
+ try {
57
+ return utility_service_1.UtilityClass.handleSuccess({
58
+ data: await this.service.getMyUnreadNotificationsCount(auth.id),
59
+ });
60
+ }
61
+ catch (error) {
62
+ return utility_service_1.UtilityClass.handleError(error);
63
+ }
64
+ }
65
+ async getMyRecievedNotifications(query, auth) {
66
+ try {
67
+ return utility_service_1.UtilityClass.handleSuccess({
68
+ data: await this.itemService.getMyReceivedNotifications(auth.id, query),
69
+ });
70
+ }
71
+ catch (error) {
72
+ return utility_service_1.UtilityClass.handleError(error);
73
+ }
74
+ }
75
+ async toggleStatus(body, auth, param) {
76
+ try {
77
+ utility_service_1.UtilityClass.patchUpdater(body, auth);
78
+ return utility_service_1.UtilityClass.handleSuccess({
79
+ data: await this.service.toggleActiveStatus(param, body),
80
+ });
81
+ }
82
+ catch (error) {
83
+ return utility_service_1.UtilityClass.handleError(error);
84
+ }
85
+ }
86
+ async resend(auth, param) {
87
+ try {
88
+ return utility_service_1.UtilityClass.handleSuccess({
89
+ data: await this.service.resend(param.id, auth),
90
+ });
91
+ }
92
+ catch (error) {
93
+ return utility_service_1.UtilityClass.handleError(error);
94
+ }
95
+ }
96
+ async markAsRead(auth, param) {
97
+ try {
98
+ const res = await this.itemService.markAsRead(param, auth.id);
99
+ this.service.calculateSeen(res.notification.id);
100
+ return utility_service_1.UtilityClass.handleSuccess({
101
+ data: res,
102
+ });
103
+ }
104
+ catch (error) {
105
+ return utility_service_1.UtilityClass.handleError(error);
106
+ }
107
+ }
108
+ };
109
+ exports.NotificationController = NotificationController;
110
+ __decorate([
111
+ (0, common_1.Post)(),
112
+ __param(0, (0, common_1.Body)()),
113
+ __param(1, (0, authentication_guard_1.AuthParam)()),
114
+ __metadata("design:type", Function),
115
+ __metadata("design:paramtypes", [notification_dto_1.CreateNotificationDTO, Object]),
116
+ __metadata("design:returntype", Promise)
117
+ ], NotificationController.prototype, "create", null);
118
+ __decorate([
119
+ (0, common_1.Get)('search'),
120
+ __param(0, (0, common_1.Query)()),
121
+ __metadata("design:type", Function),
122
+ __metadata("design:paramtypes", [notification_dto_1.NotificationQueryDTO]),
123
+ __metadata("design:returntype", Promise)
124
+ ], NotificationController.prototype, "search", null);
125
+ __decorate([
126
+ (0, common_1.Get)('sent'),
127
+ __param(0, (0, common_1.Query)()),
128
+ __param(1, (0, authentication_guard_1.AuthParam)()),
129
+ __metadata("design:type", Function),
130
+ __metadata("design:paramtypes", [search_dto_1.SearchQueryDto, Object]),
131
+ __metadata("design:returntype", Promise)
132
+ ], NotificationController.prototype, "getMySentNotifications", null);
133
+ __decorate([
134
+ (0, common_1.Get)('unreadCount'),
135
+ __param(0, (0, authentication_guard_1.AuthParam)()),
136
+ __metadata("design:type", Function),
137
+ __metadata("design:paramtypes", [Object]),
138
+ __metadata("design:returntype", Promise)
139
+ ], NotificationController.prototype, "getMyUnreadNotificationsCount", null);
140
+ __decorate([
141
+ (0, common_1.Get)('received'),
142
+ __param(0, (0, common_1.Query)()),
143
+ __param(1, (0, authentication_guard_1.AuthParam)()),
144
+ __metadata("design:type", Function),
145
+ __metadata("design:paramtypes", [search_dto_1.SearchQueryDto, Object]),
146
+ __metadata("design:returntype", Promise)
147
+ ], NotificationController.prototype, "getMyRecievedNotifications", null);
148
+ __decorate([
149
+ (0, common_1.Patch)('toggle/:id'),
150
+ __param(0, (0, common_1.Body)()),
151
+ __param(1, (0, authentication_guard_1.AuthParam)()),
152
+ __param(2, (0, common_1.Param)()),
153
+ __metadata("design:type", Function),
154
+ __metadata("design:paramtypes", [notification_dto_1.NotificationToggleActiveStatusDTO, Object, base_dto_1.IDDto]),
155
+ __metadata("design:returntype", Promise)
156
+ ], NotificationController.prototype, "toggleStatus", null);
157
+ __decorate([
158
+ (0, common_1.Put)('resend/:id'),
159
+ __param(0, (0, authentication_guard_1.AuthParam)()),
160
+ __param(1, (0, common_1.Param)()),
161
+ __metadata("design:type", Function),
162
+ __metadata("design:paramtypes", [Object, base_dto_1.IDDto]),
163
+ __metadata("design:returntype", Promise)
164
+ ], NotificationController.prototype, "resend", null);
165
+ __decorate([
166
+ (0, common_1.Patch)('read/:id'),
167
+ __param(0, (0, authentication_guard_1.AuthParam)()),
168
+ __param(1, (0, common_1.Param)()),
169
+ __metadata("design:type", Function),
170
+ __metadata("design:paramtypes", [Object, base_dto_1.IDDto]),
171
+ __metadata("design:returntype", Promise)
172
+ ], NotificationController.prototype, "markAsRead", null);
173
+ exports.NotificationController = NotificationController = __decorate([
174
+ (0, swagger_1.ApiTags)(notification_service_1.NotificationService.tag),
175
+ (0, common_1.Controller)(notification_service_1.NotificationService.path),
176
+ __metadata("design:paramtypes", [notification_service_1.NotificationService,
177
+ notification_service_1.NotificationItemService])
178
+ ], NotificationController);
179
+ //# sourceMappingURL=notification.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.controller.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/notifications/notification.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,6CAA0C;AAC1C,iEAGgC;AAEhC,yDAI4B;AAC5B,uEAAmE;AAEnE,iFAAmE;AACnE,oEAA8D;AAC9D,sDAAuD;AACvD,kDAA4C;AAMrC,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,gCAG3C;IACC,YACY,OAA4B,EAC5B,WAAoC;QAE9C,KAAK,CAAC,OAAO,CAAC,CAAC;QAHL,YAAO,GAAP,OAAO,CAAqB;QAC5B,gBAAW,GAAX,WAAW,CAAyB;IAGhD,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CACF,IAA2B,EACtB,IAAgB;QAE7B,IAAI,CAAC;YACH,IAAI,CAAC,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;YAC1B,OAAO,8BAAY,CAAC,aAAa,CAAC;gBAChC,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;aACtC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,8BAAY,CAAC,WAAW,CAAC,KAAK,CAAC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emEntity } from './notification.entity';
2
+ import { SearchQueryDto } from '../../dtos/search.dto';
3
+ import { BaseDto } from '../../dtos/base.dto';
4
+ export declare class NotificationItemQueryDTO extends SearchQueryDto implements Partial<NotificationItemEntity> {
5
+ active?: boolean;
6
+ seen?: boolean;
7
+ notification?: NotificationEntity;
8
+ }
9
+ export declare class NotificationQueryDTO extends NotificationItemQueryDTO implements Partial<NotificationEntity> {
10
+ sender?: string;
11
+ refCat?: string;
12
+ }
13
+ export declare class NotificationToggleActiveStatusDTO extends BaseDto implements Partial<NotificationEntity> {
14
+ active?: boolean;
15
+ }
16
+ export declare class CreateNotificationDTO extends BaseDto implements Partial<NotificationEntity> {
17
+ message: string;
18
+ receiverIDs?: string[];
19
+ subject: string;
20
+ toManager?: boolean;
21
+ sender?: string;
22
+ refID?: string;
23
+ refCat?: string;
24
+ }
@@ -0,0 +1,101 @@
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.CreateNotificationDTO = exports.NotificationToggleActiveStatusDTO = exports.NotificationQueryDTO = exports.NotificationItemQueryDTO = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ const search_dto_1 = require("../../dtos/search.dto");
16
+ const base_dto_1 = require("../../dtos/base.dto");
17
+ class NotificationItemQueryDTO extends search_dto_1.SearchQueryDto {
18
+ }
19
+ exports.NotificationItemQueryDTO = NotificationItemQueryDTO;
20
+ __decorate([
21
+ (0, swagger_1.ApiPropertyOptional)(),
22
+ (0, class_validator_1.IsOptional)(),
23
+ (0, class_validator_1.IsBoolean)(),
24
+ __metadata("design:type", Boolean)
25
+ ], NotificationItemQueryDTO.prototype, "active", void 0);
26
+ __decorate([
27
+ (0, swagger_1.ApiPropertyOptional)(),
28
+ (0, class_validator_1.IsOptional)(),
29
+ (0, class_validator_1.IsBoolean)(),
30
+ __metadata("design:type", Boolean)
31
+ ], NotificationItemQueryDTO.prototype, "seen", void 0);
32
+ class NotificationQueryDTO extends NotificationItemQueryDTO {
33
+ }
34
+ exports.NotificationQueryDTO = NotificationQueryDTO;
35
+ __decorate([
36
+ (0, swagger_1.ApiPropertyOptional)(),
37
+ (0, class_validator_1.IsOptional)(),
38
+ (0, class_validator_1.IsString)(),
39
+ __metadata("design:type", String)
40
+ ], NotificationQueryDTO.prototype, "sender", void 0);
41
+ __decorate([
42
+ (0, swagger_1.ApiPropertyOptional)({}),
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, class_validator_1.IsString)(),
45
+ __metadata("design:type", String)
46
+ ], NotificationQueryDTO.prototype, "refCat", void 0);
47
+ class NotificationToggleActiveStatusDTO extends base_dto_1.BaseDto {
48
+ }
49
+ exports.NotificationToggleActiveStatusDTO = NotificationToggleActiveStatusDTO;
50
+ __decorate([
51
+ (0, swagger_1.ApiPropertyOptional)(),
52
+ (0, class_validator_1.IsOptional)(),
53
+ (0, class_validator_1.IsBoolean)(),
54
+ __metadata("design:type", Boolean)
55
+ ], NotificationToggleActiveStatusDTO.prototype, "active", void 0);
56
+ class CreateNotificationDTO extends base_dto_1.BaseDto {
57
+ }
58
+ exports.CreateNotificationDTO = CreateNotificationDTO;
59
+ __decorate([
60
+ (0, class_validator_1.IsString)(),
61
+ (0, swagger_1.ApiProperty)(),
62
+ __metadata("design:type", String)
63
+ ], CreateNotificationDTO.prototype, "message", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsArray)(),
66
+ (0, class_validator_1.IsOptional)(),
67
+ (0, swagger_1.ApiProperty)({
68
+ type: [String],
69
+ required: false,
70
+ description: `In case you want to specify the receivers by their IDs`,
71
+ }),
72
+ __metadata("design:type", Array)
73
+ ], CreateNotificationDTO.prototype, "receiverIDs", void 0);
74
+ __decorate([
75
+ (0, class_validator_1.IsString)(),
76
+ (0, swagger_1.ApiProperty)(),
77
+ __metadata("design:type", String)
78
+ ], CreateNotificationDTO.prototype, "subject", void 0);
79
+ __decorate([
80
+ (0, class_validator_1.IsBoolean)(),
81
+ (0, class_validator_1.IsOptional)(),
82
+ (0, swagger_1.ApiProperty)({ required: false }),
83
+ __metadata("design:type", Boolean)
84
+ ], CreateNotificationDTO.prototype, "toManager", void 0);
85
+ __decorate([
86
+ (0, class_validator_1.IsString)(),
87
+ (0, class_validator_1.IsOptional)(),
88
+ (0, swagger_1.ApiProperty)(),
89
+ __metadata("design:type", String)
90
+ ], CreateNotificationDTO.prototype, "sender", void 0);
91
+ __decorate([
92
+ (0, class_validator_1.IsString)(),
93
+ (0, class_validator_1.IsOptional)(),
94
+ (0, swagger_1.ApiProperty)({ required: false }),
95
+ __metadata("design:type", String)
96
+ ], CreateNotificationDTO.prototype, "refID", void 0);
97
+ __decorate([
98
+ (0, swagger_1.ApiProperty)({}),
99
+ __metadata("design:type", String)
100
+ ], CreateNotificationDTO.prototype, "refCat", void 0);
101
+ //# sourceMappingURL=notification.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.dto.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/notifications/notification.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAA2E;AAK3E,sDAAuD;AACvD,kDAA8C;AAE9C,MAAa,wBACX,SAAQ,2BAAc;CAYvB;AAbD,4DAaC;AANC;IAHC,IAAA,6BAAmB,GAAE;IAC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KAAK,EAAE,CAAC;;oDAClB;AAEf;IADC,IAAA,qBAAW,EAAC,EAAE,CAAC;;qDACA"}
@@ -0,0 +1,23 @@
1
+ import { Relation } from 'typeorm';
2
+ import { BaseEntity } from '../../entities/base.entity';
3
+ export declare class NotificationEntity extends BaseEntity {
4
+ message: string;
5
+ subject: string;
6
+ sender: string;
7
+ refCat: string;
8
+ refID: string;
9
+ seen: boolean;
10
+ toManager: boolean;
11
+ toAll: boolean;
12
+ seenCount: number;
13
+ receiverIDs: string[];
14
+ recipientCount: number;
15
+ active: boolean;
16
+ notificationStatuses: Relation<NotificationItemEntity>;
17
+ }
18
+ export declare class NotificationItemEntity extends BaseEntity {
19
+ seen: boolean;
20
+ active: boolean;
21
+ notification: NotificationEntity;
22
+ }
23
+ export declare const notificationEntities: (typeof NotificationEntity | typeof NotificationItemEntity)[];
@@ -0,0 +1,97 @@
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.notificationEntities = exports.NotificationItemEntity = exports.NotificationEntity = 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 NotificationEntity = class NotificationEntity extends base_entity_1.BaseEntity {
17
+ };
18
+ exports.NotificationEntity = NotificationEntity;
19
+ __decorate([
20
+ (0, typeorm_1.Column)({ type: 'text' }),
21
+ __metadata("design:type", String)
22
+ ], NotificationEntity.prototype, "message", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ type: 'text' }),
25
+ __metadata("design:type", String)
26
+ ], NotificationEntity.prototype, "subject", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ type: 'text' }),
29
+ __metadata("design:type", String)
30
+ ], NotificationEntity.prototype, "sender", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({ type: 'text' }),
33
+ __metadata("design:type", String)
34
+ ], NotificationEntity.prototype, "refCat", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
37
+ __metadata("design:type", String)
38
+ ], NotificationEntity.prototype, "refID", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
41
+ __metadata("design:type", Boolean)
42
+ ], NotificationEntity.prototype, "seen", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
45
+ __metadata("design:type", Boolean)
46
+ ], NotificationEntity.prototype, "toManager", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
49
+ __metadata("design:type", Boolean)
50
+ ], NotificationEntity.prototype, "toAll", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ default: 0 }),
53
+ __metadata("design:type", Number)
54
+ ], NotificationEntity.prototype, "seenCount", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
57
+ __metadata("design:type", Array)
58
+ ], NotificationEntity.prototype, "receiverIDs", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ default: 0 }),
61
+ __metadata("design:type", Number)
62
+ ], NotificationEntity.prototype, "recipientCount", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'boolean', default: true }),
65
+ __metadata("design:type", Boolean)
66
+ ], NotificationEntity.prototype, "active", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.OneToMany)(() => NotificationItemEntity, (item) => item.notification),
69
+ (0, typeorm_1.JoinColumn)(),
70
+ __metadata("design:type", Object)
71
+ ], NotificationEntity.prototype, "notificationStatuses", void 0);
72
+ exports.NotificationEntity = NotificationEntity = __decorate([
73
+ (0, typeorm_1.Entity)(base_enum_1.ETableName.notification)
74
+ ], NotificationEntity);
75
+ let NotificationItemEntity = class NotificationItemEntity extends base_entity_1.BaseEntity {
76
+ };
77
+ exports.NotificationItemEntity = NotificationItemEntity;
78
+ __decorate([
79
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
80
+ __metadata("design:type", Boolean)
81
+ ], NotificationItemEntity.prototype, "seen", void 0);
82
+ __decorate([
83
+ (0, typeorm_1.Column)({ type: 'boolean', default: true }),
84
+ __metadata("design:type", Boolean)
85
+ ], NotificationItemEntity.prototype, "active", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.ManyToOne)(() => NotificationEntity, (item) => item.notificationStatuses),
88
+ __metadata("design:type", NotificationEntity)
89
+ ], NotificationItemEntity.prototype, "notification", void 0);
90
+ exports.NotificationItemEntity = NotificationItemEntity = __decorate([
91
+ (0, typeorm_1.Entity)(base_enum_1.ETableName.notificationStatus)
92
+ ], NotificationItemEntity);
93
+ exports.notificationEntities = [
94
+ NotificationEntity,
95
+ NotificationItemEntity,
96
+ ];
97
+ //# sourceMappingURL=notification.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.entity.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/notifications/notification.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAOiB;AACjB,qDAAmD;AACnD,4DAAwD;AAGjD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,wBAAU;CA4BjD,CAAA;AA5BY,gDAAkB;AAE7B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACT;AAEhB;I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AA5B,MAAM,sBAAuB,SAAQ,wBAAU;CAQrD,CAAA;AARY,wDAAsB;AAEjC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;oDAC9B;AAEd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;sDAC3B;AAGhB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC;8BAC3D,kBAAkB;4DAAC;iCAPtB,sBAAsB;IADlC,IAAA,gBAAM,EAAC,sBAAU,CAAC,kBAAkB,CAAC;GACzB,sBAAsB,CAQlC;AAEY,QAAA,oBAAoB,GAAG;IAClC,kBAAkB;IAClB,sBAAsB;CACvB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BaseModule } from '../base.module';
2
+ export declare class NotificationModule extends BaseModule {
3
+ static entities: (typeof import("./notification.entity").NotificationEntity | typeof import("./notification.entity").NotificationItemEntity)[];
4
+ }
@@ -0,0 +1,30 @@
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.NotificationModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const typeorm_1 = require("@nestjs/typeorm");
12
+ const base_module_1 = require("../base.module");
13
+ const notification_service_1 = require("./notification.service");
14
+ const notification_controller_1 = require("./notification.controller");
15
+ const notification_entity_1 = require("./notification.entity");
16
+ const providers = [notification_service_1.NotificationService, notification_service_1.NotificationItemService];
17
+ const controllers = [notification_controller_1.NotificationController];
18
+ let NotificationModule = class NotificationModule extends base_module_1.BaseModule {
19
+ };
20
+ exports.NotificationModule = NotificationModule;
21
+ NotificationModule.entities = notification_entity_1.notificationEntities;
22
+ exports.NotificationModule = NotificationModule = __decorate([
23
+ (0, common_1.Module)({
24
+ imports: [typeorm_1.TypeOrmModule.forFeature(NotificationModule.entities)],
25
+ providers,
26
+ controllers,
27
+ exports: [...providers],
28
+ })
29
+ ], NotificationModule);
30
+ //# sourceMappingURL=notification.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.module.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/notifications/notification.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,gDAA4C;AAC5C,iEAGgC;AAChC,uEAAmE;AACnE,+DAA6D;AAE7D,MAAM,SAAS,GAAG,CAAC,0CAAmB,EAAE,8CAAuB,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,gDAAsB,CAAC,CAAC;AAOtC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,wBAAU;;AAArC,gDAAkB;AACtB,2BAAQ,GAAG,0CAAoB,AAAvB,CAAwB;6BAD5B,kBAAkB;IAN9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAChE,SAAS;QACT,WAAW;QACX,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;KACxB,CAAC;GACW,kBAAkB,CAE9B"}
@@ -0,0 +1,36 @@
1
+ import { Repository } from 'typeorm';
2
+ import { NotificationEntity, NotificationItemEntity } from './notification.entity';
3
+ import { CreateNotificationDTO, NotificationItemQueryDTO, NotificationQueryDTO, NotificationToggleActiveStatusDTO } from './notification.dto';
4
+ import { BaseService } from '../../services/base.service';
5
+ import { IAuthParam } from '../authentication/authentication.interface';
6
+ import { IDDto } from '../../dtos/base.dto';
7
+ import { SearchQueryDto } from '../../dtos/search.dto';
8
+ export declare class NotificationService extends BaseService<NotificationEntity, NotificationQueryDTO> {
9
+ protected readonly repo: Repository<NotificationEntity>;
10
+ protected readonly repoChild: Repository<NotificationItemEntity>;
11
+ static path: string;
12
+ constructor(repo: Repository<NotificationEntity>, repoChild: Repository<NotificationItemEntity>);
13
+ create(data: CreateNotificationDTO): Promise<NotificationEntity>;
14
+ toManagerFunc: (refCat: string, notification: NotificationEntity) => Promise<string[]>;
15
+ toReceiverIDsFunc: (receiverIDs: string[], notification: NotificationEntity) => Promise<string[]>;
16
+ toRefCatFunc: (refCat: string, notification: NotificationEntity) => Promise<string[]>;
17
+ toAllFunc: (notification: NotificationEntity) => Promise<string[]>;
18
+ protected send(notification: NotificationEntity): Promise<NotificationEntity>;
19
+ resend(notificationID: string, auth: IAuthParam): Promise<NotificationEntity>;
20
+ update(id: string, data: Partial<NotificationEntity>): Promise<NotificationEntity>;
21
+ toggleActiveStatus(notificationID: IDDto, payload: NotificationToggleActiveStatusDTO): Promise<NotificationEntity>;
22
+ getMySentNotifications(authID: string, query: SearchQueryDto): Promise<import("../..").ISearchResponse<NotificationEntity>>;
23
+ getMyUnreadNotificationsCount(authID: string): Promise<{
24
+ count: number;
25
+ }>;
26
+ calculateSeen(notificationID: string): Promise<import("typeorm").UpdateResult>;
27
+ }
28
+ export declare class NotificationItemService extends BaseService<NotificationItemEntity, NotificationItemQueryDTO> {
29
+ protected readonly repo: Repository<NotificationItemEntity>;
30
+ protected readonly repoParent: Repository<NotificationEntity>;
31
+ static path: string;
32
+ constructor(repo: Repository<NotificationItemEntity>, repoParent: Repository<NotificationEntity>);
33
+ getById(id: string): Promise<NotificationItemEntity>;
34
+ getMyReceivedNotifications(authID: string, query: SearchQueryDto): Promise<import("../..").ISearchResponse<NotificationItemEntity>>;
35
+ markAsRead(itemID: IDDto, authID: string): Promise<NotificationItemEntity>;
36
+ }
@@ -0,0 +1,161 @@
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.NotificationItemService = exports.NotificationService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const typeorm_1 = require("typeorm");
18
+ const typeorm_2 = require("@nestjs/typeorm");
19
+ const notification_entity_1 = require("./notification.entity");
20
+ const base_service_1 = require("../../services/base.service");
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 NotificationService = class NotificationService extends base_service_1.BaseService {
25
+ constructor(repo, repoChild) {
26
+ super(repo, base_enum_1.ETableName.notification);
27
+ this.repo = repo;
28
+ this.repoChild = repoChild;
29
+ this.queryStruct = [
30
+ { field: 'active' },
31
+ { field: 'refCat' },
32
+ { field: 'seen' },
33
+ { field: 'sender' },
34
+ ];
35
+ }
36
+ async create(data) {
37
+ const item = Object.assign(new notification_entity_1.NotificationEntity(), data);
38
+ delete item.id;
39
+ if (data.receiverIDs?.length)
40
+ item.meta = { receivers: data.receiverIDs };
41
+ item.sender = item.sender || `System`;
42
+ const res = await super._create(item);
43
+ return await this.send(res);
44
+ }
45
+ async send(notification) {
46
+ await this.repo.manager.transaction(async (transactionalEntityManager) => {
47
+ let authIDs;
48
+ if (notification.toManager)
49
+ authIDs = await this.toManagerFunc(notification.refCat, notification);
50
+ else if (notification.receiverIDs?.length)
51
+ authIDs = await this.toReceiverIDsFunc(notification.receiverIDs, notification);
52
+ else if (notification.refCat)
53
+ authIDs = await this.toRefCatFunc(notification.refCat, notification);
54
+ else
55
+ authIDs = await this.toAllFunc(notification);
56
+ await transactionalEntityManager.save(authIDs.map((id) => {
57
+ const status = Object.assign(new notification_entity_1.NotificationItemEntity(), {});
58
+ status.notification = notification;
59
+ status.creator = { id };
60
+ return status;
61
+ }));
62
+ await transactionalEntityManager.update(notification_entity_1.NotificationEntity, { id: notification.id }, {
63
+ recipientCount: authIDs?.length,
64
+ updater: notification.updater,
65
+ });
66
+ });
67
+ return this.getById(notification.id);
68
+ }
69
+ async resend(notificationID, auth) {
70
+ if (!(await this.checkIfExistsById(notificationID)))
71
+ utility_service_1.UtilityClass.throwError({ message: `Id not found` });
72
+ await this.repoChild.delete({ notification: { id: notificationID } });
73
+ const notification = await this.repo.findOneBy({ id: notificationID });
74
+ notification.updater = auth;
75
+ return await this.send(notification);
76
+ }
77
+ async update(id, data) {
78
+ return super._updateByID(id, data);
79
+ }
80
+ async toggleActiveStatus(notificationID, payload) {
81
+ await this.repo.manager.transaction(async (transactionalEntityManager) => {
82
+ await transactionalEntityManager.update(notification_entity_1.NotificationEntity, { id: notificationID.id }, { active: payload.active, updater: payload.updater });
83
+ await transactionalEntityManager.update(notification_entity_1.NotificationItemEntity, {
84
+ notification: { id: notificationID.id },
85
+ }, { active: payload.active, updater: payload.updater });
86
+ });
87
+ return this.getById(notificationID.id);
88
+ }
89
+ async getMySentNotifications(authID, query) {
90
+ return this.search({ ...query, creatorId: authID });
91
+ }
92
+ async getMyUnreadNotificationsCount(authID) {
93
+ return {
94
+ count: await this.repoChild.countBy({
95
+ creator: { id: authID },
96
+ seen: false,
97
+ }),
98
+ };
99
+ }
100
+ async calculateSeen(notificationID) {
101
+ const rCount = await this.repoChild.countBy({
102
+ notification: { id: notificationID },
103
+ });
104
+ const sCount = await this.repoChild.countBy({
105
+ notification: { id: notificationID },
106
+ seen: true,
107
+ });
108
+ return this.repo.update({ id: notificationID }, {
109
+ seen: rCount == sCount,
110
+ recipientCount: rCount,
111
+ seenCount: sCount,
112
+ });
113
+ }
114
+ };
115
+ exports.NotificationService = NotificationService;
116
+ NotificationService.path = `notification`;
117
+ exports.NotificationService = NotificationService = __decorate([
118
+ (0, common_1.Injectable)(),
119
+ __param(0, (0, typeorm_2.InjectRepository)(notification_entity_1.NotificationEntity)),
120
+ __param(1, (0, typeorm_2.InjectRepository)(notification_entity_1.NotificationItemEntity)),
121
+ __metadata("design:paramtypes", [typeorm_1.Repository,
122
+ typeorm_1.Repository])
123
+ ], NotificationService);
124
+ let NotificationItemService = class NotificationItemService extends base_service_1.BaseService {
125
+ constructor(repo, repoParent) {
126
+ super(repo, base_enum_1.ETableName.notificationStatus);
127
+ this.repo = repo;
128
+ this.repoParent = repoParent;
129
+ this.queryStruct = [
130
+ { field: 'active' },
131
+ { field: 'seen' },
132
+ {
133
+ field: 'notification',
134
+ condition: search_enum_1.ESearchCondition.leftJoin,
135
+ tableAlias: base_enum_1.ETableName.notification,
136
+ },
137
+ ];
138
+ }
139
+ getById(id) {
140
+ return this.repo.findOne({
141
+ where: { id },
142
+ relations: { notification: true },
143
+ });
144
+ }
145
+ async getMyReceivedNotifications(authID, query) {
146
+ return this.search({ ...query, creatorId: authID, active: true });
147
+ }
148
+ async markAsRead(itemID, authID) {
149
+ return this._updateByID(itemID.id, utility_service_1.UtilityClass.patchUpdater({ seen: true }, { id: authID }));
150
+ }
151
+ };
152
+ exports.NotificationItemService = NotificationItemService;
153
+ NotificationItemService.path = `notification`;
154
+ exports.NotificationItemService = NotificationItemService = __decorate([
155
+ (0, common_1.Injectable)(),
156
+ __param(0, (0, typeorm_2.InjectRepository)(notification_entity_1.NotificationItemEntity)),
157
+ __param(1, (0, typeorm_2.InjectRepository)(notification_entity_1.NotificationEntity)),
158
+ __metadata("design:paramtypes", [typeorm_1.Repository,
159
+ typeorm_1.Repository])
160
+ ], NotificationItemService);
161
+ //# sourceMappingURL=notification.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/notifications/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAqC;AAErC,6CAAmD;AACnD,+DAG+B;AAO/B,8DAA0D;AAC1D,qDAAmD;AACnD,oEAA8D;AAI9D,yDAA2D;AAGpD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0BAGxC;IAEC,YAEqB,IAAoC,EAEpC,SAA6C;QAEhE,KAAK,CAAC,IAAI,EAAE,sBAAU,CAAC,YAAY,CAAC,CAAC;QAJlB,SAAI,GAAJ,IAAI,CAAgC;QAEpC,cAAS,GAAT,SAAS,CAAoC;QAGhE,IAAI,CAAC,WAAW,GAAG;YACjB,EAAE,KAAK,EAAE,QAAQ,EAAE;YACnB,EAAE,KAAK,EAAE,QAAQ,EAAE;YACnB,EAAE,KAAK,EAAE,MAAM,EAAE;YACjB,EAAE,KAAK,EAAE,QAAQ,EAAE;SACpB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAA2B;QACtC,MAAM,IAAI,GAAuB,MAAM,CAAC,MAAM,CAC5C,IAAI,wCAAkB,EAAE,EACxB,IAAI,CACL,CAAC;QACF,OAAO,IAAI,CAAC,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,WAAW,EAAE,MAAM;YAAE,IAAI,CAAC,IAAI,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1E,IAAI,CAAC,MAAM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AAC,CAC1D,CAAC;IACJ,CAAC;;AAvCU,0DAAuB;AAI3B,4BAAI,GAAW,cAAc,AAAzB,CAA0B;kCAJ1B,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,0BAAgB,EAAC,4CAAsB,CAAC,CAAA;IAExC,WAAA,IAAA,0BAAgB,EAAC,wCAAkB,CAAC,CAAA;qCADZ,oBAAU;QAEJ,oBAAU;GAThC,uBAAuB,CAwCnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serene-dev/la-nest-library",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",