[calendar/messaging] fix connected account auth failed should skip sync (#4920)
- AuthFailedAt is set when a refreshToken is not valid and an accessToken can't be generated, meaning it will need a manual action from the user to provide a new refresh token. - Calendar/messaging jobs should not be executed if authFailedAt is not null.
This commit is contained in:
@ -27,6 +27,30 @@ export class CalendarChannelRepository {
|
||||
);
|
||||
}
|
||||
|
||||
public async create(
|
||||
calendarChannel: Pick<
|
||||
ObjectRecord<CalendarChannelObjectMetadata>,
|
||||
'id' | 'connectedAccountId' | 'handle' | 'visibility'
|
||||
>,
|
||||
workspaceId: string,
|
||||
transactionManager?: EntityManager,
|
||||
): Promise<void> {
|
||||
const dataSourceSchema =
|
||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
||||
|
||||
await this.workspaceDataSourceService.executeRawQuery(
|
||||
`INSERT INTO ${dataSourceSchema}."calendarChannel" (id, "connectedAccountId", "handle", "visibility") VALUES ($1, $2, $3, $4)`,
|
||||
[
|
||||
calendarChannel.id,
|
||||
calendarChannel.connectedAccountId,
|
||||
calendarChannel.handle,
|
||||
calendarChannel.visibility,
|
||||
],
|
||||
workspaceId,
|
||||
transactionManager,
|
||||
);
|
||||
}
|
||||
|
||||
public async getByConnectedAccountId(
|
||||
connectedAccountId: string,
|
||||
workspaceId: string,
|
||||
|
||||
Reference in New Issue
Block a user