@venturialstd/user 0.0.4 → 0.0.5

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 (30) hide show
  1. package/README.md +1398 -1357
  2. package/dist/constants/notification.constant.d.ts +28 -0
  3. package/dist/constants/notification.constant.d.ts.map +1 -0
  4. package/dist/constants/notification.constant.js +35 -0
  5. package/dist/constants/notification.constant.js.map +1 -0
  6. package/dist/dtos/create-notification.dto.d.ts +14 -0
  7. package/dist/dtos/create-notification.dto.d.ts.map +1 -0
  8. package/dist/dtos/create-notification.dto.js +3 -0
  9. package/dist/dtos/create-notification.dto.js.map +1 -0
  10. package/dist/entities/user-notification-preferences.entity.d.ts +13 -0
  11. package/dist/entities/user-notification-preferences.entity.d.ts.map +1 -0
  12. package/dist/entities/user-notification-preferences.entity.js +65 -0
  13. package/dist/entities/user-notification-preferences.entity.js.map +1 -0
  14. package/dist/entities/user-notification.entity.d.ts +21 -0
  15. package/dist/entities/user-notification.entity.d.ts.map +1 -0
  16. package/dist/entities/user-notification.entity.js +109 -0
  17. package/dist/entities/user-notification.entity.js.map +1 -0
  18. package/dist/index.d.ts +5 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +5 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/services/user-notification.service.d.ts +54 -0
  23. package/dist/services/user-notification.service.d.ts.map +1 -0
  24. package/dist/services/user-notification.service.js +217 -0
  25. package/dist/services/user-notification.service.js.map +1 -0
  26. package/dist/user.module.d.ts +4 -0
  27. package/dist/user.module.d.ts.map +1 -1
  28. package/dist/user.module.js +17 -2
  29. package/dist/user.module.js.map +1 -1
  30. package/package.json +43 -42
