@@ -7,25 +7,34 @@ import type {
7
7
} from '@accounts/common' ;
8
8
9
9
export interface DBInterface {
10
- findPasswordHash ( userId : string ) : Promise < ?string > ,
11
- createUser ( user : CreateUserType ) : Promise < string > ,
10
+ // Find user by identity fields
12
11
findUserByEmail ( email : string ) : Promise < ?UserObjectType > ,
13
12
findUserByUsername ( username : string ) : Promise < ?UserObjectType > ,
14
13
findUserById ( userId : string ) : Promise < ?UserObjectType > ,
15
- findUserByEmailVerificationToken ( token : string ) : Promise < ?UserObjectType > ,
16
- findUserByResetPasswordToken ( token : string ) : Promise < ?UserObjectType > ,
14
+
15
+ // Create and update users
16
+ createUser ( user : CreateUserType ) : Promise < string > ,
17
17
setUsername ( userId : string , newUsername : string ) : Promise < void > ,
18
+ setProfile ( userId : string , profile : Object ) : Promise < Object > ,
19
+
20
+ // Password related operation
21
+ findPasswordHash ( userId : string ) : Promise < ?string > ,
22
+ findUserByResetPasswordToken ( token : string ) : Promise < ?UserObjectType > ,
23
+ setPasssword ( userId : string , newPassword : string ) : Promise < void > ,
24
+ addResetPasswordToken ( userId : string , email : string , token : string , reason ? : string ) : Promise < void > ,
25
+ setResetPasssword ( userId : string , email : string , newPassword : string , token : string ) : Promise < void > ,
26
+
27
+ // Email related operations
28
+ findUserByEmailVerificationToken ( token : string ) : Promise < ?UserObjectType > ,
18
29
addEmail ( userId : string , newEmail : string , verified : boolean ) : Promise < void > ,
19
30
removeEmail ( userId : string , email : string ) : Promise < void > ,
20
31
verifyEmail ( userId : string , email : string ) : Promise < void > ,
21
- setPasssword ( userId : string , newPassword : string ) : Promise < void > ,
32
+ addEmailVerificationToken ( userId : string , email : string , token : string ) : Promise < void > ,
33
+
34
+ // Session related operations
35
+ findSessionById ( sessionId : string ) : Promise < ?SessionType > ,
22
36
createSession ( userId : string , ip : ?string , userAgent : ?string ) : Promise < string > ,
23
37
updateSession ( sessionId : string , ip : string , userAgent : string ) : Promise < void > ,
24
38
invalidateSession ( sessionId : string ) : Promise < void > ,
25
- invalidateAllSessions ( userId : string ) : Promise < void > ,
26
- findSessionById ( sessionId : string ) : Promise < ?SessionType > ,
27
- addEmailVerificationToken ( userId : string , email : string , token : string ) : Promise < void > ,
28
- addResetPasswordToken ( userId : string , email : string , token : string , reason ? : string ) : Promise < void > ,
29
- setResetPasssword ( userId : string , email : string , newPassword : string , token : string ) : Promise < void > ,
30
- setProfile ( userId : string , profile : Object ) : Promise < Object >
39
+ invalidateAllSessions ( userId : string ) : Promise < void >
31
40
}
0 commit comments