2024-03-20 16:02:51 -05:00
|
|
|
import { UserEntity } from 'src/entities/user.entity';
|
2023-01-11 21:34:36 -05:00
|
|
|
|
|
|
|
|
export interface UserListFilter {
|
2023-05-21 23:18:10 -04:00
|
|
|
withDeleted?: boolean;
|
2023-01-11 21:34:36 -05:00
|
|
|
}
|
|
|
|
|
|
2023-03-21 22:49:19 -04:00
|
|
|
export interface UserStatsQueryResponse {
|
|
|
|
|
userId: string;
|
2023-11-11 20:03:32 -05:00
|
|
|
userName: string;
|
2023-03-21 22:49:19 -04:00
|
|
|
photos: number;
|
|
|
|
|
videos: number;
|
|
|
|
|
usage: number;
|
2024-01-12 18:43:36 -06:00
|
|
|
quotaSizeInBytes: number | null;
|
2023-03-21 22:49:19 -04:00
|
|
|
}
|
|
|
|
|
|
2023-10-31 11:01:32 -04:00
|
|
|
export interface UserFindOptions {
|
|
|
|
|
withDeleted?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-11 21:34:36 -05:00
|
|
|
export const IUserRepository = 'IUserRepository';
|
|
|
|
|
|
|
|
|
|
export interface IUserRepository {
|
2023-10-31 11:01:32 -04:00
|
|
|
get(id: string, options: UserFindOptions): Promise<UserEntity | null>;
|
2023-01-11 21:34:36 -05:00
|
|
|
getAdmin(): Promise<UserEntity | null>;
|
2023-10-11 04:37:13 +02:00
|
|
|
hasAdmin(): Promise<boolean>;
|
2023-01-11 21:34:36 -05:00
|
|
|
getByEmail(email: string, withPassword?: boolean): Promise<UserEntity | null>;
|
2023-05-21 23:18:10 -04:00
|
|
|
getByStorageLabel(storageLabel: string): Promise<UserEntity | null>;
|
2023-01-11 21:34:36 -05:00
|
|
|
getByOAuthId(oauthId: string): Promise<UserEntity | null>;
|
2023-02-25 09:12:03 -05:00
|
|
|
getDeletedUsers(): Promise<UserEntity[]>;
|
2023-01-11 21:34:36 -05:00
|
|
|
getList(filter?: UserListFilter): Promise<UserEntity[]>;
|
2023-03-21 22:49:19 -04:00
|
|
|
getUserStats(): Promise<UserStatsQueryResponse[]>;
|
2023-01-11 21:34:36 -05:00
|
|
|
create(user: Partial<UserEntity>): Promise<UserEntity>;
|
|
|
|
|
update(id: string, user: Partial<UserEntity>): Promise<UserEntity>;
|
2023-02-25 09:12:03 -05:00
|
|
|
delete(user: UserEntity, hard?: boolean): Promise<UserEntity>;
|
2024-01-12 18:43:36 -06:00
|
|
|
updateUsage(id: string, delta: number): Promise<void>;
|
2024-01-15 09:04:29 -06:00
|
|
|
syncUsage(id?: string): Promise<void>;
|
2023-01-11 21:34:36 -05:00
|
|
|
}
|