@@ -0,0 +1,28 @@
1
+ export declare enum NotificationType {
2
+ SYSTEM = "system",
3
+ USER = "user",
4
+ ALERT = "alert",
5
+ INFO = "info"
6
+ }
7
+ export declare enum NotificationCategory {
8
+ INFO = "info",
9
+ SUCCESS = "success",
10
+ WARNING = "warning",
11
+ ERROR = "error"
12
+ }
13
+ export declare enum NotificationPriority {
14
+ LOW = "low",
15
+ MEDIUM = "medium",
16
+ HIGH = "high",
17
+ URGENT = "urgent"
18
+ }
19
+ export declare enum NotificationChannel {
20
+ IN_APP = "in_app",
21
+ EMAIL = "email",
22
+ SMS = "sms",
23
+ PUSH = "push"
24
+ }
25
+ export declare const DEFAULT_NOTIFICATION_TYPES: string[];
26
+ export declare const DEFAULT_NOTIFICATION_CATEGORIES: string[];
27
+ export declare const DEFAULT_NOTIFICATION_PRIORITIES: string[];
28
+ //# sourceMappingURL=notification.constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.constant.d.ts","sourceRoot":"","sources":["../../src/constants/notification.constant.ts"],"names":[],"mappings":"AAIA,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAKD,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAKD,oBAAY,oBAAoB;IAC9B,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAKD,oBAAY,mBAAmB;IAC7B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAGD,eAAO,MAAM,0BAA0B,EAAE,MAAM,EAAoC,CAAC;AAGpF,eAAO,MAAM,+BAA+B,EAAE,MAAM,EAAwC,CAAC;AAG7F,eAAO,MAAM,+BAA+B,EAAE,MAAM,EAAwC,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_NOTIFICATION_PRIORITIES = exports.DEFAULT_NOTIFICATION_CATEGORIES = exports.DEFAULT_NOTIFICATION_TYPES = exports.NotificationChannel = exports.NotificationPriority = exports.NotificationCategory = exports.NotificationType = void 0;
4
+ var NotificationType;
5
+ (function (NotificationType) {
6
+ NotificationType["SYSTEM"] = "system";
7
+ NotificationType["USER"] = "user";
8
+ NotificationType["ALERT"] = "alert";
9
+ NotificationType["INFO"] = "info";
10
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
11
+ var NotificationCategory;
12
+ (function (NotificationCategory) {
13
+ NotificationCategory["INFO"] = "info";
14
+ NotificationCategory["SUCCESS"] = "success";
15
+ NotificationCategory["WARNING"] = "warning";
16
+ NotificationCategory["ERROR"] = "error";
17
+ })(NotificationCategory || (exports.NotificationCategory = NotificationCategory = {}));
18
+ var NotificationPriority;
19
+ (function (NotificationPriority) {
20
+ NotificationPriority["LOW"] = "low";
21
+ NotificationPriority["MEDIUM"] = "medium";
22
+ NotificationPriority["HIGH"] = "high";
23
+ NotificationPriority["URGENT"] = "urgent";
24
+ })(NotificationPriority || (exports.NotificationPriority = NotificationPriority = {}));
25
+ var NotificationChannel;
26
+ (function (NotificationChannel) {
27
+ NotificationChannel["IN_APP"] = "in_app";
28
+ NotificationChannel["EMAIL"] = "email";
29
+ NotificationChannel["SMS"] = "sms";
30
+ NotificationChannel["PUSH"] = "push";
31
+ })(NotificationChannel || (exports.NotificationChannel = NotificationChannel = {}));
32
+ exports.DEFAULT_NOTIFICATION_TYPES = Object.values(NotificationType);
33
+ exports.DEFAULT_NOTIFICATION_CATEGORIES = Object.values(NotificationCategory);
34
+ exports.DEFAULT_NOTIFICATION_PRIORITIES = Object.values(NotificationPriority);
35
+ //# sourceMappingURL=notification.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.constant.js","sourceRoot":"","sources":["../../src/constants/notification.constant.ts"],"names":[],"mappings":";;;AAIA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,mCAAe,CAAA;IACf,iCAAa,CAAA;AACf,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAKD,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,2CAAmB,CAAA;IACnB,uCAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAKD,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,mCAAW,CAAA;IACX,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,yCAAiB,CAAA;AACnB,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B;AAKD,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,sCAAe,CAAA;IACf,kCAAW,CAAA;IACX,oCAAa,CAAA;AACf,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B;AAGY,QAAA,0BAA0B,GAAa,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAGvE,QAAA,+BAA+B,GAAa,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAGhF,QAAA,+BAA+B,GAAa,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { NotificationChannel } from '../constants/notification.constant';
2
+ export interface CreateNotificationDto {
3
+ userId: string;
4
+ type: string;
5
+ category: string;
6
+ title: string;
7
+ message: string;
8
+ metadata?: Record<string, unknown>;
9
+ priority?: string;
10
+ expiresAt?: Date;
11
+ groupKey?: string;
12
+ sentVia?: NotificationChannel[];
13
+ }
14
+ //# sourceMappingURL=create-notification.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-notification.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-notification.dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAM9E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=create-notification.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-notification.dto.js","sourceRoot":"","sources":["../../src/dtos/create-notification.dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { NotificationChannel } from '../constants/notification.constant';
2
+ export declare class UserNotificationPreferences {
3
+ id: string;
4
+ userId: string;
5
+ enabledChannels: NotificationChannel[];
6
+ typePreferences: Record<string, unknown>;
7
+ quietHoursStart: string;
8
+ quietHoursEnd: string;
9
+ timezone: string;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
13
+ //# sourceMappingURL=user-notification-preferences.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification-preferences.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-notification-preferences.entity.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,qBACa,2BAA2B;IAEtC,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,eAAe,EAAE,mBAAmB,EAAE,CAAC;IAGvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGzC,eAAe,EAAE,MAAM,CAAC;IAGxB,aAAa,EAAE,MAAM,CAAC;IAGtB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,65 @@
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.UserNotificationPreferences = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let UserNotificationPreferences = class UserNotificationPreferences {
15
+ id;
16
+ userId;
17
+ enabledChannels;
18
+ typePreferences;
19
+ quietHoursStart;
20
+ quietHoursEnd;
21
+ timezone;
22
+ createdAt;
23
+ updatedAt;
24
+ };
25
+ exports.UserNotificationPreferences = UserNotificationPreferences;
26
+ __decorate([
27
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
28
+ __metadata("design:type", String)
29
+ ], UserNotificationPreferences.prototype, "id", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ unique: true }),
32
+ __metadata("design:type", String)
33
+ ], UserNotificationPreferences.prototype, "userId", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ type: 'varchar', array: true, length: 20, default: () => "'{}'" }),
36
+ __metadata("design:type", Array)
37
+ ], UserNotificationPreferences.prototype, "enabledChannels", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
40
+ __metadata("design:type", Object)
41
+ ], UserNotificationPreferences.prototype, "typePreferences", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: 'time', nullable: true }),
44
+ __metadata("design:type", String)
45
+ ], UserNotificationPreferences.prototype, "quietHoursStart", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'time', nullable: true }),
48
+ __metadata("design:type", String)
49
+ ], UserNotificationPreferences.prototype, "quietHoursEnd", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
52
+ __metadata("design:type", String)
53
+ ], UserNotificationPreferences.prototype, "timezone", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
56
+ __metadata("design:type", Date)
57
+ ], UserNotificationPreferences.prototype, "createdAt", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
60
+ __metadata("design:type", Date)
61
+ ], UserNotificationPreferences.prototype, "updatedAt", void 0);
62
+ exports.UserNotificationPreferences = UserNotificationPreferences = __decorate([
63
+ (0, typeorm_1.Entity)('user_notification_preferences')
64
+ ], UserNotificationPreferences);
65
+ //# sourceMappingURL=user-notification-preferences.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification-preferences.entity.js","sourceRoot":"","sources":["../../src/entities/user-notification-preferences.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AAKV,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAEtC,EAAE,CAAS;IAGX,MAAM,CAAS;IAGf,eAAe,CAAwB;IAGvC,eAAe,CAA0B;IAGzC,eAAe,CAAS;IAGxB,aAAa,CAAS;IAGtB,QAAQ,CAAS;IAGjB,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB,CAAA;AA3BY,kEAA2B;AAEtC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;uDACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;2DACV;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;oEACrC;AAGvC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;oEACE;AAGzC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oEACjB;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kEACnB;AAGtB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6DACvC;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;8DAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;8DAAC;sCA1BL,2BAA2B;IADvC,IAAA,gBAAM,EAAC,+BAA+B,CAAC;GAC3B,2BAA2B,CA2BvC"}
@@ -0,0 +1,21 @@
1
+ import { NotificationChannel } from '../constants/notification.constant';
2
+ export declare class UserNotification {
3
+ id: string;
4
+ userId: string;
5
+ type: string;
6
+ category: string;
7
+ title: string;
8
+ message: string;
9
+ metadata: Record<string, unknown>;
10
+ isRead: boolean;
11
+ readAt: Date;
12
+ isArchived: boolean;
13
+ archivedAt: Date;
14
+ priority: string;
15
+ expiresAt: Date;
16
+ groupKey: string;
17
+ sentVia: NotificationChannel[];
18
+ createdAt: Date;
19
+ updatedAt: Date;
20
+ }
21
+ //# sourceMappingURL=user-notification.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-notification.entity.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,qBAIa,gBAAgB;IAE3B,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAGf,IAAI,EAAE,MAAM,CAAC;IAIb,QAAQ,EAAE,MAAM,CAAC;IAGjB,KAAK,EAAE,MAAM,CAAC;IAGd,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGlC,MAAM,EAAE,OAAO,CAAC;IAGhB,MAAM,EAAE,IAAI,CAAC;IAGb,UAAU,EAAE,OAAO,CAAC;IAGpB,UAAU,EAAE,IAAI,CAAC;IAGjB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,IAAI,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC;IAGjB,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAG/B,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,109 @@
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.UserNotification = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let UserNotification = class UserNotification {
15
+ id;
16
+ userId;
17
+ type;
18
+ category;
19
+ title;
20
+ message;
21
+ metadata;
22
+ isRead;
23
+ readAt;
24
+ isArchived;
25
+ archivedAt;
26
+ priority;
27
+ expiresAt;
28
+ groupKey;
29
+ sentVia;
30
+ createdAt;
31
+ updatedAt;
32
+ };
33
+ exports.UserNotification = UserNotification;
34
+ __decorate([
35
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
36
+ __metadata("design:type", String)
37
+ ], UserNotification.prototype, "id", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)(),
40
+ __metadata("design:type", String)
41
+ ], UserNotification.prototype, "userId", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
44
+ __metadata("design:type", String)
45
+ ], UserNotification.prototype, "type", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
48
+ (0, typeorm_1.Index)(),
49
+ __metadata("design:type", String)
50
+ ], UserNotification.prototype, "category", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
53
+ __metadata("design:type", String)
54
+ ], UserNotification.prototype, "title", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'text' }),
57
+ __metadata("design:type", String)
58
+ ], UserNotification.prototype, "message", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
61
+ __metadata("design:type", Object)
62
+ ], UserNotification.prototype, "metadata", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ default: false }),
65
+ __metadata("design:type", Boolean)
66
+ ], UserNotification.prototype, "isRead", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
69
+ __metadata("design:type", Date)
70
+ ], UserNotification.prototype, "readAt", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ default: false }),
73
+ __metadata("design:type", Boolean)
74
+ ], UserNotification.prototype, "isArchived", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
77
+ __metadata("design:type", Date)
78
+ ], UserNotification.prototype, "archivedAt", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'medium' }),
81
+ __metadata("design:type", String)
82
+ ], UserNotification.prototype, "priority", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
85
+ __metadata("design:type", Date)
86
+ ], UserNotification.prototype, "expiresAt", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
89
+ __metadata("design:type", String)
90
+ ], UserNotification.prototype, "groupKey", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'varchar', array: true, length: 20, default: () => "'{}'" }),
93
+ __metadata("design:type", Array)
94
+ ], UserNotification.prototype, "sentVia", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
97
+ __metadata("design:type", Date)
98
+ ], UserNotification.prototype, "createdAt", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
101
+ __metadata("design:type", Date)
102
+ ], UserNotification.prototype, "updatedAt", void 0);
103
+ exports.UserNotification = UserNotification = __decorate([
104
+ (0, typeorm_1.Entity)('user_notification'),
105
+ (0, typeorm_1.Index)(['userId', 'isRead']),
106
+ (0, typeorm_1.Index)(['userId', 'createdAt']),
107
+ (0, typeorm_1.Index)(['type'])
108
+ ], UserNotification);
109
+ //# sourceMappingURL=user-notification.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification.entity.js","sourceRoot":"","sources":["../../src/entities/user-notification.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAOiB;AAQV,IAAM,gBAAgB,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IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACpC,IAAI;oDAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;;kDAC1C;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACrC,IAAI;mDAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACxC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;iDAC7C;AAG/B;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;mDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAC/B,IAAI;mDAAC;2BAnDL,gBAAgB;IAJ5B,IAAA,gBAAM,EAAC,mBAAmB,CAAC;IAC3B,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3B,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC9B,IAAA,eAAK,EAAC,CAAC,MAAM,CAAC,CAAC;GACH,gBAAgB,CAoD5B"}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,21 @@
1
+ export * from './constants/notification.constant';
1
2
  export * from './constants/user.constant';
