@fplpool/fpl-models 2.2.1 → 2.3.0

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.
@@ -0,0 +1,22 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { NotificationStatus, NotificationType } from "../types/notification";
3
+ export interface INotification extends Document {
4
+ _id: Types.ObjectId;
5
+ user: Types.ObjectId;
6
+ title: string;
7
+ message: string;
8
+ type: NotificationType;
9
+ metadata: Record<string, any>;
10
+ status: NotificationStatus;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
14
+ declare const Notification: import("mongoose").Model<INotification, {}, {}, {}, Document<unknown, {}, INotification, {}, import("mongoose").DefaultSchemaOptions> & INotification & Required<{
15
+ _id: Types.ObjectId;
16
+ }> & {
17
+ __v: number;
18
+ } & {
19
+ id: string;
20
+ }, any, INotification>;
21
+ export default Notification;
22
+ //# sourceMappingURL=notification.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.model.d.ts","sourceRoot":"","sources":["../../src/models/notification.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK7E,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC3C,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACnB;AA6CD,QAAA,MAAM,YAAY;;;;;;sBAAuE,CAAC;AAE1F,eAAe,YAAY,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mongoose_1 = require("mongoose");
7
+ const config_1 = __importDefault(require("../config"));
8
+ const notification_1 = require("../types/notification");
9
+ const notificationSchema = new mongoose_1.Schema({
10
+ user: {
11
+ type: mongoose_1.Schema.Types.ObjectId,
12
+ ref: config_1.default.models.user,
13
+ required: true
14
+ },
15
+ title: {
16
+ type: String,
17
+ required: true,
18
+ trim: true,
19
+ maxLength: [100, 'Title must be less than 100 characters']
20
+ },
21
+ message: {
22
+ type: String,
23
+ required: true,
24
+ trim: true,
25
+ maxLength: [200, 'Message must be less than 200 characters']
26
+ },
27
+ type: {
28
+ type: String,
29
+ required: true,
30
+ enum: notification_1.NotificationType,
31
+ default: notification_1.NotificationType.Activity
32
+ },
33
+ metadata: {
34
+ type: mongoose_1.Schema.Types.Mixed,
35
+ required: false,
36
+ default: null
37
+ },
38
+ status: {
39
+ type: String,
40
+ required: true,
41
+ enum: notification_1.NotificationStatus,
42
+ default: notification_1.NotificationStatus.Unread
43
+ }
44
+ }, {
45
+ timestamps: true,
46
+ toJSON: { virtuals: true },
47
+ toObject: { virtuals: true }
48
+ });
49
+ const Notification = (0, mongoose_1.model)(config_1.default.models.notification, notificationSchema);
50
+ exports.default = Notification;
51
+ //# sourceMappingURL=notification.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.model.js","sourceRoot":"","sources":["../../src/models/notification.model.ts"],"names":[],"mappings":";;;;;AAAA,uCAA0D;AAC1D,uDAA+B;AAC/B,wDAA6E;AAmB7E,MAAM,kBAAkB,GAAG,IAAI,iBAAM,CAAgB;IACjD,IAAI,EAAE;QACF,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,QAAQ;QAC3B,GAAG,EAAE,gBAAM,CAAC,MAAM,CAAC,IAAI;QACvB,QAAQ,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACH,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,GAAG,EAAE,wCAAwC,CAAC;KAC7D;IACD,OAAO,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,GAAG,EAAE,0CAA0C,CAAC;KAC/D;IACD,IAAI,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,+BAAgB;QACtB,OAAO,EAAE,+BAAgB,CAAC,QAAQ;KACrC;IACD,QAAQ,EAAE;QACN,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK;QACxB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;KAChB;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,iCAAkB;QACxB,OAAO,EAAE,iCAAkB,CAAC,MAAM;KACrC;CACJ,EAAE;IACC,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC;IACxB,QAAQ,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC;CAC7B,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,IAAA,gBAAK,EAAgB,gBAAM,CAAC,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAE1F,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare enum NotificationStatus {
2
+ Read = "read",
3
+ Unread = "unread"
4
+ }
5
+ export declare enum NotificationType {
6
+ PaymentReminder = "payment-reminder",
7
+ Activity = "activity"
8
+ }
9
+ //# sourceMappingURL=notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/types/notification.ts"],"names":[],"mappings":"AACA,oBAAY,kBAAkB;IAC1B,IAAI,SAAS;IACb,MAAM,WAAW;CACpB;AAED,oBAAY,gBAAgB;IACxB,eAAe,qBAAqB;IACpC,QAAQ,aAAa;CACxB"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationType = exports.NotificationStatus = void 0;
4
+ var NotificationStatus;
5
+ (function (NotificationStatus) {
6
+ NotificationStatus["Read"] = "read";
7
+ NotificationStatus["Unread"] = "unread";
8
+ })(NotificationStatus || (exports.NotificationStatus = NotificationStatus = {}));
9
+ var NotificationType;
10
+ (function (NotificationType) {
11
+ NotificationType["PaymentReminder"] = "payment-reminder";
12
+ NotificationType["Activity"] = "activity";
13
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
14
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../src/types/notification.ts"],"names":[],"mappings":";;;AACA,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,uCAAiB,CAAA;AACrB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,wDAAoC,CAAA;IACpC,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fplpool/fpl-models",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [