@@ -14,20 +14,22 @@ interface NotificationRow {
1414 homeserver_url : string | null ;
1515 room_id : string | null ;
1616 access_token : string | null ;
17+ account_sid : string | null ;
18+ twilio_phone_number : string | null ;
1719 created_at : Date ;
1820 updated_at : Date ;
1921}
2022
2123const COLUMNS = `id, user_id, team_id, type, notification_name, address, phone,
22- homeserver_url, room_id, access_token, created_at, updated_at` ;
24+ homeserver_url, room_id, access_token, account_sid, twilio_phone_number, created_at, updated_at` ;
2325
2426export class TimescaleNotificationsRepository implements INotificationsRepository {
2527 constructor ( private pool : Pool ) { }
2628
2729 create = async ( data : Partial < Notification > ) : Promise < Notification > => {
2830 const result = await this . pool . query < NotificationRow > (
29- `INSERT INTO notifications (user_id, team_id, type, notification_name, address, phone, homeserver_url, room_id, access_token)
30- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
31+ `INSERT INTO notifications (user_id, team_id, type, notification_name, address, phone, homeserver_url, room_id, access_token, account_sid, twilio_phone_number )
32+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11 )
3133 RETURNING ${ COLUMNS } ` ,
3234 [
3335 data . userId ,
@@ -39,6 +41,8 @@ export class TimescaleNotificationsRepository implements INotificationsRepositor
3941 data . homeserverUrl ?? null ,
4042 data . roomId ?? null ,
4143 data . accessToken ?? null ,
44+ data . accountSid ?? null ,
45+ data . twilioPhoneNumber ?? null ,
4246 ]
4347 ) ;
4448 const row = result . rows [ 0 ] ;
@@ -83,6 +87,8 @@ export class TimescaleNotificationsRepository implements INotificationsRepositor
8387 [ "homeserverUrl" , "homeserver_url" ] ,
8488 [ "roomId" , "room_id" ] ,
8589 [ "accessToken" , "access_token" ] ,
90+ [ "accountSid" , "account_sid" ] ,
91+ [ "twilioPhoneNumber" , "twilio_phone_number" ] ,
8692 ] ;
8793
8894 for ( const [ key , column ] of fieldMap ) {
@@ -134,6 +140,8 @@ export class TimescaleNotificationsRepository implements INotificationsRepositor
134140 homeserverUrl : row . homeserver_url ?? undefined ,
135141 roomId : row . room_id ?? undefined ,
136142 accessToken : row . access_token ?? undefined ,
143+ accountSid : row . account_sid ?? undefined ,
144+ twilioPhoneNumber : row . twilio_phone_number ?? undefined ,
137145 createdAt : row . created_at . toISOString ( ) ,
138146 updatedAt : row . updated_at . toISOString ( ) ,
139147 } ) ;
0 commit comments