88 Contact ,
99 EmailExtractionResult ,
1010 EmailStatus ,
11+ ExportService ,
1112 ExtractionResult ,
1213 FileExtractionResult ,
1314 Tag
@@ -26,7 +27,7 @@ export default class PgContacts implements Contacts {
2627 JOIN private.engagement e
2728 ON e.email = contacts.email
2829 AND e.user_id = $1
29- AND e.engagement_type = 'CSV '
30+ AND e.engagement_type = 'EXPORT '
3031 ` ;
3132
3233 private static readonly SELECT_NON_EXPORTED_CONTACTS = `
@@ -35,7 +36,7 @@ export default class PgContacts implements Contacts {
3536 LEFT JOIN private.engagement e
3637 ON e.email = contacts.email
3738 AND e.user_id = $1
38- AND e.engagement_type = 'CSV '
39+ AND e.engagement_type = 'EXPORT '
3940 WHERE e.email IS NULL;
4041 ` ;
4142
@@ -51,7 +52,7 @@ export default class PgContacts implements Contacts {
5152 JOIN private.engagement e
5253 ON e.email = contacts.email
5354 AND e.user_id = $1
54- AND e.engagement_type = 'CSV '
55+ AND e.engagement_type = 'EXPORT '
5556 ` ;
5657
5758 private static readonly SELECT_NON_EXPORTED_CONTACTS_BY_EMAILS = `
@@ -60,7 +61,7 @@ export default class PgContacts implements Contacts {
6061 LEFT JOIN private.engagement e
6162 ON e.email = contacts.email
6263 AND e.user_id = $1
63- AND e.engagement_type = 'CSV '
64+ AND e.engagement_type = 'EXPORT '
6465 WHERE e.email IS NULL;
6566 ` ;
6667
@@ -71,7 +72,7 @@ export default class PgContacts implements Contacts {
7172 WHERE persons.email = update.email AND persons.user_id = %L AND persons.status IS NULL` ;
7273
7374 private static readonly INSERT_EXPORTED_CONTACT =
74- 'INSERT INTO private.engagement (user_id, email, engagement_type) VALUES %L ON CONFLICT (email, user_id, engagement_type) DO NOTHING;' ;
75+ 'INSERT INTO private.engagement (user_id, email, engagement_type, service ) VALUES %L ON CONFLICT (email, user_id, engagement_type, service ) DO NOTHING;' ;
7576
7677 private static readonly INSERT_MESSAGE_SQL = `
7778 INSERT INTO private.messages("channel","folder_path","date","message_id","references","list_id","conversation","user_id")
@@ -452,10 +453,11 @@ export default class PgContacts implements Contacts {
452453
453454 async registerExportedContacts (
454455 contactIds : string [ ] ,
456+ service : ExportService ,
455457 userId : string
456458 ) : Promise < void > {
457459 try {
458- const values = contactIds . map ( ( id ) => [ userId , id , 'CSV' ] ) ;
460+ const values = contactIds . map ( ( id ) => [ userId , id , 'EXPORT' , service ] ) ;
459461 await this . pool . query ( format ( PgContacts . INSERT_EXPORTED_CONTACT , values ) ) ;
460462 } catch ( error ) {
461463 this . logger . error ( error ) ;
0 commit comments