2024-03-20 22:02:51 +01:00
|
|
|
import { APIKeyEntity } from 'src/entities/api-key.entity';
|
2023-01-18 15:40:15 +01:00
|
|
|
|
|
|
|
export const IKeyRepository = 'IKeyRepository';
|
|
|
|
|
|
|
|
export interface IKeyRepository {
|
|
|
|
create(dto: Partial<APIKeyEntity>): Promise<APIKeyEntity>;
|
2023-02-18 21:58:55 +01:00
|
|
|
update(userId: string, id: string, dto: Partial<APIKeyEntity>): Promise<APIKeyEntity>;
|
|
|
|
delete(userId: string, id: string): Promise<void>;
|
2023-01-18 15:40:15 +01:00
|
|
|
/**
|
|
|
|
* Includes the hashed `key` for verification
|
|
|
|
* @param id
|
|
|
|
*/
|
2023-01-27 21:50:07 +01:00
|
|
|
getKey(hashedToken: string): Promise<APIKeyEntity | null>;
|
2023-02-18 21:58:55 +01:00
|
|
|
getById(userId: string, id: string): Promise<APIKeyEntity | null>;
|
2023-01-18 15:40:15 +01:00
|
|
|
getByUserId(userId: string): Promise<APIKeyEntity[]>;
|
|
|
|
}
|