Skip to content

Commit bb1de52

Browse files
committed
chore: store ename of group
1 parent 11ff5c0 commit bb1de52

File tree

7 files changed

+34
-5
lines changed

7 files changed

+34
-5
lines changed

platforms/blabsy-w3ds-auth-api/src/controllers/WebhookController.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type Chat = {
4646
type: "direct" | "group"; // Always set by webhook based on participant count
4747
name?: string;
4848
participants: string[];
49+
ename?: string; // eVault identifier (w3id)
4950
createdAt: Timestamp;
5051
updatedAt: Timestamp;
5152
lastMessage?: {
@@ -111,7 +112,12 @@ export class WebhookController {
111112

112113
const local = await adapter.fromGlobal({ data, mapping });
113114

114-
console.log(local);
115+
console.log("Webhook data received:", {
116+
globalId: id,
117+
tableName,
118+
hasEname: !!local.data.ename,
119+
ename: local.data.ename
120+
});
115121

116122
// Get the local ID from the mapping database
117123
const localId = await adapter.mappingDb.getLocalId(id);
@@ -285,10 +291,16 @@ export class WebhookController {
285291
// Derive type from participant count
286292
const type = participants.length > 2 ? "group" : "direct";
287293

294+
// Log ename processing for debugging
295+
if (data.ename) {
296+
console.log(`Processing chat with ename: ${data.ename}`);
297+
}
298+
288299
return {
289300
type,
290301
name: data.name,
291302
participants,
303+
ename: data.ename || null, // Include eVault identifier if available
292304
createdAt: data.createdAt
293305
? Timestamp.fromDate(new Date(data.createdAt))
294306
: now,

platforms/blabsy-w3ds-auth-api/src/web3adapter/mappings/chat.mapping.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"localToUniversalMap": {
77
"name": "name",
88
"type": "type",
9+
"ename": "ename",
910
"admins": "user(admins),admins",
1011
"participants": "user(participants[]),participantIds",
1112
"lastMessage": "lastMessageId",

platforms/cerberus/src/controllers/WebhookController.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class WebhookController {
154154
group.owner = local.data.owner as string;
155155
group.admins = admins;
156156
group.participants = participants;
157+
group.ename = local.data.ename as string;
157158

158159
// Only update charter if new data is provided, preserve existing if not
159160
if (newCharter !== undefined && newCharter !== null) {
@@ -187,6 +188,7 @@ export class WebhookController {
187188
admins,
188189
participants: participants,
189190
charter: local.data.charter as string,
191+
ename: local.data.ename as string
190192
});
191193

192194
console.log("Created group with ID:", group.id);

platforms/evoting-api/src/controllers/WebhookController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export class WebhookController {
151151
group.admins = adminIds.map(id => ({ id } as User));
152152
group.participants = participants;
153153
group.charter = local.data.charter as string;
154+
group.ename = local.data.ename as string
154155

155156
this.adapter.addToLockedIds(localId);
156157
await this.groupService.groupRepository.save(group);
@@ -163,9 +164,8 @@ export class WebhookController {
163164
local.data.owner as string,
164165
adminIds,
165166
participants.map(p => p.id),
166-
local.data.charter as string | undefined
167+
local.data.charter as string | undefined,
167168
);
168-
169169
console.log("Created group with ID:", group.id);
170170
console.log(group)
171171
this.adapter.addToLockedIds(group.id);

platforms/evoting-api/src/services/GroupService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class GroupService {
4444
isPrivate: boolean = false,
4545
visibility: "public" | "private" | "restricted" = "public",
4646
avatarUrl?: string,
47-
bannerUrl?: string
47+
bannerUrl?: string,
4848
): Promise<Group> {
4949
const members = await this.userRepository.findBy({
5050
id: In(memberIds),

platforms/pictique-api/src/controllers/WebhookController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ export class WebhookController {
209209
local.data.participants &&
210210
Array.isArray(local.data.participants)
211211
) {
212-
console.log(local);
213212
const participantPromises = local.data.participants.map(
214213
async (ref: string) => {
215214
if (ref && typeof ref === "string") {
@@ -230,6 +229,7 @@ export class WebhookController {
230229

231230
chat.name = local.data.name as string;
232231
chat.participants = participants;
232+
chat.ename = local.data.ename as string;
233233

234234
this.adapter.addToLockedIds(localId);
235235
await this.chatService.chatRepository.save(chat);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class Migration1756066336069 implements MigrationInterface {
4+
name = 'Migration1756066336069'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`ALTER TABLE "chat" ADD "ename" character varying`);
8+
}
9+
10+
public async down(queryRunner: QueryRunner): Promise<void> {
11+
await queryRunner.query(`ALTER TABLE "chat" DROP COLUMN "ename"`);
12+
}
13+
14+
}

0 commit comments

Comments
 (0)