File tree Expand file tree Collapse file tree 7 files changed +34
-5
lines changed Expand file tree Collapse file tree 7 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ type Chat = {
46
46
type : "direct" | "group" ; // Always set by webhook based on participant count
47
47
name ?: string ;
48
48
participants : string [ ] ;
49
+ ename ?: string ; // eVault identifier (w3id)
49
50
createdAt : Timestamp ;
50
51
updatedAt : Timestamp ;
51
52
lastMessage ?: {
@@ -111,7 +112,12 @@ export class WebhookController {
111
112
112
113
const local = await adapter . fromGlobal ( { data, mapping } ) ;
113
114
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
+ } ) ;
115
121
116
122
// Get the local ID from the mapping database
117
123
const localId = await adapter . mappingDb . getLocalId ( id ) ;
@@ -285,10 +291,16 @@ export class WebhookController {
285
291
// Derive type from participant count
286
292
const type = participants . length > 2 ? "group" : "direct" ;
287
293
294
+ // Log ename processing for debugging
295
+ if ( data . ename ) {
296
+ console . log ( `Processing chat with ename: ${ data . ename } ` ) ;
297
+ }
298
+
288
299
return {
289
300
type,
290
301
name : data . name ,
291
302
participants,
303
+ ename : data . ename || null , // Include eVault identifier if available
292
304
createdAt : data . createdAt
293
305
? Timestamp . fromDate ( new Date ( data . createdAt ) )
294
306
: now ,
Original file line number Diff line number Diff line change 6
6
"localToUniversalMap" : {
7
7
"name" : " name" ,
8
8
"type" : " type" ,
9
+ "ename" : " ename" ,
9
10
"admins" : " user(admins),admins" ,
10
11
"participants" : " user(participants[]),participantIds" ,
11
12
"lastMessage" : " lastMessageId" ,
Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ export class WebhookController {
154
154
group . owner = local . data . owner as string ;
155
155
group . admins = admins ;
156
156
group . participants = participants ;
157
+ group . ename = local . data . ename as string ;
157
158
158
159
// Only update charter if new data is provided, preserve existing if not
159
160
if ( newCharter !== undefined && newCharter !== null ) {
@@ -187,6 +188,7 @@ export class WebhookController {
187
188
admins,
188
189
participants : participants ,
189
190
charter : local . data . charter as string ,
191
+ ename : local . data . ename as string
190
192
} ) ;
191
193
192
194
console . log ( "Created group with ID:" , group . id ) ;
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ export class WebhookController {
151
151
group . admins = adminIds . map ( id => ( { id } as User ) ) ;
152
152
group . participants = participants ;
153
153
group . charter = local . data . charter as string ;
154
+ group . ename = local . data . ename as string
154
155
155
156
this . adapter . addToLockedIds ( localId ) ;
156
157
await this . groupService . groupRepository . save ( group ) ;
@@ -163,9 +164,8 @@ export class WebhookController {
163
164
local . data . owner as string ,
164
165
adminIds ,
165
166
participants . map ( p => p . id ) ,
166
- local . data . charter as string | undefined
167
+ local . data . charter as string | undefined ,
167
168
) ;
168
-
169
169
console . log ( "Created group with ID:" , group . id ) ;
170
170
console . log ( group )
171
171
this . adapter . addToLockedIds ( group . id ) ;
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export class GroupService {
44
44
isPrivate : boolean = false ,
45
45
visibility : "public" | "private" | "restricted" = "public" ,
46
46
avatarUrl ?: string ,
47
- bannerUrl ?: string
47
+ bannerUrl ?: string ,
48
48
) : Promise < Group > {
49
49
const members = await this . userRepository . findBy ( {
50
50
id : In ( memberIds ) ,
Original file line number Diff line number Diff line change @@ -209,7 +209,6 @@ export class WebhookController {
209
209
local . data . participants &&
210
210
Array . isArray ( local . data . participants )
211
211
) {
212
- console . log ( local ) ;
213
212
const participantPromises = local . data . participants . map (
214
213
async ( ref : string ) => {
215
214
if ( ref && typeof ref === "string" ) {
@@ -230,6 +229,7 @@ export class WebhookController {
230
229
231
230
chat . name = local . data . name as string ;
232
231
chat . participants = participants ;
232
+ chat . ename = local . data . ename as string ;
233
233
234
234
this . adapter . addToLockedIds ( localId ) ;
235
235
await this . chatService . chatRepository . save ( chat ) ;
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments