[messaging] rename syncExternalId to syncCursor (#4752)

## Context

SyncExternalId should be renamed because this won't always represent an
id. For example, microsoft API does not use ids but dates for their
sync. Also we think external is a bit redundant so we are removing it.

Note: this field is not used by the front-end (and will probably never
be)
This commit is contained in:
Weiko
2024-04-02 18:18:43 +02:00
committed by GitHub
parent 9364a58477
commit 35ddb9acb5
5 changed files with 18 additions and 18 deletions

View File

@ -223,7 +223,7 @@ export class GmailFullSyncV2Service {
`Fetched all ${messageIdsToFetch} message ids from Gmail for messageChannel ${messageChannelId} in workspace ${workspaceId} and added to cache for import`,
);
await this.updateLastSyncExternalId(
await this.updateLastSyncCursor(
gmailClient,
messageChannelId,
firstMessageExternalId,
@ -256,7 +256,7 @@ export class GmailFullSyncV2Service {
return blocklist.map((blocklist) => blocklist.handle);
}
private async updateLastSyncExternalId(
private async updateLastSyncCursor(
gmailClient: gmail_v1.Gmail,
messageChannelId: string,
firstMessageExternalId: string,
@ -292,7 +292,7 @@ export class GmailFullSyncV2Service {
`Updating last external id: ${historyId} for workspace ${workspaceId} and account ${messageChannelId} succeeded.`,
);
await this.messageChannelRepository.updateLastSyncExternalIdIfHigher(
await this.messageChannelRepository.updateLastSyncCursorIfHigher(
messageChannelId,
historyId,
workspaceId,

View File

@ -102,7 +102,7 @@ export class GmailPartialSyncV2Service {
await workspaceDataSource
?.transaction(async (transactionManager: EntityManager) => {
const lastSyncHistoryId = gmailMessageChannel.syncExternalId;
const lastSyncHistoryId = gmailMessageChannel.syncCursor;
if (!lastSyncHistoryId) {
this.logger.log(
@ -134,7 +134,7 @@ export class GmailPartialSyncV2Service {
`404: Invalid lastSyncHistoryId: ${lastSyncHistoryId} for workspace ${workspaceId} and account ${connectedAccountId}, falling back to full sync.`,
);
await this.messageChannelRepository.resetSyncExternalId(
await this.messageChannelRepository.resetSyncCursor(
gmailMessageChannel.id,
workspaceId,
transactionManager,
@ -206,7 +206,7 @@ export class GmailPartialSyncV2Service {
messagesDeleted,
);
await this.messageChannelRepository.updateLastSyncExternalIdIfHigher(
await this.messageChannelRepository.updateLastSyncCursorIfHigher(
gmailMessageChannel.id,
historyId,
workspaceId,