@social-mail/social-mail-web-server 1.5.396 → 1.5.397

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.5.396",
3
+ "version": "1.5.397",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -72,9 +72,36 @@ export default class AppFileEvents extends AuthenticatedEvents<AppFile> {
72
72
  const wcs = ServiceProvider.resolve(this, WebSiteChannelService);
73
73
  const mailboxes = await wcs.getMailboxes(host);
74
74
 
75
- return this.db.appFiles.where({ emailID, host, mailboxes }, (p) => (x) => x.emailID === p.emailID
76
- && x.email.status === "published"
77
- && x.email.mailboxes.some((mc)=> Sql.in(mc.mailboxID, p.mailboxes )));
75
+ let q = this.db.appFiles.where({ mailboxes }, (p) => (x) =>
76
+ x.email.status === "published"
77
+ && x.email.mailboxes.some((mc)=> Sql.in(mc.mailboxID, p.mailboxes )));
78
+
79
+ if (emailID) {
80
+ q = q.where({ emailID} , (p) => (x) => x.emailID === p.emailID);
81
+ }
82
+
83
+ return q;
84
+ }
85
+
86
+ @ExternalQuery
87
+ async channelFiles(mailboxID) {
88
+ const page = ServiceProvider.resolve(this, Page as any) as Page;
89
+ const host = page.request.host;
90
+
91
+ const wcs = ServiceProvider.resolve(this, WebSiteChannelService);
92
+ const mailboxes = await wcs.getMailboxes(host);
93
+
94
+ let q = this.db.appFiles.where(void 0, (p) => (x) =>
95
+ x.email.status === "published");
96
+
97
+ if (mailboxID) {
98
+ q = q.where({ mailboxID }, (p) => (x) => x.email.mailboxes.some((m) => m.mailboxID === p.mailboxID));
99
+ } else {
100
+ q = q.where({ mailboxes }, (p) => (x) =>
101
+ x.email.mailboxes.some((mc)=> Sql.in(mc.mailboxID, p.mailboxes )));
102
+ }
103
+
104
+ return q;
78
105
  }
79
106
 
80
107
  @ExternalQuery