Skip to content

Commit

Permalink
Add inTransaction for api-token-store
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonfournier committed Oct 6, 2023
1 parent e0c9b5f commit 0cd0f7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/db/api-token-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -139,7 +140,7 @@ export class ApiTokenStore implements IApiTokenStore {
}

async insert(newToken: IApiTokenCreate): Promise<IApiToken> {
const response = await this.db.transaction(async (tx) => {
const response = await inTransaction(this.db, async (tx) => {
const [row] = await tx<ITokenInsert>(TABLE).insert(
toRow(newToken),
['created_at'],
Expand Down

0 comments on commit 0cd0f7a

Please sign in to comment.