2
3
  export * from './constants/user.settings.constant';
3
4
  export * from './decorators/acl.decorator';
4
5
  export * from './decorators/user.decorator';
6
+ export * from './dtos/create-notification.dto';
5
7
  export * from './entities/permission.entity';
6
8
  export * from './entities/role.entity';
7
9
  export * from './entities/role-permission.entity';
8
10
  export * from './entities/user.entity';
11
+ export * from './entities/user-notification.entity';
12
+ export * from './entities/user-notification-preferences.entity';
9
13
  export * from './entities/user-role.entity';
10
14
  export * from './guards/acl.guard';
11
15
  export * from './guards/user.guard';
12
16
  export * from './services/acl.service';
13
17
  export * from './services/user.service';
18
+ export * from './services/user-notification.service';
14
19
  export * from './settings/user.settings';
15
20
  export * from './user.module';
16
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -14,19 +14,24 @@ 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
+ __exportStar(require("./constants/notification.constant"), exports);
17
18
  __exportStar(require("./constants/user.constant"), exports);
18
19
  __exportStar(require("./constants/user.settings.constant"), exports);
19
20
  __exportStar(require("./decorators/acl.decorator"), exports);
20
21
  __exportStar(require("./decorators/user.decorator"), exports);
22
+ __exportStar(require("./dtos/create-notification.dto"), exports);
21
23
  __exportStar(require("./entities/permission.entity"), exports);
