@messenger-box/platform-server 0.0.1-alpha.312 → 0.0.1-alpha.314
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.
|
@@ -20,21 +20,49 @@ import {Schema}from'mongoose';import {commonModeSchemaOptions,addIdVirtualFields
|
|
|
20
20
|
].includes(this.type);
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
members:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
members: {
|
|
24
|
+
type: [
|
|
25
|
+
new Schema({
|
|
26
|
+
user: { type: Schema.Types.ObjectId, ref: 'accounts' },
|
|
27
|
+
roles: { type: Schema.Types.String },
|
|
28
|
+
msgCount: { type: Schema.Types.Number },
|
|
29
|
+
mentionCount: { type: Schema.Types.Number },
|
|
30
|
+
mentionCountRoot: { type: Schema.Types.Number },
|
|
31
|
+
msgCountRoot: { type: Schema.Types.Number },
|
|
32
|
+
notifyProps: { type: Schema.Types.Mixed },
|
|
33
|
+
explicitRoles: { type: Schema.Types.String },
|
|
34
|
+
schemeAdmin: { type: Schema.Types.String },
|
|
35
|
+
lastViewedAt: { type: Schema.Types.Date },
|
|
36
|
+
deletedAt: { type: Schema.Types.Date },
|
|
37
|
+
}, commonModeSchemaOptions),
|
|
38
|
+
],
|
|
39
|
+
required: true,
|
|
40
|
+
validate: {
|
|
41
|
+
message: 'Channel already exists',
|
|
42
|
+
validator: async function (members, type) {
|
|
43
|
+
// Extract the IDs of the users in the members array
|
|
44
|
+
const userIds = members.map(member => member.user.toString());
|
|
45
|
+
// Check if there are any duplicate user IDs
|
|
46
|
+
const uniqueUserIds = [...new Set(userIds)];
|
|
47
|
+
if (uniqueUserIds.length !== userIds.length) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (this.type !== "DIRECT" /* IRoomType.Direct */ || (members === null || members === void 0 ? void 0 : members.length) > 2) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
// Check if any of the user IDs already exist in other direct channels
|
|
54
|
+
const filter = {
|
|
55
|
+
type: "DIRECT" /* IRoomType.Direct */,
|
|
56
|
+
'members.user': { $all: members.map(m => m.user) },
|
|
57
|
+
members: {
|
|
58
|
+
$size: 2,
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const directChannels = await this.constructor.findOne(filter);
|
|
62
|
+
return !directChannels;
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
38
66
|
deletedAt: { type: Schema.Types.Date },
|
|
39
67
|
lastPostAt: { type: Schema.Types.Date },
|
|
40
68
|
totalMsgCount: { type: Schema.Types.Number },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sources":["../../../src/store/models/channel.ts"],"sourcesContent":[null],"names":[],"mappings":"2GAMA,MAAM,kBAAkB,GAAG,IAAI,MAAM,CACjC;AACI,IAAA,IAAI,EAAE;AACF,QAAA,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;AACzB,QAAA,IAAI,EAAE;;;;;;;AAOL,SAAA;AACD,QAAA,QAAQ,EAAE,IAAI;AACjB,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;AACzB,QAAA,QAAQ,EAAE,YAAA;AACN,YAAA,OAAO,CAAC;;;AAGP,aAAA,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACzB;AACJ,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,IAAI,MAAM,CACN;AACI,
|
|
1
|
+
{"version":3,"file":"channel.js","sources":["../../../src/store/models/channel.ts"],"sourcesContent":[null],"names":[],"mappings":"2GAMA,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAC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E,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;IACvC,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;IAC5C,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;AAChD,IAAA,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE;IAClD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;IACpC,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;IAC1C,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;IAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;IACnC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;AACtC,IAAA,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE;CAC5D,EACD,uBAAuB,CAC1B,CAAC;AAEF,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AAG1B,MAAA,gBAAgB,GAAyC,CAAC,EAAE,KACrE,EAAE,CAAC,KAAK,CAAgB,SAAS,EAAE,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@messenger-box/platform-server",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.314",
|
|
4
4
|
"description": "Sample core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"typescript": {
|
|
50
50
|
"definition": "lib/index.d.ts"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "44f111edd45e9fbc07765be538861a73dfe7939e"
|
|
53
53
|
}
|