@flusys/nestjs-notification 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +998 -0
- package/adapters/index.d.ts +1 -0
- package/adapters/notification.adapter.d.ts +10 -0
- package/cjs/adapters/index.js +18 -0
- package/cjs/adapters/notification.adapter.js +79 -0
- package/cjs/config/index.js +18 -0
- package/cjs/config/notification.constants.js +11 -0
- package/cjs/controllers/index.js +18 -0
- package/cjs/controllers/notification.controller.js +278 -0
- package/cjs/docs/index.js +18 -0
- package/cjs/docs/notification-swagger.config.js +61 -0
- package/cjs/dtos/index.js +18 -0
- package/cjs/dtos/notification.dto.js +244 -0
- package/cjs/entities/index.js +48 -0
- package/cjs/entities/notification-with-company.entity.js +57 -0
- package/cjs/entities/notification.entity.js +111 -0
- package/cjs/gateways/index.js +18 -0
- package/cjs/gateways/notification.gateway.js +226 -0
- package/cjs/index.js +28 -0
- package/cjs/interfaces/index.js +19 -0
- package/cjs/interfaces/notification-module.interface.js +4 -0
- package/cjs/interfaces/notification.interface.js +4 -0
- package/cjs/modules/index.js +18 -0
- package/cjs/modules/notification.module.js +139 -0
- package/cjs/services/index.js +21 -0
- package/cjs/services/notification-config.service.js +72 -0
- package/cjs/services/notification-datasource.provider.js +174 -0
- package/cjs/services/notification-helper.service.js +186 -0
- package/cjs/services/notification.service.js +220 -0
- package/config/index.d.ts +1 -0
- package/config/notification.constants.d.ts +1 -0
- package/controllers/index.d.ts +1 -0
- package/controllers/notification.controller.d.ts +26 -0
- package/docs/index.d.ts +1 -0
- package/docs/notification-swagger.config.d.ts +2 -0
- package/dtos/index.d.ts +1 -0
- package/dtos/notification.dto.d.ts +47 -0
- package/entities/index.d.ts +8 -0
- package/entities/notification-with-company.entity.d.ts +4 -0
- package/entities/notification.entity.d.ts +10 -0
- package/fesm/adapters/index.js +1 -0
- package/fesm/adapters/notification.adapter.js +69 -0
- package/fesm/config/index.js +1 -0
- package/fesm/config/notification.constants.js +1 -0
- package/fesm/controllers/index.js +1 -0
- package/fesm/controllers/notification.controller.js +268 -0
- package/fesm/docs/index.js +1 -0
- package/fesm/docs/notification-swagger.config.js +51 -0
- package/fesm/dtos/index.js +1 -0
- package/fesm/dtos/notification.dto.js +211 -0
- package/fesm/entities/index.js +14 -0
- package/fesm/entities/notification-with-company.entity.js +47 -0
- package/fesm/entities/notification.entity.js +101 -0
- package/fesm/gateways/index.js +1 -0
- package/fesm/gateways/notification.gateway.js +175 -0
- package/fesm/index.js +20 -0
- package/fesm/interfaces/index.js +2 -0
- package/fesm/interfaces/notification-module.interface.js +1 -0
- package/fesm/interfaces/notification.interface.js +1 -0
- package/fesm/modules/index.js +1 -0
- package/fesm/modules/notification.module.js +129 -0
- package/fesm/services/index.js +4 -0
- package/fesm/services/notification-config.service.js +62 -0
- package/fesm/services/notification-datasource.provider.js +123 -0
- package/fesm/services/notification-helper.service.js +176 -0
- package/fesm/services/notification.service.js +210 -0
- package/gateways/index.d.ts +1 -0
- package/gateways/notification.gateway.d.ts +21 -0
- package/index.d.ts +10 -0
- package/interfaces/index.d.ts +2 -0
- package/interfaces/notification-module.interface.d.ts +20 -0
- package/interfaces/notification.interface.d.ts +19 -0
- package/modules/index.d.ts +1 -0
- package/modules/notification.module.d.ts +8 -0
- package/package.json +98 -0
- package/services/index.d.ts +4 -0
- package/services/notification-config.service.d.ts +13 -0
- package/services/notification-datasource.provider.d.ts +23 -0
- package/services/notification-helper.service.d.ts +44 -0
- package/services/notification.service.d.ts +35 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get CreateNotificationDto () {
|
|
13
|
+
return CreateNotificationDto;
|
|
14
|
+
},
|
|
15
|
+
get MarkReadDto () {
|
|
16
|
+
return MarkReadDto;
|
|
17
|
+
},
|
|
18
|
+
get NotificationResponseDto () {
|
|
19
|
+
return NotificationResponseDto;
|
|
20
|
+
},
|
|
21
|
+
get SendBulkNotificationDto () {
|
|
22
|
+
return SendBulkNotificationDto;
|
|
23
|
+
},
|
|
24
|
+
get SendNotificationDto () {
|
|
25
|
+
return SendNotificationDto;
|
|
26
|
+
},
|
|
27
|
+
get UnreadCountResponseDto () {
|
|
28
|
+
return UnreadCountResponseDto;
|
|
29
|
+
},
|
|
30
|
+
get UpdateNotificationDto () {
|
|
31
|
+
return UpdateNotificationDto;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _swagger = require("@nestjs/swagger");
|
|
35
|
+
const _classtransformer = require("class-transformer");
|
|
36
|
+
const _classvalidator = require("class-validator");
|
|
37
|
+
const _enums = require("@flusys/nestjs-shared/enums");
|
|
38
|
+
function _define_property(obj, key, value) {
|
|
39
|
+
if (key in obj) {
|
|
40
|
+
Object.defineProperty(obj, key, {
|
|
41
|
+
value: value,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
obj[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
52
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
53
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
54
|
+
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;
|
|
55
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
56
|
+
}
|
|
57
|
+
function _ts_metadata(k, v) {
|
|
58
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
59
|
+
}
|
|
60
|
+
let NotificationContentDto = class NotificationContentDto {
|
|
61
|
+
constructor(){
|
|
62
|
+
_define_property(this, "title", void 0);
|
|
63
|
+
_define_property(this, "message", void 0);
|
|
64
|
+
_define_property(this, "type", void 0);
|
|
65
|
+
_define_property(this, "data", void 0);
|
|
66
|
+
_define_property(this, "companyId", void 0);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
_ts_decorate([
|
|
70
|
+
(0, _swagger.ApiProperty)({
|
|
71
|
+
maxLength: 255
|
|
72
|
+
}),
|
|
73
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
74
|
+
(0, _classvalidator.IsString)(),
|
|
75
|
+
(0, _classvalidator.MaxLength)(255),
|
|
76
|
+
_ts_metadata("design:type", String)
|
|
77
|
+
], NotificationContentDto.prototype, "title", void 0);
|
|
78
|
+
_ts_decorate([
|
|
79
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
80
|
+
(0, _classvalidator.IsOptional)(),
|
|
81
|
+
(0, _classvalidator.IsString)(),
|
|
82
|
+
_ts_metadata("design:type", String)
|
|
83
|
+
], NotificationContentDto.prototype, "message", void 0);
|
|
84
|
+
_ts_decorate([
|
|
85
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
86
|
+
enum: _enums.NotificationType,
|
|
87
|
+
default: _enums.NotificationType.INFO
|
|
88
|
+
}),
|
|
89
|
+
(0, _classvalidator.IsOptional)(),
|
|
90
|
+
(0, _classvalidator.IsEnum)(_enums.NotificationType),
|
|
91
|
+
_ts_metadata("design:type", typeof _enums.NotificationType === "undefined" ? Object : _enums.NotificationType)
|
|
92
|
+
], NotificationContentDto.prototype, "type", void 0);
|
|
93
|
+
_ts_decorate([
|
|
94
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
95
|
+
(0, _classvalidator.IsOptional)(),
|
|
96
|
+
(0, _classvalidator.IsObject)(),
|
|
97
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
98
|
+
], NotificationContentDto.prototype, "data", void 0);
|
|
99
|
+
_ts_decorate([
|
|
100
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
101
|
+
(0, _classvalidator.IsOptional)(),
|
|
102
|
+
(0, _classvalidator.IsUUID)(),
|
|
103
|
+
_ts_metadata("design:type", String)
|
|
104
|
+
], NotificationContentDto.prototype, "companyId", void 0);
|
|
105
|
+
let UserIdDto = class UserIdDto {
|
|
106
|
+
constructor(){
|
|
107
|
+
_define_property(this, "userId", void 0);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
_ts_decorate([
|
|
111
|
+
(0, _swagger.ApiProperty)(),
|
|
112
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
113
|
+
(0, _classvalidator.IsUUID)(),
|
|
114
|
+
_ts_metadata("design:type", String)
|
|
115
|
+
], UserIdDto.prototype, "userId", void 0);
|
|
116
|
+
let UserIdsDto = class UserIdsDto {
|
|
117
|
+
constructor(){
|
|
118
|
+
_define_property(this, "userIds", void 0);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
_ts_decorate([
|
|
122
|
+
(0, _swagger.ApiProperty)({
|
|
123
|
+
type: [
|
|
124
|
+
String
|
|
125
|
+
]
|
|
126
|
+
}),
|
|
127
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
128
|
+
(0, _classvalidator.IsUUID)('4', {
|
|
129
|
+
each: true
|
|
130
|
+
}),
|
|
131
|
+
_ts_metadata("design:type", Array)
|
|
132
|
+
], UserIdsDto.prototype, "userIds", void 0);
|
|
133
|
+
let CreateNotificationDto = class CreateNotificationDto extends (0, _swagger.IntersectionType)(UserIdDto, NotificationContentDto) {
|
|
134
|
+
};
|
|
135
|
+
let UpdateNotificationDto = class UpdateNotificationDto extends (0, _swagger.PartialType)((0, _swagger.OmitType)(CreateNotificationDto, [
|
|
136
|
+
'userId'
|
|
137
|
+
])) {
|
|
138
|
+
constructor(...args){
|
|
139
|
+
super(...args), _define_property(this, "id", void 0);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
_ts_decorate([
|
|
143
|
+
(0, _swagger.ApiProperty)(),
|
|
144
|
+
(0, _classvalidator.IsUUID)(),
|
|
145
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
146
|
+
_ts_metadata("design:type", String)
|
|
147
|
+
], UpdateNotificationDto.prototype, "id", void 0);
|
|
148
|
+
let MarkReadDto = class MarkReadDto {
|
|
149
|
+
constructor(){
|
|
150
|
+
_define_property(this, "id", void 0);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
_ts_decorate([
|
|
154
|
+
(0, _swagger.ApiProperty)(),
|
|
155
|
+
(0, _classvalidator.IsUUID)(),
|
|
156
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
157
|
+
_ts_metadata("design:type", String)
|
|
158
|
+
], MarkReadDto.prototype, "id", void 0);
|
|
159
|
+
let NotificationResponseDto = class NotificationResponseDto {
|
|
160
|
+
constructor(){
|
|
161
|
+
_define_property(this, "id", void 0);
|
|
162
|
+
_define_property(this, "userId", void 0);
|
|
163
|
+
_define_property(this, "type", void 0);
|
|
164
|
+
_define_property(this, "title", void 0);
|
|
165
|
+
_define_property(this, "message", void 0);
|
|
166
|
+
_define_property(this, "data", void 0);
|
|
167
|
+
_define_property(this, "isRead", void 0);
|
|
168
|
+
_define_property(this, "readAt", void 0);
|
|
169
|
+
_define_property(this, "companyId", void 0);
|
|
170
|
+
_define_property(this, "createdAt", void 0);
|
|
171
|
+
_define_property(this, "updatedAt", void 0);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
_ts_decorate([
|
|
175
|
+
(0, _classtransformer.Expose)(),
|
|
176
|
+
(0, _swagger.ApiProperty)(),
|
|
177
|
+
_ts_metadata("design:type", String)
|
|
178
|
+
], NotificationResponseDto.prototype, "id", void 0);
|
|
179
|
+
_ts_decorate([
|
|
180
|
+
(0, _classtransformer.Expose)(),
|
|
181
|
+
(0, _swagger.ApiProperty)(),
|
|
182
|
+
_ts_metadata("design:type", String)
|
|
183
|
+
], NotificationResponseDto.prototype, "userId", void 0);
|
|
184
|
+
_ts_decorate([
|
|
185
|
+
(0, _classtransformer.Expose)(),
|
|
186
|
+
(0, _swagger.ApiProperty)({
|
|
187
|
+
enum: _enums.NotificationType
|
|
188
|
+
}),
|
|
189
|
+
_ts_metadata("design:type", String)
|
|
190
|
+
], NotificationResponseDto.prototype, "type", void 0);
|
|
191
|
+
_ts_decorate([
|
|
192
|
+
(0, _classtransformer.Expose)(),
|
|
193
|
+
(0, _swagger.ApiProperty)(),
|
|
194
|
+
_ts_metadata("design:type", String)
|
|
195
|
+
], NotificationResponseDto.prototype, "title", void 0);
|
|
196
|
+
_ts_decorate([
|
|
197
|
+
(0, _classtransformer.Expose)(),
|
|
198
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
199
|
+
_ts_metadata("design:type", Object)
|
|
200
|
+
], NotificationResponseDto.prototype, "message", void 0);
|
|
201
|
+
_ts_decorate([
|
|
202
|
+
(0, _classtransformer.Expose)(),
|
|
203
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
204
|
+
_ts_metadata("design:type", Object)
|
|
205
|
+
], NotificationResponseDto.prototype, "data", void 0);
|
|
206
|
+
_ts_decorate([
|
|
207
|
+
(0, _classtransformer.Expose)(),
|
|
208
|
+
(0, _swagger.ApiProperty)(),
|
|
209
|
+
_ts_metadata("design:type", Boolean)
|
|
210
|
+
], NotificationResponseDto.prototype, "isRead", void 0);
|
|
211
|
+
_ts_decorate([
|
|
212
|
+
(0, _classtransformer.Expose)(),
|
|
213
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
214
|
+
_ts_metadata("design:type", Object)
|
|
215
|
+
], NotificationResponseDto.prototype, "readAt", void 0);
|
|
216
|
+
_ts_decorate([
|
|
217
|
+
(0, _classtransformer.Expose)(),
|
|
218
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
219
|
+
_ts_metadata("design:type", Object)
|
|
220
|
+
], NotificationResponseDto.prototype, "companyId", void 0);
|
|
221
|
+
_ts_decorate([
|
|
222
|
+
(0, _classtransformer.Expose)(),
|
|
223
|
+
(0, _swagger.ApiProperty)(),
|
|
224
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
225
|
+
], NotificationResponseDto.prototype, "createdAt", void 0);
|
|
226
|
+
_ts_decorate([
|
|
227
|
+
(0, _classtransformer.Expose)(),
|
|
228
|
+
(0, _swagger.ApiProperty)(),
|
|
229
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
230
|
+
], NotificationResponseDto.prototype, "updatedAt", void 0);
|
|
231
|
+
let UnreadCountResponseDto = class UnreadCountResponseDto {
|
|
232
|
+
constructor(){
|
|
233
|
+
_define_property(this, "count", void 0);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
_ts_decorate([
|
|
237
|
+
(0, _classtransformer.Expose)(),
|
|
238
|
+
(0, _swagger.ApiProperty)(),
|
|
239
|
+
_ts_metadata("design:type", Number)
|
|
240
|
+
], UnreadCountResponseDto.prototype, "count", void 0);
|
|
241
|
+
let SendNotificationDto = class SendNotificationDto extends (0, _swagger.IntersectionType)(UserIdDto, NotificationContentDto) {
|
|
242
|
+
};
|
|
243
|
+
let SendBulkNotificationDto = class SendBulkNotificationDto extends (0, _swagger.IntersectionType)(UserIdsDto, NotificationContentDto) {
|
|
244
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get NotificationBase () {
|
|
13
|
+
return _notificationentity.Notification;
|
|
14
|
+
},
|
|
15
|
+
get NotificationCompanyEntities () {
|
|
16
|
+
return NotificationCompanyEntities;
|
|
17
|
+
},
|
|
18
|
+
get NotificationCoreEntities () {
|
|
19
|
+
return NotificationCoreEntities;
|
|
20
|
+
},
|
|
21
|
+
get getNotificationEntitiesByConfig () {
|
|
22
|
+
return getNotificationEntitiesByConfig;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _notificationentity = _export_star(require("./notification.entity"), exports);
|
|
26
|
+
const _notificationwithcompanyentity = _export_star(require("./notification-with-company.entity"), exports);
|
|
27
|
+
function _export_star(from, to) {
|
|
28
|
+
Object.keys(from).forEach(function(k) {
|
|
29
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
30
|
+
Object.defineProperty(to, k, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function() {
|
|
33
|
+
return from[k];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return from;
|
|
39
|
+
}
|
|
40
|
+
const NotificationCoreEntities = [
|
|
41
|
+
_notificationentity.Notification
|
|
42
|
+
];
|
|
43
|
+
const NotificationCompanyEntities = [
|
|
44
|
+
_notificationwithcompanyentity.NotificationWithCompany
|
|
45
|
+
];
|
|
46
|
+
function getNotificationEntitiesByConfig(enableCompanyFeature) {
|
|
47
|
+
return enableCompanyFeature ? NotificationCompanyEntities : NotificationCoreEntities;
|
|
48
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "NotificationWithCompany", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return NotificationWithCompany;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _typeorm = require("typeorm");
|
|
12
|
+
const _notificationentity = require("./notification.entity");
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value: value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
27
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
29
|
+
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;
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
}
|
|
32
|
+
function _ts_metadata(k, v) {
|
|
33
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
|
+
}
|
|
35
|
+
let NotificationWithCompany = class NotificationWithCompany extends _notificationentity.Notification {
|
|
36
|
+
constructor(...args){
|
|
37
|
+
super(...args), _define_property(this, "companyId", void 0);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
_ts_decorate([
|
|
41
|
+
(0, _typeorm.Column)({
|
|
42
|
+
name: 'company_id',
|
|
43
|
+
type: 'uuid',
|
|
44
|
+
nullable: true
|
|
45
|
+
}),
|
|
46
|
+
_ts_metadata("design:type", Object)
|
|
47
|
+
], NotificationWithCompany.prototype, "companyId", void 0);
|
|
48
|
+
NotificationWithCompany = _ts_decorate([
|
|
49
|
+
(0, _typeorm.Entity)({
|
|
50
|
+
name: 'notification'
|
|
51
|
+
}),
|
|
52
|
+
(0, _typeorm.Index)([
|
|
53
|
+
'companyId',
|
|
54
|
+
'userId',
|
|
55
|
+
'isRead'
|
|
56
|
+
])
|
|
57
|
+
], NotificationWithCompany);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Notification", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Notification;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _entities = require("@flusys/nestjs-shared/entities");
|
|
12
|
+
const _typeorm = require("typeorm");
|
|
13
|
+
const _enums = require("@flusys/nestjs-shared/enums");
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30
|
+
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;
|
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
|
+
}
|
|
33
|
+
function _ts_metadata(k, v) {
|
|
34
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
|
+
}
|
|
36
|
+
let Notification = class Notification extends _entities.Identity {
|
|
37
|
+
constructor(...args){
|
|
38
|
+
super(...args), _define_property(this, "userId", void 0), _define_property(this, "type", void 0), _define_property(this, "title", void 0), _define_property(this, "message", void 0), _define_property(this, "data", void 0), _define_property(this, "isRead", void 0), _define_property(this, "readAt", void 0);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
_ts_decorate([
|
|
42
|
+
(0, _typeorm.Column)({
|
|
43
|
+
name: 'user_id',
|
|
44
|
+
type: 'uuid',
|
|
45
|
+
nullable: false
|
|
46
|
+
}),
|
|
47
|
+
(0, _typeorm.Index)(),
|
|
48
|
+
_ts_metadata("design:type", String)
|
|
49
|
+
], Notification.prototype, "userId", void 0);
|
|
50
|
+
_ts_decorate([
|
|
51
|
+
(0, _typeorm.Column)({
|
|
52
|
+
type: 'varchar',
|
|
53
|
+
length: 50,
|
|
54
|
+
nullable: false,
|
|
55
|
+
default: _enums.NotificationType.INFO
|
|
56
|
+
}),
|
|
57
|
+
_ts_metadata("design:type", String)
|
|
58
|
+
], Notification.prototype, "type", void 0);
|
|
59
|
+
_ts_decorate([
|
|
60
|
+
(0, _typeorm.Column)({
|
|
61
|
+
type: 'varchar',
|
|
62
|
+
length: 255,
|
|
63
|
+
nullable: false
|
|
64
|
+
}),
|
|
65
|
+
_ts_metadata("design:type", String)
|
|
66
|
+
], Notification.prototype, "title", void 0);
|
|
67
|
+
_ts_decorate([
|
|
68
|
+
(0, _typeorm.Column)({
|
|
69
|
+
type: 'text',
|
|
70
|
+
nullable: true
|
|
71
|
+
}),
|
|
72
|
+
_ts_metadata("design:type", Object)
|
|
73
|
+
], Notification.prototype, "message", void 0);
|
|
74
|
+
_ts_decorate([
|
|
75
|
+
(0, _typeorm.Column)({
|
|
76
|
+
type: 'simple-json',
|
|
77
|
+
nullable: true
|
|
78
|
+
}),
|
|
79
|
+
_ts_metadata("design:type", Object)
|
|
80
|
+
], Notification.prototype, "data", void 0);
|
|
81
|
+
_ts_decorate([
|
|
82
|
+
(0, _typeorm.Column)({
|
|
83
|
+
name: 'is_read',
|
|
84
|
+
type: 'boolean',
|
|
85
|
+
nullable: false,
|
|
86
|
+
default: false
|
|
87
|
+
}),
|
|
88
|
+
(0, _typeorm.Index)(),
|
|
89
|
+
_ts_metadata("design:type", Boolean)
|
|
90
|
+
], Notification.prototype, "isRead", void 0);
|
|
91
|
+
_ts_decorate([
|
|
92
|
+
(0, _typeorm.Column)({
|
|
93
|
+
name: 'read_at',
|
|
94
|
+
type: 'timestamp',
|
|
95
|
+
nullable: true
|
|
96
|
+
}),
|
|
97
|
+
_ts_metadata("design:type", Object)
|
|
98
|
+
], Notification.prototype, "readAt", void 0);
|
|
99
|
+
Notification = _ts_decorate([
|
|
100
|
+
(0, _typeorm.Entity)({
|
|
101
|
+
name: 'notification'
|
|
102
|
+
}),
|
|
103
|
+
(0, _typeorm.Index)([
|
|
104
|
+
'userId',
|
|
105
|
+
'isRead'
|
|
106
|
+
]),
|
|
107
|
+
(0, _typeorm.Index)([
|
|
108
|
+
'userId',
|
|
109
|
+
'createdAt'
|
|
110
|
+
])
|
|
111
|
+
], Notification);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./notification.gateway"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|