diff --git a/src/lib/db/api-token-store.ts b/src/lib/db/api-token-store.ts index 5943c2ddc2f7..22af6db431b7 100644 --- a/src/lib/db/api-token-store.ts +++ b/src/lib/db/api-token-store.ts @@ -12,6 +12,7 @@ import { } from '../types/models/api-token'; import { ALL_PROJECTS } from '../util/constants'; import { Db } from './db'; +import { inTransaction } from './transaction'; const TABLE = 'api_tokens'; const API_LINK_TABLE = 'api_token_project'; @@ -139,7 +140,7 @@ export class ApiTokenStore implements IApiTokenStore { } async insert(newToken: IApiTokenCreate): Promise { - const response = await this.db.transaction(async (tx) => { + const response = await inTransaction(this.db, async (tx) => { const [row] = await tx(TABLE).insert( toRow(newToken), ['created_at'],