mirror of
https://github.com/immich-app/immich.git
synced 2025-12-21 09:15:44 +03:00
refactor: migrate sessions repository to kysely (#15268)
* wip: search * wip: getByToken * wip: getByToken * wip: getByUserId * wip: create/update/delete * remove unused code * clean up and pr feedback * fix: test * fix: e2e test * pr feedback
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { Insertable, Updateable } from 'kysely';
|
||||
import { Sessions } from 'src/db';
|
||||
import { SessionEntity } from 'src/entities/session.entity';
|
||||
|
||||
export const ISessionRepository = 'ISessionRepository';
|
||||
@@ -7,9 +9,9 @@ export type SessionSearchOptions = { updatedBefore: Date };
|
||||
|
||||
export interface ISessionRepository {
|
||||
search(options: SessionSearchOptions): Promise<SessionEntity[]>;
|
||||
create<T extends Partial<E>>(dto: T): Promise<T>;
|
||||
update<T extends Partial<E>>(dto: T): Promise<T>;
|
||||
create(dto: Insertable<Sessions>): Promise<SessionEntity>;
|
||||
update(id: string, dto: Updateable<Sessions>): Promise<SessionEntity>;
|
||||
delete(id: string): Promise<void>;
|
||||
getByToken(token: string): Promise<E | null>;
|
||||
getByToken(token: string): Promise<E | undefined>;
|
||||
getByUserId(userId: string): Promise<E[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user