22
24
  __exportStar(require("./entities/role.entity"), exports);
23
25
  __exportStar(require("./entities/role-permission.entity"), exports);
24
26
  __exportStar(require("./entities/user.entity"), exports);
27
+ __exportStar(require("./entities/user-notification.entity"), exports);
28
+ __exportStar(require("./entities/user-notification-preferences.entity"), exports);
25
29
  __exportStar(require("./entities/user-role.entity"), exports);
26
30
  __exportStar(require("./guards/acl.guard"), exports);
27
31
  __exportStar(require("./guards/user.guard"), exports);
28
32
  __exportStar(require("./services/acl.service"), exports);
29
33
  __exportStar(require("./services/user.service"), exports);
34
+ __exportStar(require("./services/user-notification.service"), exports);
30
35
  __exportStar(require("./settings/user.settings"), exports);
31
36
  __exportStar(require("./user.module"), exports);
32
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,qEAAmD;AACnD,6DAA2C;AAC3C,8DAA4C;AAC5C,+DAA6C;AAC7C,yDAAuC;AACvC,oEAAkD;AAClD,yDAAuC;AACvC,8DAA4C;AAC5C,qDAAmC;AACnC,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC;AACxC,2DAAyC;AACzC,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD;AAClD,4DAA0C;AAC1C,qEAAmD;AACnD,6DAA2C;AAC3C,8DAA4C;AAC5C,iEAA+C;AAC/C,+DAA6C;AAC7C,yDAAuC;AACvC,oEAAkD;AAClD,yDAAuC;AACvC,sEAAoD;AACpD,kFAAgE;AAChE,8DAA4C;AAC5C,qDAAmC;AACnC,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC;AACxC,uEAAqD;AACrD,2DAAyC;AACzC,gDAA8B"}
@@ -0,0 +1,54 @@
1
+ import { Repository } from 'typeorm';
2
+ import { NotificationChannel } from '../constants/notification.constant';
3
+ import type { CreateNotificationDto } from '../dtos/create-notification.dto';
4
+ import { UserNotification } from '../entities/user-notification.entity';
5
+ import { UserNotificationPreferences } from '../entities/user-notification-preferences.entity';
6
+ import type { UserModuleOptions } from '../user.module';
7
+ export declare class UserNotificationService {
8
+ private readonly notificationRepo;
9
+ private readonly preferencesRepo;
10
+ private readonly options;
11
+ private readonly allowedTypes;
12
+ private readonly allowedCategories;
13
+ private readonly allowedPriorities;
14
+ constructor(notificationRepo: Repository<UserNotification>, preferencesRepo: Repository<UserNotificationPreferences>, options: UserModuleOptions);
15
+ getAllowedTypes(): string[];
16
+ getAllowedCategories(): string[];
17
+ getAllowedPriorities(): string[];
18
+ private validateType;
19
+ private validateCategory;
20
+ private validatePriority;
21
+ createNotification(data: CreateNotificationDto): Promise<UserNotification>;
22
+ findById(id: string): Promise<UserNotification>;
23
+ findByUserId(userId: string, options?: {
24
+ isRead?: boolean;
25
+ type?: string;
26
+ limit?: number;
27
+ offset?: number;
28
+ includeExpired?: boolean;
29
+ }): Promise<{
30
+ data: UserNotification[];
31
+ total: number;
32
+ }>;
33
+ markAsRead(id: string, userId: string): Promise<UserNotification>;
34
+ markAllAsRead(userId: string): Promise<{
35
+ count: number;
36
+ }>;
37
+ archive(id: string, userId: string): Promise<UserNotification>;
38
+ getUnreadCount(userId: string): Promise<number>;
39
+ getPreferences(userId: string): Promise<UserNotificationPreferences | null>;
40
+ upsertPreferences(userId: string, data: Partial<{
41
+ enabledChannels: NotificationChannel[];
42
+ typePreferences: Record<string, unknown>;
43
+ quietHoursStart: string;
44
+ quietHoursEnd: string;
45
+ timezone: string;
46
+ }>): Promise<UserNotificationPreferences>;
47
+ delete(id: string, userId: string): Promise<void>;
48
+ deleteExpired(olderThan?: Date): Promise<number>;
49
+ getUsersWithUnreadCount(includeExpired?: boolean): Promise<{
50
+ userId: string;
51
+ count: number;
52
+ }[]>;
53
+ }
54
+ //# sourceMappingURL=user-notification.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-notification.service.d.ts","sourceRoot":"","sources":["../../src/services/user-notification.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAIL,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAC/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,qBACa,uBAAuB;IAOhC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAV1B,OAAO,CAAC,QAAQ,CAA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