refactor: api key spec to use factories (#16776)

This commit is contained in:
Jason Rasmussen
2025-03-10 12:04:35 -04:00
committed by GitHub
parent fe959b2f05
commit e97df503f2
9 changed files with 150 additions and 82 deletions

View File

@@ -12,7 +12,7 @@ export class ApiKeyRepository {
constructor(@InjectKysely() private db: Kysely<DB>) {}
create(dto: Insertable<ApiKeys>) {
return this.db.insertInto('api_keys').values(dto).returningAll().executeTakeFirstOrThrow();
return this.db.insertInto('api_keys').values(dto).returning(columns.apiKey).executeTakeFirstOrThrow();
}
async update(userId: string, id: string, dto: Updateable<ApiKeys>) {
@@ -21,7 +21,7 @@ export class ApiKeyRepository {
.set(dto)
.where('api_keys.userId', '=', userId)
.where('id', '=', asUuid(id))
.returningAll()
.returning(columns.apiKey)
.executeTakeFirstOrThrow();
}