|
| 1 | +import User from '../entity/user.entity'; |
| 2 | +import { |
| 3 | + OperationType, |
| 4 | + UpdateUserGroupInput, |
| 5 | + UpdateUserInput, |
| 6 | + UpdateUserPermissionInput, |
| 7 | + UserInputFilter, |
| 8 | +} from '../../schema/graphql.schema'; |
| 9 | +import Group from '../entity/group.entity'; |
| 10 | +import Permission from '../entity/permission.entity'; |
| 11 | + |
| 12 | +export interface UserServiceInterface { |
| 13 | + getAllUsers(input?: UserInputFilter): Promise<[User[], number]>; |
| 14 | + |
| 15 | + getUserById(id: string): Promise<User>; |
| 16 | + |
| 17 | + createUser(user: User): Promise<User>; |
| 18 | + |
| 19 | + updateUser(id: string, user: UpdateUserInput): Promise<User>; |
| 20 | + |
| 21 | + updateUserGroups(id: string, user: UpdateUserGroupInput): Promise<Group[]>; |
| 22 | + |
| 23 | + getUserGroups(id: string): Promise<Group[]>; |
| 24 | + |
| 25 | + updateUserPermissions( |
| 26 | + id: string, |
| 27 | + request: UpdateUserPermissionInput, |
| 28 | + ): Promise<Permission[]>; |
| 29 | + |
| 30 | + getUserPermissions(id: string): Promise<Permission[]>; |
| 31 | + |
| 32 | + deleteUser(id: string): Promise<User>; |
| 33 | + |
| 34 | + getAllUserpermissionIds(id: string): Promise<Set<string>>; |
| 35 | + |
| 36 | + permissionsOfUser(id: string): Promise<Permission[]>; |
| 37 | + |
| 38 | + verifyUserPermissions( |
| 39 | + id: string, |
| 40 | + permissionsToVerify: string[], |
| 41 | + operation?: OperationType, |
| 42 | + ): Promise<boolean>; |
| 43 | + |
| 44 | + verifyDuplicateUser( |
| 45 | + email?: string | undefined, |
| 46 | + phone?: string | undefined, |
| 47 | + ): Promise<{ existingUserDetails?: User | null; duplicate: string }>; |
| 48 | + |
| 49 | + getUserDetailsByEmailOrPhone( |
| 50 | + email?: string | undefined, |
| 51 | + phone?: string | undefined, |
| 52 | + ): Promise<any>; |
| 53 | + |
| 54 | + getUserDetailsByUsername( |
| 55 | + email?: string | undefined, |
| 56 | + phone?: string | undefined, |
| 57 | + ): Promise<User | null>; |
| 58 | + |
| 59 | + updateField(id: string, field: string, value: any): Promise<User>; |
| 60 | + |
| 61 | + getActiveUserByPhoneNumber(phone: string): Promise<User | null>; |
| 62 | + |
| 63 | + setOtpSecret(user: User, twoFASecret: string): Promise<void>; |
| 64 | +} |
| 65 | + |
| 66 | +export const UserServiceInterface = Symbol('UserServiceInterface'); |
0 commit comments