@social-mail/social-mail-web-server 1.4.680 → 1.4.682

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.4.680",
3
+ "version": "1.4.682",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -65,32 +65,4 @@ export default class StoreItemEvents extends AuthenticatedEvents<StoreItem> {
65
65
  }
66
66
  }
67
67
 
68
- async afterInsert(entity: StoreItem, entry: ChangeEntry<StoreItem>) {
69
- // update tags...
70
- // if (!entry.isUpdated("tags")) {
71
- // return;
72
- // }
73
- // const ts = ServiceProvider.resolve(this, TagService);
74
- // const db = ServiceProvider.resolve(this, SocialMailContext);
75
- // await db.storeItemTags.asQuery()
76
- // .delete(entity, (p) => (x) => x.storeItemID === p.storeItemID);
77
- // const tags = entity.tags?.trim();
78
- // if (!tags){
79
- // return;
80
- // }
81
- // const { storeItemID } = entity;
82
- // for(const tag of tags.split(/\,/g)) {
83
- // const trimmedTag = tag.trim();
84
- // const ids = await ts.getTagID(trimmedTag);
85
- // for (const tagID of ids) {
86
- // await db.storeItemTags.saveDirect({
87
- // mode: "insert",
88
- // changes: {
89
- // tagID,
90
- // storeItemID
91
- // }
92
- // });
93
- // }
94
- // }
95
- }
96
68
  }
@@ -187,13 +187,14 @@ export default class UserEvents extends AuthenticatedEvents<User> {
187
187
  if (entity.status === "blocked") {
188
188
  const now = new Date();
189
189
  const { userID } = entity;
190
- const sessions = await this.db.loginSessions.where({ userID, now }, (p) => (x) => x.userID
190
+
191
+ await this.db.loginSessions.where({ userID, now}, (p) => (x) => x.userID === p.userID
191
192
  && x.invalid === false
192
- && x.expiry > p.now)
193
- .select(void 0, () => (x) => ({ sessionID: x.sessionID })).toArray();
194
- for (const keys of sessions) {
195
- await this.db.loginSessions.saveDirect({ mode: "update", keys, changes: { invalid: true } });
196
- }
193
+ && x.expiry > Sql.cast.asDateTime(p.now)
194
+ ).update(void 0, (p) => (x) => ({
195
+ invalid: true
196
+ }));
197
+
197
198
  }
198
199
  }
199
200
  }
@@ -189,7 +189,7 @@ export default class SnapshotService {
189
189
  if (iterator.isFolder) {
190
190
  await this.copyChildren(db, iterator, child, path, copyMedia, siteRoot + "/" + child.name);
191
191
  } else {
192
- this.snapshotSize = iterator.fileSize;
192
+ this.snapshotSize += iterator.fileSize;
193
193
  }
194
194
  }
195
195
  }
@@ -87,16 +87,12 @@ export default abstract class BaseStorage {
87
87
  // before checking for hash collision
88
88
 
89
89
  fc.cloudPath = cloudPath;
90
- await db.fileContents.saveDirect({
91
- mode: "update",
92
- keys: {
93
- fileContentID: fc.fileContentID
94
- },
95
- changes: {
96
- cloudPath,
97
- compression
98
- }
99
- }, 2);
90
+ fc.compression = compression;
91
+ await db.fileContents.where(fc, (p) => (x) => x.fileContentID === p.fileContentID)
92
+ .update(fc, (p) => (x) => ({
93
+ cloudPath: p.cloudPath,
94
+ compression: p.compression
95
+ }));
100
96
  }
101
97
  return fc;
102
98
  } finally {