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
commit7de532360c5e02729f41510bb5d339edc7b378db (patch)
treea99eb58b6c3abdd5b6f8fde2fa59c37e01deebea
parent105444ff90af277c84edbdc6824cdd412c1f348a (diff)
downloadtimeline-7de532360c5e02729f41510bb5d339edc7b378db.tar.gz
timeline-7de532360c5e02729f41510bb5d339edc7b378db.tar.bz2
timeline-7de532360c5e02729f41510bb5d339edc7b378db.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,