2025-01-13 19:45:52 -06:00
|
|
|
import { Insertable, Updateable } from 'kysely';
|
|
|
|
|
import { Sessions } from 'src/db';
|
2024-04-19 06:47:29 -04:00
|
|
|
import { SessionEntity } from 'src/entities/session.entity';
|
|
|
|
|
|
|
|
|
|
export const ISessionRepository = 'ISessionRepository';
|
|
|
|
|
|
2024-04-20 23:45:55 -04:00
|
|
|
type E = SessionEntity;
|
2024-04-27 16:45:16 -04:00
|
|
|
export type SessionSearchOptions = { updatedBefore: Date };
|
2024-04-20 23:45:55 -04:00
|
|
|
|
2024-04-19 06:47:29 -04:00
|
|
|
export interface ISessionRepository {
|
2024-04-27 16:45:16 -04:00
|
|
|
search(options: SessionSearchOptions): Promise<SessionEntity[]>;
|
2025-01-13 19:45:52 -06:00
|
|
|
create(dto: Insertable<Sessions>): Promise<SessionEntity>;
|
|
|
|
|
update(id: string, dto: Updateable<Sessions>): Promise<SessionEntity>;
|
2024-04-19 06:47:29 -04:00
|
|
|
delete(id: string): Promise<void>;
|
2025-01-13 19:45:52 -06:00
|
|
|
getByToken(token: string): Promise<E | undefined>;
|
2024-04-20 23:45:55 -04:00
|
|
|
getByUserId(userId: string): Promise<E[]>;
|
2024-04-19 06:47:29 -04:00
|
|
|
}
|