aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-08 15:35:36 +0800
committercrupest <crupest@outlook.com>2020-08-08 15:35:36 +0800
commit976f1d9d7062aaedca52cdd6398576b717b5f58f (patch)
tree8847b5500a529b6b62e11fb0a3db742be9c0210e
parent5a0a27a047f7f59af1cab4ac2f25e684f58b3447 (diff)
downloadtimeline-976f1d9d7062aaedca52cdd6398576b717b5f58f.tar.gz
timeline-976f1d9d7062aaedca52cdd6398576b717b5f58f.tar.bz2
timeline-976f1d9d7062aaedca52cdd6398576b717b5f58f.zip
Add user unique id.
-rw-r--r--Timeline.Tests/IntegratedTests/UserTest.cs9
-rw-r--r--Timeline/Models/Http/UserInfo.cs1
-rw-r--r--Timeline/Models/User.cs1
-rw-r--r--Timeline/Services/UserService.cs1
4 files changed, 12 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/UserTest.cs b/Timeline.Tests/IntegratedTests/UserTest.cs
index 7fd78d0e..9dfcc6a5 100644
--- a/Timeline.Tests/IntegratedTests/UserTest.cs
+++ b/Timeline.Tests/IntegratedTests/UserTest.cs
@@ -12,6 +12,15 @@ namespace Timeline.Tests.IntegratedTests
public class UserTest : IntegratedTestBase
{
[Fact]
+ public void UserListShouldHaveUniqueId()
+ {
+ foreach (var user in UserInfos)
+ {
+ user.UniqueId.Should().NotBeNullOrWhiteSpace();
+ }
+ }
+
+ [Fact]
public async Task GetList_NoAuth()
{
using var client = await CreateDefaultClient();
diff --git a/Timeline/Models/Http/UserInfo.cs b/Timeline/Models/Http/UserInfo.cs
index 0acb1a80..c9a26072 100644
--- a/Timeline/Models/Http/UserInfo.cs
+++ b/Timeline/Models/Http/UserInfo.cs
@@ -9,6 +9,7 @@ namespace Timeline.Models.Http
{
public class UserInfo
{
+ public string UniqueId { get; set; } = default!;
public string Username { get; set; } = default!;
public string Nickname { get; set; } = default!;
public bool? Administrator { get; set; } = default!;
diff --git a/Timeline/Models/User.cs b/Timeline/Models/User.cs
index 37777eba..fa780efd 100644
--- a/Timeline/Models/User.cs
+++ b/Timeline/Models/User.cs
@@ -2,6 +2,7 @@
{
public class User
{
+ public string? UniqueId { get; set; }
public string? Username { get; set; }
public string? Nickname { get; set; }
diff --git a/Timeline/Services/UserService.cs b/Timeline/Services/UserService.cs
index c20b180c..91d27965 100644
--- a/Timeline/Services/UserService.cs
+++ b/Timeline/Services/UserService.cs
@@ -205,6 +205,7 @@ namespace Timeline.Services
{
return new User
{
+ UniqueId = entity.UniqueId,
Username = entity.Username,
Administrator = UserRoleConvert.ToBool(entity.Roles),
Nickname = string.IsNullOrEmpty(entity.Nickname) ? entity.Username : entity.Nickname,