@social-mail/social-mail-web-server 1.7.55 → 1.7.57

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.7.55",
3
+ "version": "1.7.57",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,6 +27,7 @@ import { SessionUser } from "@entity-access/server-pages/dist/core/SessionUser.j
27
27
  import ScopeVars from "../../../common/ScopeVars.js";
28
28
  import type MailboxContactEvent from "./MailboxContactEvent.js";
29
29
  import type WebHook from "./WebHook.js";
30
+ import CheckConstraint from "@entity-access/entity-access/dist/decorators/CheckConstraint.js";
30
31
 
31
32
  /**
32
33
  * MailBox ID is number because foreign key on Email will
@@ -41,6 +42,11 @@ import type WebHook from "./WebHook.js";
41
42
  */
42
43
 
43
44
  @Table("Mailboxes")
45
+ @CheckConstraint({
46
+ name: "CC_Mailbox_Channel_Library",
47
+ /** Either library should be false or it can only be true if channel is true */
48
+ filter: (x) => !x.isLibrary || x.isChannel
49
+ })
44
50
  export default class Mailbox {
45
51
 
46
52
  @Column({ key: true })
@@ -134,6 +140,9 @@ export default class Mailbox {
134
140
  @Column({ dataType: "Boolean", default: () => false })
135
141
  public isChannel: boolean;
136
142
 
143
+ @Column({ dataType: "Boolean", default: () => false })
144
+ public isLibrary: boolean;
145
+
137
146
  @Column({ dataType: "Boolean", default: () => false })
138
147
  public isPrivateChannel: boolean;
139
148
 
@@ -54,6 +54,13 @@ export default class MailboxEmailEvents extends AuthenticatedEvents<ChannelEmail
54
54
  return q.limit(25);
55
55
  }
56
56
 
57
+ @ExternalQuery
58
+ async libraryEmails(channelID) {
59
+ // get current host
60
+ const q = await this.channelEmails(channelID);
61
+ return q.where(void 0, (p) => (x) => x.mailbox.isLibrary === true);
62
+ }
63
+
57
64
  beforeInsert(entity: ChannelEmail, entry: ChangeEntry<ChannelEmail>) {
58
65
  if (this.verify) {
59
66
  this.sessionUser.ensureLoggedIn();
@@ -3,7 +3,7 @@ import semver from "semver";
3
3
 
4
4
  export default async function seedUI(config: DBConfig) {
5
5
 
6
- const version = "1.4.73";
6
+ const version = "1.4.77";
7
7
 
8
8
  const existing = await config.getValue(UIPackageConfig, false);
9
9
  if (existing) {