@riocrypto/common-server 1.0.2268 → 1.0.2269

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/build/index.d.ts CHANGED
@@ -88,6 +88,7 @@ export * from "./models/admin-auth-dashboard-settings";
88
88
  export * from "./models/STP-mxn-withdrawal";
89
89
  export * from "./models/STP-deposit-CLABE";
90
90
  export * from "./models/STP-settings";
91
+ export * from "./models/dashboard-push-notification-subscription";
91
92
  export * from "./clients/axios-with-logging";
92
93
  export * from "./clients/slack-client";
93
94
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -104,6 +104,7 @@ __exportStar(require("./models/admin-auth-dashboard-settings"), exports);
104
104
  __exportStar(require("./models/STP-mxn-withdrawal"), exports);
105
105
  __exportStar(require("./models/STP-deposit-CLABE"), exports);
106
106
  __exportStar(require("./models/STP-settings"), exports);
107
+ __exportStar(require("./models/dashboard-push-notification-subscription"), exports);
107
108
  __exportStar(require("./clients/axios-with-logging"), exports);
108
109
  __exportStar(require("./clients/slack-client"), exports);
109
110
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -0,0 +1,22 @@
1
+ import mongoose from "mongoose";
2
+ interface DashboardPushNotificationSubscriptionAttrs {
3
+ authId?: string;
4
+ adminAuthId?: string;
5
+ endpoint: string;
6
+ p256dh: string;
7
+ auth: string;
8
+ }
9
+ interface DashboardPushNotificationSubscriptionDoc extends mongoose.Document {
10
+ authId?: string;
11
+ adminAuthId?: string;
12
+ endpoint: string;
13
+ p256dh: string;
14
+ auth: string;
15
+ createdAt: Date;
16
+ updatedAt: Date;
17
+ }
18
+ interface DashboardPushNotificationSubscriptionModel extends mongoose.Model<DashboardPushNotificationSubscriptionDoc> {
19
+ build(attrs: DashboardPushNotificationSubscriptionAttrs): DashboardPushNotificationSubscriptionDoc;
20
+ }
21
+ declare const buildDashboardPushNotificationSubscription: (mongooseInstance: mongoose.Mongoose) => DashboardPushNotificationSubscriptionModel;
22
+ export { buildDashboardPushNotificationSubscription, DashboardPushNotificationSubscriptionDoc, DashboardPushNotificationSubscriptionAttrs, DashboardPushNotificationSubscriptionModel, };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDashboardPushNotificationSubscription = void 0;
4
+ // Factory function to create and register the Mongoose model
5
+ const buildDashboardPushNotificationSubscription = (mongooseInstance) => {
6
+ // If the model is already defined, return it to prevent recompilation errors
7
+ if (mongooseInstance.models.DashboardPushNotificationSubscription) {
8
+ return mongooseInstance.model("DashboardPushNotificationSubscription");
9
+ }
10
+ const dashboardPushNotificationSubscriptionSchema = new mongooseInstance.Schema({
11
+ authId: {
12
+ type: String,
13
+ index: true, // Good to index if you query by authId often
14
+ },
15
+ adminAuthId: {
16
+ type: String,
17
+ index: true, // Good to index if you query by adminAuthId often
18
+ },
19
+ endpoint: {
20
+ type: String,
21
+ required: true,
22
+ unique: true, // Push subscription endpoints are typically globally unique
23
+ },
24
+ p256dh: {
25
+ // Storing the 'keys.p256dh' part of the PushSubscription
26
+ type: String,
27
+ required: true,
28
+ },
29
+ auth: {
30
+ // Storing the 'keys.auth' part of the PushSubscription
31
+ type: String,
32
+ required: true,
33
+ },
34
+ // Add any other fields you deem necessary here
35
+ }, {
36
+ toJSON: {
37
+ transform(doc, ret) {
38
+ ret.id = ret._id; // Rename _id to id for consistency
39
+ delete ret._id;
40
+ delete ret.__v; // Remove version key
41
+ },
42
+ },
43
+ timestamps: true, // Automatically add createdAt and updatedAt fields
44
+ });
45
+ // Static method to build a new document
46
+ dashboardPushNotificationSubscriptionSchema.statics.build = (attrs) => {
47
+ return new DashboardPushNotificationSubscription(attrs);
48
+ };
49
+ const DashboardPushNotificationSubscription = mongooseInstance.model("DashboardPushNotificationSubscription", dashboardPushNotificationSubscriptionSchema);
50
+ return DashboardPushNotificationSubscription;
51
+ };
52
+ exports.buildDashboardPushNotificationSubscription = buildDashboardPushNotificationSubscription;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2268",
3
+ "version": "1.0.2269",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",