@arkstack/notifications 0.19.0 → 0.19.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.
Files changed (2) hide show
  1. package/dist/index.js +4 -11
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -110,11 +110,8 @@ var UserNotificationCenter = class {
110
110
  return await (await this.getModel()).query().where({ userId: user.id }).get();
111
111
  }
112
112
  static async unreadForUser(user, perPage) {
113
- const query = (await this.getModel()).query().where({
114
- userId: user.id,
115
- readAt: null
116
- });
117
- if (perPage) return await query.paginate();
113
+ const query = (await this.getModel()).query().where({ userId: user.id }).whereNull("readAt");
114
+ if (perPage) return await query.paginate(perPage);
118
115
  return await query.get();
119
116
  }
120
117
  /**
@@ -135,12 +132,8 @@ var UserNotificationCenter = class {
135
132
  * @param user
136
133
  */
137
134
  static async markAllRead(user, ids) {
138
- const query = (await this.getModel()).query().where({
139
- userId: user.id,
140
- readAt: null
141
- });
142
- if (ids) query.whereIn("id", ids);
143
- await query.update({ readAt: /* @__PURE__ */ new Date() });
135
+ const query = (await this.getModel()).query().where({ userId: user.id }).whereNull("readAt");
136
+ await (ids ? query.whereIn("id", ids) : query).updateFrom({ readAt: /* @__PURE__ */ new Date() });
144
137
  }
145
138
  /**
146
139
  * Delete the indicated notifications
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/notifications",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic notification module for Arkstack and Nodejs, providing support for multi-channel notification delivery.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/notifications",
@@ -34,17 +34,17 @@
34
34
  "africastalking": "^0.8.0",
35
35
  "nodemailer": "^9.0.3",
36
36
  "twilio": "^6.0.2",
37
- "@arkstack/common": "^0.19.0"
37
+ "@arkstack/common": "^0.19.1"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kanun-hq/plugin-phone": "^0.1.8",
41
41
  "firebase-admin": "^13.0.0",
42
42
  "pusher": "^5.2.0",
43
- "@arkstack/contract": "^0.19.0",
44
- "@arkstack/driver-express": "^0.19.0",
45
- "@arkstack/database": "^0.19.0",
46
- "@arkstack/driver-h3": "^0.19.0",
47
- "@arkstack/jobs": "^0.19.0"
43
+ "@arkstack/contract": "^0.19.1",
44
+ "@arkstack/database": "^0.19.1",
45
+ "@arkstack/driver-h3": "^0.19.1",
46
+ "@arkstack/jobs": "^0.19.1",
47
+ "@arkstack/driver-express": "^0.19.1"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@arkstack/driver-express": {