aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Services/UserService.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-31 21:57:09 +0800
committercrupest <crupest@outlook.com>2020-01-31 21:57:09 +0800
commit3749a642306b19c84f324b0e94c4d62d8ec60332 (patch)
tree9039ebf7eb7a21d2e57bbe928e43bf39a42473b1 /Timeline/Services/UserService.cs
parenta7fd42ddee50a8066a083c57b7940e4f9896dcb7 (diff)
downloadtimeline-3749a642306b19c84f324b0e94c4d62d8ec60332.tar.gz
timeline-3749a642306b19c84f324b0e94c4d62d8ec60332.tar.bz2
timeline-3749a642306b19c84f324b0e94c4d62d8ec60332.zip
Fix test bugs in user info mapper. Make create user action return created user info.
Diffstat (limited to 'Timeline/Services/UserService.cs')
-rw-r--r--Timeline/Services/UserService.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Timeline/Services/UserService.cs b/Timeline/Services/UserService.cs
index d2dc969e..93d92740 100644
--- a/Timeline/Services/UserService.cs
+++ b/Timeline/Services/UserService.cs
@@ -64,7 +64,7 @@ namespace Timeline.Services
/// </summary>
/// <param name="info">The info of new user.</param>
/// <param name="password">The password, can't be null or empty.</param>
- /// <returns>The id of the new user.</returns>
+ /// <returns>The the new user.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="info"/>is null.</exception>
/// <exception cref="ArgumentException">Thrown when some fields in <paramref name="info"/> is bad.</exception>
/// <exception cref="ConflictException">Thrown when a user with given username already exists.</exception>
@@ -75,7 +75,7 @@ namespace Timeline.Services
/// <see cref="User.Nickname"/> must be a valid nickname if set. It is empty by default.
/// Other fields are ignored.
/// </remarks>
- Task<long> CreateUser(User info);
+ Task<User> CreateUser(User info);
/// <summary>
/// Modify a user's info.
@@ -276,7 +276,7 @@ namespace Timeline.Services
return entities.Select(user => CreateUserFromEntity(user)).ToArray();
}
- public async Task<long> CreateUser(User info)
+ public async Task<User> CreateUser(User info)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
@@ -316,7 +316,7 @@ namespace Timeline.Services
_logger.LogInformation(Log.Format(LogDatabaseCreate,
("Id", newEntity.Id), ("Username", username), ("Administrator", administrator)));
- return newEntity.Id;
+ return CreateUserFromEntity(newEntity);
}
private void ValidateModifyUserInfo(User? info)