@servicelabsco/slabs-access-manager 0.1.82 → 0.1.83
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/access/controllers/user.notification.controller.d.ts +10 -0
- package/dist/access/controllers/user.notification.controller.js +103 -2
- package/dist/access/controllers/user.notification.controller.js.map +1 -1
- package/dist/access/dtos/user.notification.list.filter.dto.d.ts +1 -0
- package/dist/access/dtos/user.notification.list.filter.dto.js +6 -0
- package/dist/access/dtos/user.notification.list.filter.dto.js.map +1 -1
- package/dist/access/entities/user.notification.entity.d.ts +4 -2
- package/dist/access/entities/user.notification.entity.js +11 -2
- package/dist/access/entities/user.notification.entity.js.map +1 -1
- package/dist/access/libraries/process.user.notification.list.d.ts +1 -0
- package/dist/access/libraries/process.user.notification.list.js +8 -1
- package/dist/access/libraries/process.user.notification.list.js.map +1 -1
- package/dist/migrations/1715063695201-RemoveVisibleBzUserNotificationsTable.d.ts +5 -0
- package/dist/migrations/1715063695201-RemoveVisibleBzUserNotificationsTable.js +15 -0
- package/dist/migrations/1715063695201-RemoveVisibleBzUserNotificationsTable.js.map +1 -0
- package/dist/migrations/1715064155735-AddTypeIdBzUserNotificationsTable.d.ts +5 -0
- package/dist/migrations/1715064155735-AddTypeIdBzUserNotificationsTable.js +16 -0
- package/dist/migrations/1715064155735-AddTypeIdBzUserNotificationsTable.js.map +1 -0
- package/package.json +1 -1
|
@@ -11,5 +11,15 @@ export declare class UserNotificationController {
|
|
|
11
11
|
constructor(accessBusinessService: AccessBusinessService, sqlService: SqlService, listingService: ListingService);
|
|
12
12
|
search(body: UserNotificationListFilterDto): Promise<import("..").ListResponseDto>;
|
|
13
13
|
find(body: StringSearchDto): Promise<any>;
|
|
14
|
+
acknowledgeAll(): Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
archiveAll(): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
}>;
|
|
14
20
|
show(params: BusinessParamDto): Promise<UserNotificationEntity>;
|
|
21
|
+
acknowledge(params: BusinessParamDto): Promise<UserNotificationEntity>;
|
|
22
|
+
archive(params: BusinessParamDto): Promise<UserNotificationEntity>;
|
|
23
|
+
unarchive(params: BusinessParamDto): Promise<UserNotificationEntity>;
|
|
24
|
+
private nestedValidation;
|
|
15
25
|
}
|
|
@@ -22,6 +22,7 @@ const process_db_find_1 = require("../libraries/process.db.find");
|
|
|
22
22
|
const process_user_notification_list_1 = require("../libraries/process.user.notification.list");
|
|
23
23
|
const access_business_service_1 = require("../services/access.business.service");
|
|
24
24
|
const listing_service_1 = require("../services/listing.service");
|
|
25
|
+
const typeorm_1 = require("typeorm");
|
|
25
26
|
let UserNotificationController = class UserNotificationController {
|
|
26
27
|
constructor(accessBusinessService, sqlService, listingService) {
|
|
27
28
|
this.accessBusinessService = accessBusinessService;
|
|
@@ -38,16 +39,83 @@ let UserNotificationController = class UserNotificationController {
|
|
|
38
39
|
primaryCondition: `a.deleted_at is null and a.business_id = ${business.id}`,
|
|
39
40
|
searchCompareKeys: ['a.identifier'],
|
|
40
41
|
tableName: 'bz_user_notifications a',
|
|
41
|
-
columns: [
|
|
42
|
+
columns: [
|
|
43
|
+
'a.id',
|
|
44
|
+
'a.active',
|
|
45
|
+
'a.product_id',
|
|
46
|
+
'a.user_id',
|
|
47
|
+
'a.source_type',
|
|
48
|
+
'a.source_id',
|
|
49
|
+
'a.type_id',
|
|
50
|
+
'a.message',
|
|
51
|
+
'jsonb(a.context) context',
|
|
52
|
+
'a.archived_at',
|
|
53
|
+
'a.acknowledged_at',
|
|
54
|
+
],
|
|
42
55
|
order: `created_at asc`,
|
|
43
56
|
idsCompareKey: 'a.id',
|
|
44
57
|
...body,
|
|
45
58
|
};
|
|
46
59
|
return new process_db_find_1.ProcessDbFind(this.sqlService).process(config);
|
|
47
60
|
}
|
|
61
|
+
async acknowledgeAll() {
|
|
62
|
+
const business = await this.accessBusinessService.validateAccess();
|
|
63
|
+
const user = nestjs_utility_services_1.Auth.user();
|
|
64
|
+
const notifications = await user_notification_entity_1.UserNotificationEntity.find({
|
|
65
|
+
where: { business_id: business.id, user_id: user.id, acknowledged_at: (0, typeorm_1.IsNull)(), product_id: user.auth_attributes.product_id },
|
|
66
|
+
});
|
|
67
|
+
for (const notification of notifications) {
|
|
68
|
+
notification.acknowledged_at = new Date();
|
|
69
|
+
await notification.save();
|
|
70
|
+
}
|
|
71
|
+
return { success: true };
|
|
72
|
+
}
|
|
73
|
+
async archiveAll() {
|
|
74
|
+
const business = await this.accessBusinessService.validateAccess();
|
|
75
|
+
const user = nestjs_utility_services_1.Auth.user();
|
|
76
|
+
const notifications = await user_notification_entity_1.UserNotificationEntity.find({
|
|
77
|
+
where: { business_id: business.id, user_id: user.id, archived_at: (0, typeorm_1.IsNull)(), product_id: user.auth_attributes.product_id },
|
|
78
|
+
});
|
|
79
|
+
for (const notification of notifications) {
|
|
80
|
+
notification.archived_at = new Date();
|
|
81
|
+
await notification.save();
|
|
82
|
+
}
|
|
83
|
+
return { success: true };
|
|
84
|
+
}
|
|
48
85
|
async show(params) {
|
|
49
86
|
const business = await this.accessBusinessService.validateAccess();
|
|
50
|
-
|
|
87
|
+
const user = nestjs_utility_services_1.Auth.user();
|
|
88
|
+
const r = await user_notification_entity_1.UserNotificationEntity.findOne({ where: { id: params.id, business_id: business.id, user_id: user.id } });
|
|
89
|
+
if (!r)
|
|
90
|
+
throw new nestjs_utility_services_1.AccessException();
|
|
91
|
+
return r;
|
|
92
|
+
}
|
|
93
|
+
async acknowledge(params) {
|
|
94
|
+
const { entity } = await this.nestedValidation(params.id);
|
|
95
|
+
if (entity.acknowledged_at)
|
|
96
|
+
return entity;
|
|
97
|
+
entity.acknowledged_at = new Date();
|
|
98
|
+
return entity.save();
|
|
99
|
+
}
|
|
100
|
+
async archive(params) {
|
|
101
|
+
const { entity } = await this.nestedValidation(params.id);
|
|
102
|
+
if (entity.archived_at)
|
|
103
|
+
return entity;
|
|
104
|
+
entity.archived_at = new Date();
|
|
105
|
+
return entity.save();
|
|
106
|
+
}
|
|
107
|
+
async unarchive(params) {
|
|
108
|
+
const { entity } = await this.nestedValidation(params.id);
|
|
109
|
+
entity.archived_at = null;
|
|
110
|
+
return entity.save();
|
|
111
|
+
}
|
|
112
|
+
async nestedValidation(id) {
|
|
113
|
+
const business = await this.accessBusinessService.validateAccess();
|
|
114
|
+
const user = nestjs_utility_services_1.Auth.user();
|
|
115
|
+
const entity = await user_notification_entity_1.UserNotificationEntity.findOne({ where: { user_id: user.id, business_id: business.id, id } });
|
|
116
|
+
if (!entity)
|
|
117
|
+
throw new nestjs_utility_services_1.AccessException();
|
|
118
|
+
return { business, entity };
|
|
51
119
|
}
|
|
52
120
|
};
|
|
53
121
|
exports.UserNotificationController = UserNotificationController;
|
|
@@ -65,6 +133,18 @@ __decorate([
|
|
|
65
133
|
__metadata("design:paramtypes", [nestjs_utility_services_1.StringSearchDto]),
|
|
66
134
|
__metadata("design:returntype", Promise)
|
|
67
135
|
], UserNotificationController.prototype, "find", null);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, common_1.Post)('acknowledge-all'),
|
|
138
|
+
__metadata("design:type", Function),
|
|
139
|
+
__metadata("design:paramtypes", []),
|
|
140
|
+
__metadata("design:returntype", Promise)
|
|
141
|
+
], UserNotificationController.prototype, "acknowledgeAll", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, common_1.Post)('archive-all'),
|
|
144
|
+
__metadata("design:type", Function),
|
|
145
|
+
__metadata("design:paramtypes", []),
|
|
146
|
+
__metadata("design:returntype", Promise)
|
|
147
|
+
], UserNotificationController.prototype, "archiveAll", null);
|
|
68
148
|
__decorate([
|
|
69
149
|
(0, common_1.Get)(':id'),
|
|
70
150
|
__param(0, (0, common_1.Param)()),
|
|
@@ -72,6 +152,27 @@ __decorate([
|
|
|
72
152
|
__metadata("design:paramtypes", [business_param_dto_1.BusinessParamDto]),
|
|
73
153
|
__metadata("design:returntype", Promise)
|
|
74
154
|
], UserNotificationController.prototype, "show", null);
|
|
155
|
+
__decorate([
|
|
156
|
+
(0, common_1.Post)(':id/acknowledge'),
|
|
157
|
+
__param(0, (0, common_1.Param)()),
|
|
158
|
+
__metadata("design:type", Function),
|
|
159
|
+
__metadata("design:paramtypes", [business_param_dto_1.BusinessParamDto]),
|
|
160
|
+
__metadata("design:returntype", Promise)
|
|
161
|
+
], UserNotificationController.prototype, "acknowledge", null);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, common_1.Post)(':id/archive'),
|
|
164
|
+
__param(0, (0, common_1.Param)()),
|
|
165
|
+
__metadata("design:type", Function),
|
|
166
|
+
__metadata("design:paramtypes", [business_param_dto_1.BusinessParamDto]),
|
|
167
|
+
__metadata("design:returntype", Promise)
|
|
168
|
+
], UserNotificationController.prototype, "archive", null);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, common_1.Post)(':id/unarchive'),
|
|
171
|
+
__param(0, (0, common_1.Param)()),
|
|
172
|
+
__metadata("design:type", Function),
|
|
173
|
+
__metadata("design:paramtypes", [business_param_dto_1.BusinessParamDto]),
|
|
174
|
+
__metadata("design:returntype", Promise)
|
|
175
|
+
], UserNotificationController.prototype, "unarchive", null);
|
|
75
176
|
exports.UserNotificationController = UserNotificationController = __decorate([
|
|
76
177
|
(0, common_1.Controller)(),
|
|
77
178
|
__metadata("design:paramtypes", [access_business_service_1.AccessBusinessService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.notification.controller.js","sourceRoot":"","sources":["../../../src/access/controllers/user.notification.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"user.notification.controller.js","sourceRoot":"","sources":["../../../src/access/controllers/user.notification.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoE;AACpE,oFAA4G;AAC5G,mEAA8D;AAE9D,iGAA0F;AAC1F,mFAA8E;AAC9E,kEAA6D;AAC7D,gGAA0F;AA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qCAAS,qCAAgB;;2DAMhD;qCAjHQ,0BAA0B;IADtC,IAAA,mBAAU,GAAE;qCAGqC,+CAAqB;QAClC,oCAAU;QACN,gCAAc;GAJ1C,0BAA0B,CA4HtC"}
|
|
@@ -22,4 +22,10 @@ __decorate([
|
|
|
22
22
|
(0, class_validator_1.IsNumber)(),
|
|
23
23
|
__metadata("design:type", Number)
|
|
24
24
|
], UserNotificationListFilterDto.prototype, "product_id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_transformer_1.Expose)(),
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
(0, class_validator_1.IsBoolean)(),
|
|
29
|
+
__metadata("design:type", Boolean)
|
|
30
|
+
], UserNotificationListFilterDto.prototype, "archive", void 0);
|
|
25
31
|
//# sourceMappingURL=user.notification.list.filter.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.notification.list.filter.dto.js","sourceRoot":"","sources":["../../../src/access/dtos/user.notification.list.filter.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"user.notification.list.filter.dto.js","sourceRoot":"","sources":["../../../src/access/dtos/user.notification.list.filter.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qDAA8E;AAC9E,qEAA+D;AAE/D,MAAa,6BAA8B,SAAQ,4CAAmB;CAUrE;AAVD,sEAUC;AANG;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAM,GAAE;IACR,IAAA,0BAAQ,GAAE;;iEACS;AAKpB;IAHC,IAAA,0BAAM,GAAE;IACR,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;8DACG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonEntity, UserEntity } from '@servicelabsco/nestjs-utility-services';
|
|
1
|
+
import { CommonEntity, LookupValueEntity, UserEntity } from '@servicelabsco/nestjs-utility-services';
|
|
2
2
|
import { UserNotificationAttributesDto } from '../dtos/user.notification.attributes.dto';
|
|
3
3
|
import { AccessBusinessEntity } from './access.business.entity';
|
|
4
4
|
import { ProductEntity } from './product.entity';
|
|
@@ -6,15 +6,17 @@ export declare class UserNotificationEntity extends CommonEntity {
|
|
|
6
6
|
business_id: number;
|
|
7
7
|
product_id: number;
|
|
8
8
|
user_id: number;
|
|
9
|
+
type_id: number;
|
|
9
10
|
source_type: string;
|
|
10
11
|
source_id: number;
|
|
11
12
|
message: string;
|
|
12
13
|
context: any;
|
|
13
|
-
|
|
14
|
+
archived_at: Date;
|
|
14
15
|
acknowledged_at: Date;
|
|
15
16
|
active: boolean;
|
|
16
17
|
attributes: UserNotificationAttributesDto;
|
|
17
18
|
business: AccessBusinessEntity;
|
|
19
|
+
type: LookupValueEntity;
|
|
18
20
|
product: ProductEntity;
|
|
19
21
|
user: UserEntity;
|
|
20
22
|
}
|
|
@@ -30,6 +30,10 @@ __decorate([
|
|
|
30
30
|
(0, typeorm_1.Column)(),
|
|
31
31
|
__metadata("design:type", Number)
|
|
32
32
|
], UserNotificationEntity.prototype, "user_id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)(),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], UserNotificationEntity.prototype, "type_id", void 0);
|
|
33
37
|
__decorate([
|
|
34
38
|
(0, typeorm_1.Column)(),
|
|
35
39
|
__metadata("design:type", String)
|
|
@@ -48,8 +52,8 @@ __decorate([
|
|
|
48
52
|
], UserNotificationEntity.prototype, "context", void 0);
|
|
49
53
|
__decorate([
|
|
50
54
|
(0, typeorm_1.Column)(),
|
|
51
|
-
__metadata("design:type",
|
|
52
|
-
], UserNotificationEntity.prototype, "
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], UserNotificationEntity.prototype, "archived_at", void 0);
|
|
53
57
|
__decorate([
|
|
54
58
|
(0, typeorm_1.Column)(),
|
|
55
59
|
__metadata("design:type", Date)
|
|
@@ -67,6 +71,11 @@ __decorate([
|
|
|
67
71
|
(0, typeorm_1.JoinColumn)({ name: 'business_id' }),
|
|
68
72
|
__metadata("design:type", access_business_entity_1.AccessBusinessEntity)
|
|
69
73
|
], UserNotificationEntity.prototype, "business", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.ManyToOne)(() => nestjs_utility_services_1.LookupValueEntity),
|
|
76
|
+
(0, typeorm_1.JoinColumn)({ name: 'business_id' }),
|
|
77
|
+
__metadata("design:type", nestjs_utility_services_1.LookupValueEntity)
|
|
78
|
+
], UserNotificationEntity.prototype, "type", void 0);
|
|
70
79
|
__decorate([
|
|
71
80
|
(0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity),
|
|
72
81
|
(0, typeorm_1.JoinColumn)({ name: 'product_id' }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.notification.entity.js","sourceRoot":"","sources":["../../../src/access/entities/user.notification.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"user.notification.entity.js","sourceRoot":"","sources":["../../../src/access/entities/user.notification.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oFAAqG;AACrG,qCAAgE;AAChE,+FAAyF;AACzF,qEAAgE;AAChE,qDAAiD;AAS1C,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,sCAAY;CA2CvD,CAAA;AA3CY,wDAAsB;AAE/B;IADC,IAAA,gBAAM,GAAE;;2DACW;AAGpB;IADC,IAAA,gBAAM,GAAE;;0DACU;AAGnB;IADC,IAAA,gBAAM,GAAE;;uDACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;uDACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;2DACW;AAGpB;IADC,IAAA,gBAAM,GAAE;;yDACS;AAGlB;IADC,IAAA,gBAAM,GAAE;;uDACO;AAGhB;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;uDACF;AAGb;IADC,IAAA,gBAAM,GAAE;8BACI,IAAI;2DAAC;AAGlB;IADC,IAAA,gBAAM,GAAE;8BACQ,IAAI;+DAAC;AAGtB;IADC,IAAA,gBAAM,GAAE;;sDACO;AAGhB;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;8BACH,gEAA6B;0DAAC;AAGkC;IAA3E,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,6CAAoB,CAAC;IAAE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAAW,6CAAoB;wDAAC;AAClC;IAAxE,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAiB,CAAC;IAAE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAAO,2CAAiB;oDAAC;AAE7B;IAAnE,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC;IAAE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAAU,8BAAa;uDAAC;AAC7B;IAA7D,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,oCAAU,CAAC;IAAE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BAAO,oCAAU;oDAAC;iCA1CtE,sBAAsB;IADlC,IAAA,gBAAM,EAAC,uBAAuB,CAAC;GACnB,sBAAsB,CA2ClC"}
|
|
@@ -16,4 +16,5 @@ export declare class ProcessUserNotificationList extends ProcessCommonList {
|
|
|
16
16
|
constructor(business: AccessBusinessEntity, listingService: ListingService);
|
|
17
17
|
process(filter: UserNotificationListFilterDto): Promise<ListResponseDto>;
|
|
18
18
|
private processFilters;
|
|
19
|
+
private filterArchive;
|
|
19
20
|
}
|
|
@@ -24,7 +24,14 @@ class ProcessUserNotificationList extends process_common_list_1.ProcessCommonLis
|
|
|
24
24
|
const user = nestjs_utility_services_1.Auth.user();
|
|
25
25
|
this.restrictions.push(`a.business_id = ${this.business.id} and a.user_id = ${user.id} and a.product_id = ${this.filter.product_id}`);
|
|
26
26
|
this.filterActive();
|
|
27
|
-
this.
|
|
27
|
+
this.filterArchive();
|
|
28
|
+
}
|
|
29
|
+
filterArchive() {
|
|
30
|
+
if (!this.isBooleanFieldSet('archive'))
|
|
31
|
+
return;
|
|
32
|
+
if (this.filter.archive)
|
|
33
|
+
this.restrictions.push(`a.archived_at is not null`);
|
|
34
|
+
this.restrictions.push(`a.archived_at is null`);
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
exports.ProcessUserNotificationList = ProcessUserNotificationList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.user.notification.list.js","sourceRoot":"","sources":["../../../src/access/libraries/process.user.notification.list.ts"],"names":[],"mappings":";;;AAAA,oFAA8D;AAK9D,+DAA0D;AAO1D,MAAa,2BAA4B,SAAQ,uCAAiB;IAsB9D,YACuB,QAA8B,EAC9B,cAA8B;QAEjD,KAAK,EAAE,CAAC;QAHW,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,mBAAc,GAAd,cAAc,CAAgB;QAf3C,WAAM,GAAG;YACf,GAAG,EAAE,oDAAoD;YACzD,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,CAAC,KAAK,CAAC;YAChB,OAAO,EAAE,EAAE;SACd,CAAC;IAaF,CAAC;IAQD,KAAK,CAAC,OAAO,CAAC,MAAqC;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;IAOO,cAAc;QAClB,MAAM,IAAI,GAAG,8BAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,QAAQ,CAAC,EAAE,oBAAoB,IAAI,CAAC,EAAE,uBAAuB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAEtI,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"process.user.notification.list.js","sourceRoot":"","sources":["../../../src/access/libraries/process.user.notification.list.ts"],"names":[],"mappings":";;;AAAA,oFAA8D;AAK9D,+DAA0D;AAO1D,MAAa,2BAA4B,SAAQ,uCAAiB;IAsB9D,YACuB,QAA8B,EAC9B,cAA8B;QAEjD,KAAK,EAAE,CAAC;QAHW,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,mBAAc,GAAd,cAAc,CAAgB;QAf3C,WAAM,GAAG;YACf,GAAG,EAAE,oDAAoD;YACzD,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,CAAC,KAAK,CAAC;YAChB,OAAO,EAAE,EAAE;SACd,CAAC;IAaF,CAAC;IAQD,KAAK,CAAC,OAAO,CAAC,MAAqC;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;IAOO,cAAc;QAClB,MAAM,IAAI,GAAG,8BAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,QAAQ,CAAC,EAAE,oBAAoB,IAAI,CAAC,EAAE,uBAAuB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAEtI,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAEO,aAAa;QACjB,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;YAAE,OAAO;QAE/C,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAE7E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACpD,CAAC;CACJ;AA/DD,kEA+DC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveVisibleBzUserNotificationsTable1715063695201 = void 0;
|
|
4
|
+
const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
|
|
5
|
+
class RemoveVisibleBzUserNotificationsTable1715063695201 extends nestjs_utility_services_1.ReverseMigrationUtility {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('bz_user_notifications');
|
|
8
|
+
this.process();
|
|
9
|
+
}
|
|
10
|
+
process() {
|
|
11
|
+
this.boolean('visible');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.RemoveVisibleBzUserNotificationsTable1715063695201 = RemoveVisibleBzUserNotificationsTable1715063695201;
|
|
15
|
+
//# sourceMappingURL=1715063695201-RemoveVisibleBzUserNotificationsTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1715063695201-RemoveVisibleBzUserNotificationsTable.js","sourceRoot":"","sources":["../../src/migrations/1715063695201-RemoveVisibleBzUserNotificationsTable.ts"],"names":[],"mappings":";;;AAAA,oFAAiF;AAEjF,MAAa,kDAAmD,SAAQ,iDAAuB;IAC3F;QACI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;CACJ;AATD,gHASC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddTypeIdBzUserNotificationsTable1715064155735 = void 0;
|
|
4
|
+
const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
|
|
5
|
+
class AddTypeIdBzUserNotificationsTable1715064155735 extends nestjs_utility_services_1.MigrationUtility {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('bz_user_notifications');
|
|
8
|
+
this.process();
|
|
9
|
+
}
|
|
10
|
+
process() {
|
|
11
|
+
this.foreign({ name: 'type_id', foreignTable: 'sys_lookup_values' });
|
|
12
|
+
this.dateTime('archived_at');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AddTypeIdBzUserNotificationsTable1715064155735 = AddTypeIdBzUserNotificationsTable1715064155735;
|
|
16
|
+
//# sourceMappingURL=1715064155735-AddTypeIdBzUserNotificationsTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1715064155735-AddTypeIdBzUserNotificationsTable.js","sourceRoot":"","sources":["../../src/migrations/1715064155735-AddTypeIdBzUserNotificationsTable.ts"],"names":[],"mappings":";;;AAAA,oFAA0E;AAE1E,MAAa,8CAA+C,SAAQ,0CAAgB;IAChF;QACI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;CACJ;AAVD,wGAUC"}
|
package/package.json
CHANGED