mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 01:11:07 +03:00
feat: migration api keys to use kysely (#15206)
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
import { Insertable } from 'kysely';
|
||||
import { ApiKeys } from 'src/db';
|
||||
import { APIKeyEntity } from 'src/entities/api-key.entity';
|
||||
import { AuthApiKey } from 'src/types';
|
||||
|
||||
export const IKeyRepository = 'IKeyRepository';
|
||||
|
||||
export interface IKeyRepository {
|
||||
create(dto: Partial<APIKeyEntity>): Promise<APIKeyEntity>;
|
||||
create(dto: Insertable<ApiKeys>): Promise<APIKeyEntity>;
|
||||
update(userId: string, id: string, dto: Partial<APIKeyEntity>): Promise<APIKeyEntity>;
|
||||
delete(userId: string, id: string): Promise<void>;
|
||||
/**
|
||||
* Includes the hashed `key` for verification
|
||||
* @param id
|
||||
*/
|
||||
getKey(hashedToken: string): Promise<APIKeyEntity | null>;
|
||||
getKey(hashedToken: string): Promise<AuthApiKey | undefined>;
|
||||
getById(userId: string, id: string): Promise<APIKeyEntity | null>;
|
||||
getByUserId(userId: string): Promise<APIKeyEntity[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user