From a6150c487e7a0eb3fb1d9874d2fa7de61cdbfd30 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 27 Apr 2021 19:29:20 +0800 Subject: refactor: ... --- BackEnd/Timeline/Services/User/IUserService.cs | 71 ++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 BackEnd/Timeline/Services/User/IUserService.cs (limited to 'BackEnd/Timeline/Services/User/IUserService.cs') diff --git a/BackEnd/Timeline/Services/User/IUserService.cs b/BackEnd/Timeline/Services/User/IUserService.cs new file mode 100644 index 00000000..06155c55 --- /dev/null +++ b/BackEnd/Timeline/Services/User/IUserService.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Timeline.Entities; + +namespace Timeline.Services.User +{ + public interface IUserService : IBasicUserService + { + /// + /// Try to get a user by id. + /// + /// The id of the user. + /// The user info. + /// Thrown when the user with given id does not exist. + Task GetUserAsync(long id); + + /// + /// List all users. + /// + /// The user info of users. + Task> GetUsersAsync(); + + /// + /// Create a user with given info. + /// + /// Info of new user. + /// The the new user. + /// Thrown when is null. + /// Thrown when param field is illegal. + /// Thrown when a user with given username already exists. + Task CreateUserAsync(CreateUserParams param); + + /// + /// Modify a user. + /// + /// The id of the user. + /// The new information. + /// The new user info. + /// Thrown when some fields in is bad. + /// Thrown when user with given id does not exist. + /// + /// Version will increase if password is changed. + /// + Task ModifyUserAsync(long id, ModifyUserParams? param); + + /// + /// Try to verify the given username and password. + /// + /// The username of the user to verify. + /// The password of the user to verify. + /// User id. + /// Thrown when or is null. + /// Thrown when is of bad format or is empty. + /// Thrown when the user with given username does not exist. + /// Thrown when password is wrong. + Task VerifyCredential(string username, string password); + + /// + /// Try to change a user's password with old password. + /// + /// The id of user to change password of. + /// Old password. + /// New password. + /// Thrown if or is null. + /// Thrown if or is empty. + /// Thrown if the user with given username does not exist. + /// Thrown if the old password is wrong. + Task ChangePassword(long id, string oldPassword, string newPassword); + } +} -- cgit v1.2.3