aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BackEnd/Timeline.Tests/ErrorCodeTest.cs1
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/CacheTestHelper.cs1
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs12
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/TokenTest.cs8
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs1
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/UserAvatarTest.cs13
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/UserPermissionTest.cs9
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/UserTest.cs12
-rw-r--r--BackEnd/Timeline.Tests/Services/SearchServiceTest.cs4
-rw-r--r--BackEnd/Timeline.Tests/Services/UserPermissionServiceTest.cs9
-rw-r--r--BackEnd/Timeline.Tests/UsernameValidatorUnitTest.cs3
-rw-r--r--BackEnd/Timeline/Controllers/ActionResultControllerExtensions.cs24
-rw-r--r--BackEnd/Timeline/Controllers/BookmarkTimelineController.cs34
-rw-r--r--BackEnd/Timeline/Controllers/HighlightTimelineController.cs34
-rw-r--r--BackEnd/Timeline/Controllers/Resource.Designer.cs153
-rw-r--r--BackEnd/Timeline/Controllers/Resource.resx51
-rw-r--r--BackEnd/Timeline/Controllers/SearchController.cs4
-rw-r--r--BackEnd/Timeline/Controllers/TimelineController.cs85
-rw-r--r--BackEnd/Timeline/Controllers/TimelinePostController.cs19
-rw-r--r--BackEnd/Timeline/Controllers/TokenController.cs66
-rw-r--r--BackEnd/Timeline/Controllers/UserAvatarController.cs69
-rw-r--r--BackEnd/Timeline/Controllers/UserController.cs84
-rw-r--r--BackEnd/Timeline/ErrorCodes.cs48
-rw-r--r--BackEnd/Timeline/Filters/CatchEntityAlreadyExistExceptionFilter.cs28
-rw-r--r--BackEnd/Timeline/Filters/CatchEntityNotExistExceptionFilter.cs40
-rw-r--r--BackEnd/Timeline/Filters/CatchTimelineNotExistExceptionAttribute.cs33
-rw-r--r--BackEnd/Timeline/Filters/CatchTimelinePostDataNotExistExceptionAttribute.cs24
-rw-r--r--BackEnd/Timeline/Filters/CatchTimelinePostNotExistExceptionAttribute.cs24
-rw-r--r--BackEnd/Timeline/Filters/MaxContentLengthAttribute.cs26
-rw-r--r--BackEnd/Timeline/Filters/MaxContentLengthFilter.cs (renamed from BackEnd/Timeline/Filters/Header.cs)26
-rw-r--r--BackEnd/Timeline/Filters/Resource.Designer.cs (renamed from BackEnd/Timeline/Resources/Helper/DataCacheHelper.Designer.cs)26
-rw-r--r--BackEnd/Timeline/Filters/Resource.resx (renamed from BackEnd/Timeline/Resources/Helper/DataCacheHelper.resx)12
-rw-r--r--BackEnd/Timeline/GlobalSuppressions.cs6
-rw-r--r--BackEnd/Timeline/Helpers/Cache/DataCacheHelper.cs2
-rw-r--r--BackEnd/Timeline/Helpers/InvalidModelResponseFactory.cs2
-rw-r--r--BackEnd/Timeline/Helpers/LanguageHelper.cs12
-rw-r--r--BackEnd/Timeline/Helpers/Log.cs22
-rw-r--r--BackEnd/Timeline/Models/Http/CommonDataResponse.cs18
-rw-r--r--BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs54
-rw-r--r--BackEnd/Timeline/Models/Http/CommonPutResponse.cs43
-rw-r--r--BackEnd/Timeline/Models/Http/CommonResponse.cs111
-rw-r--r--BackEnd/Timeline/Models/Http/ErrorResponse.cs260
-rw-r--r--BackEnd/Timeline/Models/Http/Resource.Designer.cs (renamed from BackEnd/Timeline/Resources/Models/Http/Common.Designer.cs)8
-rw-r--r--BackEnd/Timeline/Models/Http/Resource.resx (renamed from BackEnd/Timeline/Resources/Models/Http/Common.resx)0
-rw-r--r--BackEnd/Timeline/Models/Validation/NameValidator.cs9
-rw-r--r--BackEnd/Timeline/Models/Validation/NicknameValidator.cs3
-rw-r--r--BackEnd/Timeline/Models/Validation/Resource.Designer.cs (renamed from BackEnd/Timeline/Resources/Models/Validation/Validator.Designer.cs)83
-rw-r--r--BackEnd/Timeline/Models/Validation/Resource.resx (renamed from BackEnd/Timeline/Resources/Models/Validation/Validator.resx)35
-rw-r--r--BackEnd/Timeline/Models/Validation/Validator.cs11
-rw-r--r--BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.Designer.cs81
-rw-r--r--BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.resx126
-rw-r--r--BackEnd/Timeline/Resources/Controllers/TimelineController.Designer.cs81
-rw-r--r--BackEnd/Timeline/Resources/Controllers/TimelineController.resx126
-rw-r--r--BackEnd/Timeline/Resources/Controllers/TokenController.Designer.cs153
-rw-r--r--BackEnd/Timeline/Resources/Controllers/TokenController.resx150
-rw-r--r--BackEnd/Timeline/Resources/Controllers/UserAvatarController.Designer.cs144
-rw-r--r--BackEnd/Timeline/Resources/Controllers/UserAvatarController.resx147
-rw-r--r--BackEnd/Timeline/Resources/Controllers/UserController.Designer.cs117
-rw-r--r--BackEnd/Timeline/Resources/Controllers/UserController.resx138
-rw-r--r--BackEnd/Timeline/Resources/Entities.resx123
-rw-r--r--BackEnd/Timeline/Resources/Filters.Designer.cs90
-rw-r--r--BackEnd/Timeline/Resources/Filters.resx129
-rw-r--r--BackEnd/Timeline/Resources/Messages.Designer.cs414
-rw-r--r--BackEnd/Timeline/Resources/Messages.resx237
-rw-r--r--BackEnd/Timeline/Resources/Models/Http/Exception.Designer.cs81
-rw-r--r--BackEnd/Timeline/Resources/Models/Http/Exception.resx126
-rw-r--r--BackEnd/Timeline/Resources/Models/Validation/NameValidator.Designer.cs99
-rw-r--r--BackEnd/Timeline/Resources/Models/Validation/NameValidator.resx132
-rw-r--r--BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.Designer.cs72
-rw-r--r--BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.resx123
-rw-r--r--BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs144
-rw-r--r--BackEnd/Timeline/Resources/Services/TimelineService.resx147
-rw-r--r--BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs72
-rw-r--r--BackEnd/Timeline/Routes/Resource.Designer.cs (renamed from BackEnd/Timeline/Resources/Entities.Designer.cs)14
-rw-r--r--BackEnd/Timeline/Routes/Resource.resx (renamed from BackEnd/Timeline/Resources/Services/UserTokenService.resx)4
-rw-r--r--BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs4
-rw-r--r--BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs111
-rw-r--r--BackEnd/Timeline/Services/Api/HighlightTimelineService.cs98
-rw-r--r--BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs62
-rw-r--r--BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs59
-rw-r--r--BackEnd/Timeline/Services/Api/ISearchService.cs33
-rw-r--r--BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs15
-rw-r--r--BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs15
-rw-r--r--BackEnd/Timeline/Services/Api/SearchResult.cs11
-rw-r--r--BackEnd/Timeline/Services/Api/SearchResultItem.cs18
-rw-r--r--BackEnd/Timeline/Services/Api/SearchService.cs55
-rw-r--r--BackEnd/Timeline/Services/EntityAlreadyExistException.cs21
-rw-r--r--BackEnd/Timeline/Services/EntityException.cs31
-rw-r--r--BackEnd/Timeline/Services/EntityNames.cs2
-rw-r--r--BackEnd/Timeline/Services/EntityNotExistException.cs16
-rw-r--r--BackEnd/Timeline/Services/EntityType.cs34
-rw-r--r--BackEnd/Timeline/Services/EntityTypes.cs11
-rw-r--r--BackEnd/Timeline/Services/Mapper/TimelineMapper.cs4
-rw-r--r--BackEnd/Timeline/Services/Timeline/BasicTimelineService.cs22
-rw-r--r--BackEnd/Timeline/Services/Timeline/BasicTimelineServiceExtensions.cs17
-rw-r--r--BackEnd/Timeline/Services/Timeline/IBasicTimelineService.cs8
-rw-r--r--BackEnd/Timeline/Services/Timeline/ITimelinePostService.cs37
-rw-r--r--BackEnd/Timeline/Services/Timeline/ITimelineService.cs23
-rw-r--r--BackEnd/Timeline/Services/Timeline/Resource.Designer.cs135
-rw-r--r--BackEnd/Timeline/Services/Timeline/Resource.resx45
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelineAlreadyExistException.cs24
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelineNotExistException.cs27
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelinePostDataNotExistException.cs25
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelinePostNotExistException.cs36
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelinePostService.cs99
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelineService.cs48
-rw-r--r--BackEnd/Timeline/Services/Token/IUserTokenManager.cs2
-rw-r--r--BackEnd/Timeline/Services/Token/Resource.Designer.cs9
-rw-r--r--BackEnd/Timeline/Services/Token/Resource.resx3
-rw-r--r--BackEnd/Timeline/Services/Token/UserTokenHandler.cs2
-rw-r--r--BackEnd/Timeline/Services/Token/UserTokenManager.cs2
-rw-r--r--BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs8
-rw-r--r--BackEnd/Timeline/Services/User/BasicUserService.cs28
-rw-r--r--BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs17
-rw-r--r--BackEnd/Timeline/Services/User/IBasicUserService.cs4
-rw-r--r--BackEnd/Timeline/Services/User/IUserPermissionService.cs6
-rw-r--r--BackEnd/Timeline/Services/User/IUserService.cs8
-rw-r--r--BackEnd/Timeline/Services/User/UserAlreadyExistException.cs24
-rw-r--r--BackEnd/Timeline/Services/User/UserNotExistException.cs37
-rw-r--r--BackEnd/Timeline/Services/User/UserPermissionService.cs10
-rw-r--r--BackEnd/Timeline/Services/User/UserService.cs19
-rw-r--r--BackEnd/Timeline/Startup.cs9
-rw-r--r--BackEnd/Timeline/Swagger/DocumentDescriptionDocumentProcessor.cs1
-rw-r--r--BackEnd/Timeline/Timeline.csproj161
-rw-r--r--FrontEnd/package.json4
125 files changed, 1509 insertions, 4923 deletions
diff --git a/BackEnd/Timeline.Tests/ErrorCodeTest.cs b/BackEnd/Timeline.Tests/ErrorCodeTest.cs
index 94e2a488..0b6d8ed8 100644
--- a/BackEnd/Timeline.Tests/ErrorCodeTest.cs
+++ b/BackEnd/Timeline.Tests/ErrorCodeTest.cs
@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using Timeline.Models.Http;
using Xunit;
using Xunit.Abstractions;
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/CacheTestHelper.cs b/BackEnd/Timeline.Tests/IntegratedTests/CacheTestHelper.cs
index 8308eca8..73210320 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/CacheTestHelper.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/CacheTestHelper.cs
@@ -4,7 +4,6 @@ using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
-using Timeline.Models.Http;
namespace Timeline.Tests.IntegratedTests
{
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs
index e2ce8875..0e7bb735 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs
@@ -188,7 +188,7 @@ namespace Timeline.Tests.IntegratedTests
body.Should().BeEquivalentTo(await client.GetTimelineAsync("aaa"));
}
- await client.TestPostAssertErrorAsync("timelines", new HttpTimelineCreateRequest { Name = "aaa" }, errorCode: ErrorCodes.TimelineController.NameConflict);
+ await client.TestPostAssertErrorAsync("timelines", new HttpTimelineCreateRequest { Name = "aaa" }, errorCode: ErrorCodes.Conflict.Timeline);
}
}
@@ -210,7 +210,7 @@ namespace Timeline.Tests.IntegratedTests
await client.TestDeleteAssertInvalidModelAsync("timelines/!!!");
await client.TestDeleteAsync("timelines/t2");
- await client.TestDeleteAssertErrorAsync("timelines/t2");
+ await client.TestDeleteAsync("timelines/t2");
}
{
@@ -218,7 +218,7 @@ namespace Timeline.Tests.IntegratedTests
await client.TestDeleteAssertInvalidModelAsync("timelines/!!!");
await client.TestDeleteAsync("timelines/t1");
- await client.TestDeleteAssertErrorAsync("timelines/t1");
+ await client.TestDeleteAsync("timelines/t1");
}
}
@@ -294,13 +294,13 @@ namespace Timeline.Tests.IntegratedTests
}
await AssertEmptyMembers();
- await client.TestPutAssertErrorAsync($"timelines/{timelineName}/members/usernotexist", errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestPutAssertErrorAsync($"timelines/{timelineName}/members/usernotexist", errorCode: ErrorCodes.NotExist.User);
await AssertEmptyMembers();
await client.PutTimelineMemberAsync(timelineName, "user2");
await AssertMembers(new List<HttpUser> { await client.GetUserAsync("user2") });
await client.DeleteTimelineMemberAsync(timelineName, "user2", true);
await AssertEmptyMembers();
- await client.TestDeleteAssertErrorAsync($"timelines/{timelineName}/members/usernotexist", errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestDeleteAsync($"timelines/{timelineName}/members/usernotexist", false);
await AssertEmptyMembers();
}
@@ -377,7 +377,7 @@ namespace Timeline.Tests.IntegratedTests
using (var client = await CreateClientAsUser())
{
await client.TestPatchAssertInvalidModelAsync("timelines/t1", new HttpTimelinePatchRequest { Name = "!!!" });
- await client.TestPatchAssertErrorAsync("timelines/t1", new HttpTimelinePatchRequest { Name = "t2" }, errorCode: ErrorCodes.TimelineController.NameConflict);
+ await client.TestPatchAssertErrorAsync("timelines/t1", new HttpTimelinePatchRequest { Name = "t2" }, errorCode: ErrorCodes.Conflict.Timeline);
await client.TestPatchAsync("timelines/t1", new HttpTimelinePatchRequest { Name = "newt" });
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TokenTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TokenTest.cs
index 08857dc1..ac96ef9d 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/TokenTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/TokenTest.cs
@@ -53,7 +53,7 @@ namespace Timeline.Tests.IntegratedTests
using var client = await CreateDefaultClient();
await client.TestPostAssertErrorAsync(CreateTokenUrl,
new HttpCreateTokenRequest { Username = username, Password = password },
- errorCode: ErrorCodes.TokenController.Create_BadCredential);
+ errorCode: ErrorCodes.TokenController.CreateBadCredential);
}
[Fact]
@@ -79,7 +79,7 @@ namespace Timeline.Tests.IntegratedTests
using var client = await CreateDefaultClient();
await client.TestPostAssertErrorAsync(VerifyTokenUrl,
new HttpVerifyTokenRequest { Token = "bad token hahaha" },
- errorCode: ErrorCodes.TokenController.Verify_BadFormat);
+ errorCode: ErrorCodes.TokenController.VerifyBadFormat);
}
[Fact]
@@ -98,7 +98,7 @@ namespace Timeline.Tests.IntegratedTests
await client.TestPostAssertErrorAsync(VerifyTokenUrl,
new HttpVerifyTokenRequest { Token = token },
- errorCode: ErrorCodes.TokenController.Verify_OldVersion);
+ errorCode: ErrorCodes.TokenController.VerifyOldVersion);
}
[Fact]
@@ -115,7 +115,7 @@ namespace Timeline.Tests.IntegratedTests
await client.TestPostAssertErrorAsync(VerifyTokenUrl,
new HttpVerifyTokenRequest { Token = token },
- errorCode: ErrorCodes.TokenController.Verify_UserNotExist);
+ errorCode: ErrorCodes.TokenController.VerifyUserNotExist);
}
//[Fact]
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs
index 4389c6b4..2b6981ae 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
-using Timeline.Models.Http;
using Xunit;
namespace Timeline.Tests.IntegratedTests
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/UserAvatarTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
index 708120b1..e8c42d58 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
@@ -12,7 +12,6 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Timeline.Models;
-using Timeline.Models.Http;
using Timeline.Tests.Helpers;
using Xunit;
@@ -30,7 +29,7 @@ namespace Timeline.Tests.IntegratedTests
using (var client = await CreateClientAsUser())
{
- await client.TestGetAssertNotFoundAsync("users/usernotexist/avatar", errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestGetAssertNotFoundAsync("users/usernotexist/avatar", errorCode: ErrorCodes.NotExist.User);
var env = TestApp.Host.Services.GetRequiredService<IWebHostEnvironment>();
var defaultAvatarData = await File.ReadAllBytesAsync(Path.Combine(env.ContentRootPath, "default-avatar.png"));
@@ -99,9 +98,9 @@ namespace Timeline.Tests.IntegratedTests
}
{
- await client.TestPutByteArrayAssertErrorAsync("users/user1/avatar", new[] { (byte)0x00 }, "image/png", errorCode: ErrorCodes.UserAvatar.BadFormat_CantDecode);
- await client.TestPutByteArrayAssertErrorAsync("users/user1/avatar", mockAvatar.Data, "image/jpeg", errorCode: ErrorCodes.UserAvatar.BadFormat_UnmatchedFormat);
- await client.TestPutByteArrayAssertErrorAsync("users/user1/avatar", ImageHelper.CreatePngWithSize(100, 200), "image/png", errorCode: ErrorCodes.UserAvatar.BadFormat_BadSize);
+ await client.TestPutByteArrayAssertErrorAsync("users/user1/avatar", new[] { (byte)0x00 }, "image/png", errorCode: ErrorCodes.Image.CantDecode);
+ await client.TestPutByteArrayAssertErrorAsync("users/user1/avatar", mockAvatar.Data, "image/jpeg", errorCode: ErrorCodes.Image.UnmatchedFormat);
+ await client.TestPutByteArrayAssertErrorAsync("users/user1/avatar", ImageHelper.CreatePngWithSize(100, 200), "image/png", errorCode: ErrorCodes.Image.BadSize);
}
{
@@ -138,8 +137,8 @@ namespace Timeline.Tests.IntegratedTests
{
await client.TestPutByteArrayAsync("users/user1/avatar", mockAvatar.Data, mockAvatar.ContentType);
await client.TestDeleteAsync("users/user1/avatar");
- await client.TestPutByteArrayAssertErrorAsync("users/usernotexist/avatar", new[] { (byte)0x00 }, "image/png", errorCode: ErrorCodes.UserCommon.NotExist);
- await client.TestDeleteAssertErrorAsync("users/usernotexist/avatar", errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestPutByteArrayAssertErrorAsync("users/usernotexist/avatar", new[] { (byte)0x00 }, "image/png", errorCode: ErrorCodes.NotExist.User);
+ await client.TestDeleteAsync("users/usernotexist/avatar");
}
// bad username check
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/UserPermissionTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/UserPermissionTest.cs
index 32e25aaa..bdb376de 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/UserPermissionTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/UserPermissionTest.cs
@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Timeline.Models.Http;
using Timeline.Services.User;
using Xunit;
@@ -41,10 +40,10 @@ namespace Timeline.Tests.IntegratedTests
using var client = await CreateClientAsAdministrator();
await client.TestPutAssertErrorAsync($"users/admin/permissions/{permission}",
- errorCode: ErrorCodes.UserController.ChangePermission_RootUser);
+ errorCode: ErrorCodes.UserController.InvalidOperationOnRootUser);
await client.TestDeleteAssertErrorAsync($"users/admin/permissions/{permission}",
- errorCode: ErrorCodes.UserController.ChangePermission_RootUser);
+ errorCode: ErrorCodes.UserController.InvalidOperationOnRootUser);
}
[Theory]
@@ -190,8 +189,8 @@ namespace Timeline.Tests.IntegratedTests
const string url = "users/user123/permissions/UserManagement";
- await client.TestPutAssertNotFoundAsync(url, errorCode: ErrorCodes.UserCommon.NotExist);
- await client.TestDeleteAssertNotFoundAsync(url, errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestPutAssertErrorAsync(url, errorCode: ErrorCodes.NotExist.User);
+ await client.TestDeleteAsync(url);
}
}
}
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/UserTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/UserTest.cs
index c728a280..d34bcaf9 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests/UserTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests/UserTest.cs
@@ -47,7 +47,7 @@ namespace Timeline.Tests.IntegratedTests
public async Task Get_404()
{
using var client = await CreateDefaultClient();
- await client.TestGetAssertNotFoundAsync("users/usernotexist", errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestGetAssertNotFoundAsync("users/usernotexist", errorCode: ErrorCodes.NotExist.User);
}
[Fact]
@@ -104,7 +104,7 @@ namespace Timeline.Tests.IntegratedTests
public async Task Patch_NotExist()
{
using var client = await CreateClientAsAdministrator();
- await client.TestPatchAssertNotFoundAsync("users/usernotexist", new HttpUserPatchRequest { }, errorCode: ErrorCodes.UserCommon.NotExist);
+ await client.TestPatchAssertErrorAsync("users/usernotexist", new HttpUserPatchRequest { }, errorCode: ErrorCodes.NotExist.User);
}
[Fact]
@@ -133,7 +133,7 @@ namespace Timeline.Tests.IntegratedTests
public async Task Patch_UsernameConflict()
{
using var client = await CreateClientAsAdministrator();
- await client.TestPatchAssertErrorAsync("users/user1", new HttpUserPatchRequest { Username = "admin" }, errorCode: ErrorCodes.UserController.UsernameConflict);
+ await client.TestPatchAssertErrorAsync("users/user1", new HttpUserPatchRequest { Username = "admin" }, errorCode: ErrorCodes.Conflict.User);
}
[Fact]
@@ -183,7 +183,7 @@ namespace Timeline.Tests.IntegratedTests
public async Task DeleteRootUser_Should_Error()
{
using var client = await CreateClientAsAdministrator();
- await client.TestDeleteAssertErrorAsync("users/admin", errorCode: ErrorCodes.UserController.Delete_RootUser);
+ await client.TestDeleteAssertErrorAsync("users/admin", errorCode: ErrorCodes.UserController.InvalidOperationOnRootUser);
}
[Fact]
@@ -255,7 +255,7 @@ namespace Timeline.Tests.IntegratedTests
{
Username = "user1",
Password = "bbb",
- }, errorCode: ErrorCodes.UserController.UsernameConflict);
+ }, errorCode: ErrorCodes.Conflict.User);
}
[Fact]
@@ -310,7 +310,7 @@ namespace Timeline.Tests.IntegratedTests
public async Task Op_ChangePassword_BadOldPassword()
{
using var client = await CreateClientAsUser();
- await client.TestPostAssertErrorAsync(changePasswordUrl, new HttpChangePasswordRequest { OldPassword = "???", NewPassword = "???" }, errorCode: ErrorCodes.UserController.ChangePassword_BadOldPassword);
+ await client.TestPostAssertErrorAsync(changePasswordUrl, new HttpChangePasswordRequest { OldPassword = "???", NewPassword = "???" }, errorCode: ErrorCodes.UserController.ChangePasswordBadOldPassword);
}
[Fact]
diff --git a/BackEnd/Timeline.Tests/Services/SearchServiceTest.cs b/BackEnd/Timeline.Tests/Services/SearchServiceTest.cs
index 1c96eb34..6e3c0f40 100644
--- a/BackEnd/Timeline.Tests/Services/SearchServiceTest.cs
+++ b/BackEnd/Timeline.Tests/Services/SearchServiceTest.cs
@@ -24,7 +24,7 @@ namespace Timeline.Tests.Services
await TimelineService.ChangePropertyAsync(t2.Id, new TimelineChangePropertyParams { Title = "hahaha" });
await TimelineService.CreateTimelineAsync("bbbbbb", UserId);
- var searchResult = await _service.SearchTimeline("hah");
+ var searchResult = await _service.SearchTimelineAsync("hah");
searchResult.Items.Should().HaveCount(2);
searchResult.Items[0].Item.Name.Should().Be("hahaha");
searchResult.Items[0].Score.Should().Be(2);
@@ -40,7 +40,7 @@ namespace Timeline.Tests.Services
await UserService.ModifyUserAsync(u2.Id, new ModifyUserParams { Nickname = "hahaha" });
await UserService.CreateUserAsync(new CreateUserParams("bbbbbb", "p"));
- var searchResult = await _service.SearchUser("hah");
+ var searchResult = await _service.SearchUserAsync("hah");
searchResult.Items.Should().HaveCount(2);
searchResult.Items[0].Item.Username.Should().Be("hahaha");
searchResult.Items[0].Score.Should().Be(2);
diff --git a/BackEnd/Timeline.Tests/Services/UserPermissionServiceTest.cs b/BackEnd/Timeline.Tests/Services/UserPermissionServiceTest.cs
index aa92ff73..7923e9db 100644
--- a/BackEnd/Timeline.Tests/Services/UserPermissionServiceTest.cs
+++ b/BackEnd/Timeline.Tests/Services/UserPermissionServiceTest.cs
@@ -1,6 +1,7 @@
using FluentAssertions;
using System;
using System.Threading.Tasks;
+using Timeline.Services;
using Timeline.Services.User;
using Xunit;
@@ -17,7 +18,7 @@ namespace Timeline.Tests.Services
protected override void OnInitialize()
{
- _service = new UserPermissionService(Database);
+ _service = new UserPermissionService(Database, UserService);
}
[Fact]
@@ -37,7 +38,7 @@ namespace Timeline.Tests.Services
[Fact]
public async Task GetPermissionsOfInexistentUserShouldThrow()
{
- await _service.Awaiting(s => s.GetPermissionsOfUserAsync(10)).Should().ThrowAsync<UserNotExistException>();
+ await _service.Awaiting(s => s.GetPermissionsOfUserAsync(10)).Should().ThrowAsync<EntityNotExistException>();
}
[Fact]
@@ -91,13 +92,13 @@ namespace Timeline.Tests.Services
[Fact]
public async Task AddPermissionToInexistentUserShouldThrown()
{
- await _service.Awaiting(s => s.AddPermissionToUserAsync(10, UserPermission.HighlightTimelineManagement)).Should().ThrowAsync<UserNotExistException>();
+ await _service.Awaiting(s => s.AddPermissionToUserAsync(10, UserPermission.HighlightTimelineManagement)).Should().ThrowAsync<EntityNotExistException>();
}
[Fact]
public async Task RemovePermissionFromInexistentUserShouldThrown()
{
- await _service.Awaiting(s => s.RemovePermissionFromUserAsync(10, UserPermission.HighlightTimelineManagement)).Should().ThrowAsync<UserNotExistException>();
+ await _service.Awaiting(s => s.RemovePermissionFromUserAsync(10, UserPermission.HighlightTimelineManagement)).Should().ThrowAsync<EntityNotExistException>();
}
[Fact]
diff --git a/BackEnd/Timeline.Tests/UsernameValidatorUnitTest.cs b/BackEnd/Timeline.Tests/UsernameValidatorUnitTest.cs
index 7022b311..9e845641 100644
--- a/BackEnd/Timeline.Tests/UsernameValidatorUnitTest.cs
+++ b/BackEnd/Timeline.Tests/UsernameValidatorUnitTest.cs
@@ -41,8 +41,7 @@ namespace Timeline.Tests
[InlineData("ab c!")] // This is a chinese ! .
public void BadCharactor(string value)
{
- FailAndMessage(value).Should().ContainEquivalentOf("invalid")
- .And.ContainEquivalentOf("character");
+ FailAndMessage(value).Should().ContainEquivalentOf("only consists of");
}
[Fact]
diff --git a/BackEnd/Timeline/Controllers/ActionResultControllerExtensions.cs b/BackEnd/Timeline/Controllers/ActionResultControllerExtensions.cs
new file mode 100644
index 00000000..a3da73fa
--- /dev/null
+++ b/BackEnd/Timeline/Controllers/ActionResultControllerExtensions.cs
@@ -0,0 +1,24 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Timeline.Models.Http;
+
+namespace Timeline.Controllers
+{
+ public static class ActionResultControllerExtensions
+ {
+ public static ObjectResult StatusCodeWithCommonResponse(this ControllerBase controller, int statusCode, int code, string message)
+ {
+ return controller.StatusCode(statusCode, new CommonResponse(code, message));
+ }
+
+ public static ObjectResult ForbidWithMessage(this ControllerBase controller, string? message = null)
+ {
+ return controller.StatusCode(StatusCodes.Status403Forbidden, new CommonResponse(ErrorCodes.Common.Forbid, message ?? Resource.MessageForbid));
+ }
+
+ public static BadRequestObjectResult BadRequestWithCommonResponse(this ControllerBase controller, int code, string message)
+ {
+ return controller.BadRequest(new CommonResponse(code, message));
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
index e7ffa5c5..94cb0f3e 100644
--- a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
+++ b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs
@@ -44,7 +44,7 @@ namespace Timeline.Controllers
[ProducesResponseType(401)]
public async Task<ActionResult<List<HttpTimeline>>> List()
{
- var ids = await _service.GetBookmarks(this.GetUserId());
+ var ids = await _service.GetBookmarksAsync(this.GetUserId());
var timelines = await _timelineService.GetTimelineList(ids);
return await Map(timelines);
}
@@ -60,16 +60,9 @@ namespace Timeline.Controllers
[ProducesResponseType(401)]
public async Task<ActionResult<CommonPutResponse>> Put([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var create = await _service.AddBookmark(this.GetUserId(), timelineId);
- return CommonPutResponse.Create(create);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var create = await _service.AddBookmarkAsync(this.GetUserId(), timelineId);
+ return CommonPutResponse.Create(create);
}
/// <summary>
@@ -83,16 +76,9 @@ namespace Timeline.Controllers
[ProducesResponseType(401)]
public async Task<ActionResult<CommonDeleteResponse>> Delete([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var delete = await _service.RemoveBookmark(this.GetUserId(), timelineId);
- return CommonDeleteResponse.Create(delete);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var delete = await _service.RemoveBookmarkAsync(this.GetUserId(), timelineId);
+ return CommonDeleteResponse.Create(delete);
}
/// <summary>
@@ -109,13 +95,9 @@ namespace Timeline.Controllers
try
{
var timelineId = await _timelineService.GetTimelineIdByNameAsync(request.Timeline);
- await _service.MoveBookmark(this.GetUserId(), timelineId, request.NewPosition!.Value);
+ await _service.MoveBookmarkAsync(this.GetUserId(), timelineId, request.NewPosition!.Value);
return Ok();
}
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
catch (InvalidBookmarkException)
{
return BadRequest(new CommonResponse(ErrorCodes.BookmarkTimelineController.NonBookmark, "You can't move a non-bookmark timeline."));
diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
index 4e739056..e73bc7a9 100644
--- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
+++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs
@@ -43,7 +43,7 @@ namespace Timeline.Controllers
[ProducesResponseType(200)]
public async Task<ActionResult<List<HttpTimeline>>> List()
{
- var ids = await _service.GetHighlightTimelines();
+ var ids = await _service.GetHighlightTimelinesAsync();
var timelines = await _timelineService.GetTimelineList(ids);
return await Map(timelines);
}
@@ -60,16 +60,9 @@ namespace Timeline.Controllers
[ProducesResponseType(403)]
public async Task<ActionResult<CommonPutResponse>> Put([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var create = await _service.AddHighlightTimeline(timelineId, this.GetUserId());
- return CommonPutResponse.Create(create);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var create = await _service.AddHighlightTimelineAsync(timelineId, this.GetUserId());
+ return CommonPutResponse.Create(create);
}
/// <summary>
@@ -84,16 +77,9 @@ namespace Timeline.Controllers
[ProducesResponseType(403)]
public async Task<ActionResult<CommonDeleteResponse>> Delete([GeneralTimelineName] string timeline)
{
- try
- {
- var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
- var delete = await _service.RemoveHighlightTimeline(timelineId, this.GetUserId());
- return CommonDeleteResponse.Create(delete);
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ var timelineId = await _timelineService.GetTimelineIdByNameAsync(timeline);
+ var delete = await _service.RemoveHighlightTimelineAsync(timelineId, this.GetUserId());
+ return CommonDeleteResponse.Create(delete);
}
/// <summary>
@@ -110,13 +96,9 @@ namespace Timeline.Controllers
try
{
var timelineId = await _timelineService.GetTimelineIdByNameAsync(body.Timeline);
- await _service.MoveHighlightTimeline(timelineId, body.NewPosition!.Value);
+ await _service.MoveHighlightTimelineAsync(timelineId, body.NewPosition!.Value);
return Ok();
}
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
catch (InvalidHighlightTimelineException)
{
return BadRequest(new CommonResponse(ErrorCodes.HighlightTimelineController.NonHighlight, "Can't move a non-highlight timeline."));
diff --git a/BackEnd/Timeline/Controllers/Resource.Designer.cs b/BackEnd/Timeline/Controllers/Resource.Designer.cs
index 6279a055..f3d7264a 100644
--- a/BackEnd/Timeline/Controllers/Resource.Designer.cs
+++ b/BackEnd/Timeline/Controllers/Resource.Designer.cs
@@ -68,5 +68,158 @@ namespace Timeline.Controllers {
return ResourceManager.GetString("ExceptionNoUserId", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to You have no permission to access this..
+ /// </summary>
+ internal static string MessageForbid {
+ get {
+ return ResourceManager.GetString("MessageForbid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You can&apos;t do this unless you are administrator..
+ /// </summary>
+ internal static string MessageForbidNotAdministrator {
+ get {
+ return ResourceManager.GetString("MessageForbidNotAdministrator", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You can&apos;t do this unless you are administrator or resource owner..
+ /// </summary>
+ internal static string MessageForbidNotAdministratorOrOwner {
+ get {
+ return ResourceManager.GetString("MessageForbidNotAdministratorOrOwner", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Image is not a square..
+ /// </summary>
+ internal static string MessageImageBadSize {
+ get {
+ return ResourceManager.GetString("MessageImageBadSize", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Image decode failed..
+ /// </summary>
+ internal static string MessageImageDecodeFailed {
+ get {
+ return ResourceManager.GetString("MessageImageDecodeFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Specified image format does not match the actual one ..
+ /// </summary>
+ internal static string MessageImageFormatUnmatch {
+ get {
+ return ResourceManager.GetString("MessageImageFormatUnmatch", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unknown error happened to image..
+ /// </summary>
+ internal static string MessageImageUnknownError {
+ get {
+ return ResourceManager.GetString("MessageImageUnknownError", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You can&apos;t do this because it is the root user..
+ /// </summary>
+ internal static string MessageInvalidOperationOnRootUser {
+ get {
+ return ResourceManager.GetString("MessageInvalidOperationOnRootUser", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The old password is wrong..
+ /// </summary>
+ internal static string MessageOldPasswordWrong {
+ get {
+ return ResourceManager.GetString("MessageOldPasswordWrong", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The user specified by query param &quot;relate&quot; does not exist..
+ /// </summary>
+ internal static string MessageTimelineListQueryRelateNotExist {
+ get {
+ return ResourceManager.GetString("MessageTimelineListQueryRelateNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to &apos;{0}&apos; is an unkown visibility in the query parameter &apos;visibility&apos;. .
+ /// </summary>
+ internal static string MessageTimelineListQueryVisibilityUnknown {
+ get {
+ return ResourceManager.GetString("MessageTimelineListQueryVisibilityUnknown", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Username or password is invalid..
+ /// </summary>
+ internal static string MessageTokenCreateBadCredential {
+ get {
+ return ResourceManager.GetString("MessageTokenCreateBadCredential", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The token is of bad format. It might not be created by the server..
+ /// </summary>
+ internal static string MessageTokenVerifyBadFormat {
+ get {
+ return ResourceManager.GetString("MessageTokenVerifyBadFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Token has an old version. User might have update some info..
+ /// </summary>
+ internal static string MessageTokenVerifyOldVersion {
+ get {
+ return ResourceManager.GetString("MessageTokenVerifyOldVersion", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The token is expired..
+ /// </summary>
+ internal static string MessageTokenVerifyTimeExpired {
+ get {
+ return ResourceManager.GetString("MessageTokenVerifyTimeExpired", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to User does not exist. Administrator might have deleted this user..
+ /// </summary>
+ internal static string MessageTokenVerifyUserNotExist {
+ get {
+ return ResourceManager.GetString("MessageTokenVerifyUserNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A user with given username already exists..
+ /// </summary>
+ internal static string MessageUsernameConflict {
+ get {
+ return ResourceManager.GetString("MessageUsernameConflict", resourceCulture);
+ }
+ }
}
}
diff --git a/BackEnd/Timeline/Controllers/Resource.resx b/BackEnd/Timeline/Controllers/Resource.resx
index ec45a5c9..90c6bdd6 100644
--- a/BackEnd/Timeline/Controllers/Resource.resx
+++ b/BackEnd/Timeline/Controllers/Resource.resx
@@ -120,4 +120,55 @@
<data name="ExceptionNoUserId" xml:space="preserve">
<value>Can't get user id.</value>
</data>
+ <data name="MessageForbid" xml:space="preserve">
+ <value>You have no permission to access this.</value>
+ </data>
+ <data name="MessageForbidNotAdministrator" xml:space="preserve">
+ <value>You can't do this unless you are administrator.</value>
+ </data>
+ <data name="MessageForbidNotAdministratorOrOwner" xml:space="preserve">
+ <value>You can't do this unless you are administrator or resource owner.</value>
+ </data>
+ <data name="MessageImageBadSize" xml:space="preserve">
+ <value>Image is not a square.</value>
+ </data>
+ <data name="MessageImageDecodeFailed" xml:space="preserve">
+ <value>Image decode failed.</value>
+ </data>
+ <data name="MessageImageFormatUnmatch" xml:space="preserve">
+ <value>Specified image format does not match the actual one .</value>
+ </data>
+ <data name="MessageImageUnknownError" xml:space="preserve">
+ <value>Unknown error happened to image.</value>
+ </data>
+ <data name="MessageInvalidOperationOnRootUser" xml:space="preserve">
+ <value>You can't do this because it is the root user.</value>
+ </data>
+ <data name="MessageOldPasswordWrong" xml:space="preserve">
+ <value>The old password is wrong.</value>
+ </data>
+ <data name="MessageTimelineListQueryRelateNotExist" xml:space="preserve">
+ <value>The user specified by query param "relate" does not exist.</value>
+ </data>
+ <data name="MessageTimelineListQueryVisibilityUnknown" xml:space="preserve">
+ <value>'{0}' is an unkown visibility in the query parameter 'visibility'. </value>
+ </data>
+ <data name="MessageTokenCreateBadCredential" xml:space="preserve">
+ <value>Username or password is invalid.</value>
+ </data>
+ <data name="MessageTokenVerifyBadFormat" xml:space="preserve">
+ <value>The token is of bad format. It might not be created by the server.</value>
+ </data>
+ <data name="MessageTokenVerifyOldVersion" xml:space="preserve">
+ <value>Token has an old version. User might have update some info.</value>
+ </data>
+ <data name="MessageTokenVerifyTimeExpired" xml:space="preserve">
+ <value>The token is expired.</value>
+ </data>
+ <data name="MessageTokenVerifyUserNotExist" xml:space="preserve">
+ <value>User does not exist. Administrator might have deleted this user.</value>
+ </data>
+ <data name="MessageUsernameConflict" xml:space="preserve">
+ <value>A user with given username already exists.</value>
+ </data>
</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Controllers/SearchController.cs b/BackEnd/Timeline/Controllers/SearchController.cs
index 76f3d8f2..cd085e5b 100644
--- a/BackEnd/Timeline/Controllers/SearchController.cs
+++ b/BackEnd/Timeline/Controllers/SearchController.cs
@@ -42,7 +42,7 @@ namespace Timeline.Controllers
[ProducesResponseType(400)]
public async Task<ActionResult<List<HttpTimeline>>> TimelineSearch([FromQuery(Name = "q"), Required(AllowEmptyStrings = false)] string query)
{
- var searchResult = await _service.SearchTimeline(query);
+ var searchResult = await _service.SearchTimelineAsync(query);
var timelines = searchResult.Items.Select(i => i.Item).ToList();
return await Map(timelines);
}
@@ -57,7 +57,7 @@ namespace Timeline.Controllers
[ProducesResponseType(400)]
public async Task<ActionResult<List<HttpUser>>> UserSearch([FromQuery(Name = "q"), Required(AllowEmptyStrings = false)] string query)
{
- var searchResult = await _service.SearchUser(query);
+ var searchResult = await _service.SearchUserAsync(query);
var users = searchResult.Items.Select(i => i.Item).ToList();
return await _mapper.MapListAsync<HttpUser>(users, Url, User);
}
diff --git a/BackEnd/Timeline/Controllers/TimelineController.cs b/BackEnd/Timeline/Controllers/TimelineController.cs
index 497d7893..f04982dc 100644
--- a/BackEnd/Timeline/Controllers/TimelineController.cs
+++ b/BackEnd/Timeline/Controllers/TimelineController.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Entities;
-using Timeline.Filters;
using Timeline.Models;
using Timeline.Models.Http;
using Timeline.Models.Validation;
@@ -21,7 +20,6 @@ namespace Timeline.Controllers
/// </summary>
[ApiController]
[Route("timelines")]
- [CatchTimelineNotExistException]
[ProducesErrorResponseType(typeof(CommonResponse))]
public class TimelineController : Controller
{
@@ -29,9 +27,6 @@ namespace Timeline.Controllers
private readonly ITimelineService _service;
private readonly IGenericMapper _mapper;
- /// <summary>
- ///
- /// </summary>
public TimelineController(IUserService userService, ITimelineService service, IGenericMapper mapper)
{
_userService = userService;
@@ -87,7 +82,7 @@ namespace Timeline.Controllers
}
else
{
- return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(Resources.Messages.TimelineController_QueryVisibilityUnknown, item));
+ return this.BadRequestWithCommonResponse(ErrorCodes.Common.InvalidModel, string.Format(Resource.MessageTimelineListQueryVisibilityUnknown, visibility));
}
}
}
@@ -103,9 +98,9 @@ namespace Timeline.Controllers
relationship = new TimelineUserRelationship(relationType, relatedUserId);
}
- catch (UserNotExistException)
+ catch (EntityNotExistException)
{
- return BadRequest(ErrorResponse.TimelineController.QueryRelateNotExist());
+ return this.BadRequestWithCommonResponse(ErrorCodes.TimelineController.QueryRelateNotExist, Resource.MessageTimelineListQueryRelateNotExist);
}
}
@@ -148,20 +143,13 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _service.HasManagePermissionAsync(timelineId, this.GetUserId()))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
- try
- {
- await _service.ChangePropertyAsync(timelineId, _mapper.AutoMapperMap<TimelineChangePropertyParams>(body));
- var t = await _service.GetTimelineAsync(timelineId);
- var result = await Map(t);
- return result;
- }
- catch (EntityAlreadyExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NameConflict());
- }
+ await _service.ChangePropertyAsync(timelineId, _mapper.AutoMapperMap<TimelineChangePropertyParams>(body));
+ var t = await _service.GetTimelineAsync(timelineId);
+ var result = await Map(t);
+ return result;
}
/// <summary>
@@ -181,19 +169,12 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, this.GetUserId())))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
- try
- {
- var userId = await _userService.GetUserIdByUsernameAsync(member);
- var create = await _service.AddMemberAsync(timelineId, userId);
- return Ok(CommonPutResponse.Create(create));
- }
- catch (UserNotExistException)
- {
- return BadRequest(ErrorResponse.UserCommon.NotExist());
- }
+ var userId = await _userService.GetUserIdByUsernameAsync(member);
+ var create = await _service.AddMemberAsync(timelineId, userId);
+ return Ok(CommonPutResponse.Create(create));
}
/// <summary>
@@ -213,19 +194,13 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, this.GetUserId())))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
- try
- {
- var userId = await _userService.GetUserIdByUsernameAsync(member);
- var delete = await _service.RemoveMemberAsync(timelineId, userId);
- return Ok(CommonDeleteResponse.Create(delete));
- }
- catch (UserNotExistException)
- {
- return BadRequest(ErrorResponse.UserCommon.NotExist());
- }
+
+ var userId = await _userService.GetUserIdByUsernameAsync(member);
+ var delete = await _service.RemoveMemberAsync(timelineId, userId);
+ return Ok(CommonDeleteResponse.Create(delete));
}
/// <summary>
@@ -242,16 +217,9 @@ namespace Timeline.Controllers
{
var userId = this.GetUserId();
- try
- {
- var timeline = await _service.CreateTimelineAsync(body.Name, userId);
- var result = await Map(timeline);
- return result;
- }
- catch (EntityAlreadyExistException e) when (e.EntityName == EntityNames.Timeline)
- {
- return BadRequest(ErrorResponse.TimelineController.NameConflict());
- }
+ var timeline = await _service.CreateTimelineAsync(body.Name, userId);
+ var result = await Map(timeline);
+ return result;
}
/// <summary>
@@ -271,18 +239,11 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !(await _service.HasManagePermissionAsync(timelineId, this.GetUserId())))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
- try
- {
- await _service.DeleteTimelineAsync(timelineId);
- return Ok();
- }
- catch (TimelineNotExistException)
- {
- return BadRequest(ErrorResponse.TimelineController.NotExist());
- }
+ await _service.DeleteTimelineAsync(timelineId);
+ return Ok();
}
}
}
diff --git a/BackEnd/Timeline/Controllers/TimelinePostController.cs b/BackEnd/Timeline/Controllers/TimelinePostController.cs
index 2e1ed3a9..9f69b59b 100644
--- a/BackEnd/Timeline/Controllers/TimelinePostController.cs
+++ b/BackEnd/Timeline/Controllers/TimelinePostController.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Timeline.Entities;
-using Timeline.Filters;
using Timeline.Helpers.Cache;
using Timeline.Models;
using Timeline.Models.Http;
@@ -22,9 +21,6 @@ namespace Timeline.Controllers
/// </summary>
[ApiController]
[Route("timelines/{timeline}/posts")]
- [CatchTimelineNotExistException]
- [CatchTimelinePostNotExistException]
- [CatchTimelinePostDataNotExistException]
[ProducesErrorResponseType(typeof(CommonResponse))]
public class TimelinePostController : Controller
{
@@ -35,9 +31,6 @@ namespace Timeline.Controllers
private readonly MarkdownProcessor _markdownProcessor;
- /// <summary>
- ///
- /// </summary>
public TimelinePostController(ITimelineService timelineService, ITimelinePostService timelinePostService, IGenericMapper mapper, MarkdownProcessor markdownProcessor)
{
_timelineService = timelineService;
@@ -75,7 +68,7 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, this.GetOptionalUserId()))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
var posts = await _postService.GetPostsAsync(timelineId, modifiedSince, includeDeleted ?? false);
@@ -100,7 +93,7 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, this.GetOptionalUserId()))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
var post = await _postService.GetPostAsync(timelineId, postId);
@@ -146,7 +139,7 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, this.GetOptionalUserId()))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
return await DataCacheHelper.GenerateActionResult(this,
@@ -182,7 +175,7 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _timelineService.IsMemberOfAsync(timelineId, userId))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
var createRequest = new TimelinePostCreateRequest()
@@ -241,7 +234,7 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _postService.HasPostModifyPermissionAsync(timelineId, post, this.GetUserId(), true))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
var entity = await _postService.PatchPostAsync(timelineId, post, new TimelinePostPatchRequest { Time = body.Time, Color = body.Color });
@@ -268,7 +261,7 @@ namespace Timeline.Controllers
if (!UserHasAllTimelineManagementPermission && !await _postService.HasPostModifyPermissionAsync(timelineId, post, this.GetUserId(), true))
{
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage();
}
await _postService.DeletePostAsync(timelineId, post);
diff --git a/BackEnd/Timeline/Controllers/TokenController.cs b/BackEnd/Timeline/Controllers/TokenController.cs
index e728ae6d..080a4dc4 100644
--- a/BackEnd/Timeline/Controllers/TokenController.cs
+++ b/BackEnd/Timeline/Controllers/TokenController.cs
@@ -1,17 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
using System;
-using System.Globalization;
using System.Threading.Tasks;
-using Timeline.Helpers;
using Timeline.Models.Http;
using Timeline.Services;
using Timeline.Services.Mapper;
using Timeline.Services.Token;
using Timeline.Services.User;
-using static Timeline.Resources.Controllers.TokenController;
namespace Timeline.Controllers
{
@@ -24,15 +20,12 @@ namespace Timeline.Controllers
public class TokenController : Controller
{
private readonly IUserTokenManager _userTokenManager;
- private readonly ILogger<TokenController> _logger;
private readonly IGenericMapper _mapper;
private readonly IClock _clock;
- /// <summary></summary>
- public TokenController(IUserTokenManager userTokenManager, ILogger<TokenController> logger, IGenericMapper mapper, IClock clock)
+ public TokenController(IUserTokenManager userTokenManager, IGenericMapper mapper, IClock clock)
{
_userTokenManager = userTokenManager;
- _logger = logger;
_mapper = mapper;
_clock = clock;
}
@@ -47,43 +40,28 @@ namespace Timeline.Controllers
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult<HttpCreateTokenResponse>> Create([FromBody] HttpCreateTokenRequest request)
{
- void LogFailure(string reason, Exception? e = null)
- {
- _logger.LogInformation(e, Log.Format(LogCreateFailure,
- ("Reason", reason),
- ("Username", request.Username),
- ("Password", request.Password),
- ("Expire (in days)", request.Expire)
- ));
- }
try
{
DateTime? expireTime = null;
- if (request.Expire != null)
+ if (request.Expire is not null)
expireTime = _clock.GetCurrentTime().AddDays(request.Expire.Value);
var result = await _userTokenManager.CreateTokenAsync(request.Username, request.Password, expireTime);
- _logger.LogInformation(Log.Format(LogCreateSuccess,
- ("Username", request.Username),
- ("Expire At", expireTime?.ToString(CultureInfo.CurrentCulture.DateTimeFormat) ?? "default")
- ));
return new HttpCreateTokenResponse
{
Token = result.Token,
User = await _mapper.MapAsync<HttpUser>(result.User, Url, User)
};
}
- catch (UserNotExistException e)
+ catch (EntityNotExistException)
{
- LogFailure(LogUserNotExist, e);
- return BadRequest(ErrorResponse.TokenController.Create_BadCredential());
+ return this.BadRequestWithCommonResponse(ErrorCodes.TokenController.CreateBadCredential, Resource.MessageTokenCreateBadCredential);
}
- catch (BadPasswordException e)
+ catch (BadPasswordException)
{
- LogFailure(LogBadPassword, e);
- return BadRequest(ErrorResponse.TokenController.Create_BadCredential());
+ return this.BadRequestWithCommonResponse(ErrorCodes.TokenController.CreateBadCredential, Resource.MessageTokenCreateBadCredential);
}
}
@@ -97,45 +75,29 @@ namespace Timeline.Controllers
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult<HttpVerifyTokenResponse>> Verify([FromBody] HttpVerifyTokenRequest request)
{
- void LogFailure(string reason, Exception? e = null, params (string, object?)[] otherProperties)
- {
- var properties = new (string, object?)[2 + otherProperties.Length];
- properties[0] = ("Reason", reason);
- properties[1] = ("Token", request.Token);
- otherProperties.CopyTo(properties, 2);
- _logger.LogInformation(e, Log.Format(LogVerifyFailure, properties));
- }
-
try
{
var result = await _userTokenManager.VerifyTokenAsync(request.Token);
- _logger.LogInformation(Log.Format(LogVerifySuccess,
- ("Username", result.Username), ("Token", request.Token)));
return new HttpVerifyTokenResponse
{
User = await _mapper.MapAsync<HttpUser>(result, Url, User)
};
}
- catch (UserTokenTimeExpiredException e)
+ catch (UserTokenTimeExpiredException)
{
- LogFailure(LogVerifyExpire, e, ("Expire Time", e.ExpireTime), ("Verify Time", e.VerifyTime));
- return BadRequest(ErrorResponse.TokenController.Verify_TimeExpired());
+ return this.BadRequestWithCommonResponse(ErrorCodes.TokenController.VerifyTimeExpired, Resource.MessageTokenVerifyTimeExpired);
}
- catch (UserTokenVersionExpiredException e)
+ catch (UserTokenVersionExpiredException)
{
- LogFailure(LogVerifyOldVersion, e, ("Token Version", e.TokenVersion), ("Required Version", e.RequiredVersion));
- return BadRequest(ErrorResponse.TokenController.Verify_OldVersion());
-
+ return this.BadRequestWithCommonResponse(ErrorCodes.TokenController.VerifyOldVersion, Resource.MessageTokenVerifyOldVersion);
}
- catch (UserTokenBadFormatException e)
+ catch (UserTokenBadFormatException)
{
- LogFailure(LogVerifyBadFormat, e);
- return BadRequest(ErrorResponse.TokenController.Verify_BadFormat());
+ return this.BadRequestWithCommonResponse(ErrorCodes.TokenController.VerifyBadFormat, Resource.MessageTokenVerifyBadFormat);
}
- catch (UserTokenUserNotExistException e)
+ catch (UserTokenUserNotExistException)
{
- LogFailure(LogVerifyUserNotExist, e);
- return BadRequest(ErrorResponse.TokenController.Verify_UserNotExist());
+ return this.BadRequestWithCommonResponse(ErrorCodes.TokenController.VerifyUserNotExist, Resource.MessageTokenVerifyUserNotExist);
}
}
}
diff --git a/BackEnd/Timeline/Controllers/UserAvatarController.cs b/BackEnd/Timeline/Controllers/UserAvatarController.cs
index c280f033..47d46a54 100644
--- a/BackEnd/Timeline/Controllers/UserAvatarController.cs
+++ b/BackEnd/Timeline/Controllers/UserAvatarController.cs
@@ -1,11 +1,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using System;
using System.Threading.Tasks;
using Timeline.Filters;
-using Timeline.Helpers;
using Timeline.Helpers.Cache;
using Timeline.Models;
using Timeline.Models.Http;
@@ -13,7 +10,6 @@ using Timeline.Models.Validation;
using Timeline.Services.Imaging;
using Timeline.Services.User;
using Timeline.Services.User.Avatar;
-using static Timeline.Resources.Controllers.UserAvatarController;
namespace Timeline.Controllers
{
@@ -24,17 +20,11 @@ namespace Timeline.Controllers
[ProducesErrorResponseType(typeof(CommonResponse))]
public class UserAvatarController : Controller
{
- private readonly ILogger<UserAvatarController> _logger;
-
private readonly IUserService _userService;
private readonly IUserAvatarService _service;
- /// <summary>
- ///
- /// </summary>
- public UserAvatarController(ILogger<UserAvatarController> logger, IUserService userService, IUserAvatarService service)
+ public UserAvatarController(IUserService userService, IUserAvatarService service)
{
- _logger = logger;
_userService = userService;
_service = service;
}
@@ -53,18 +43,8 @@ namespace Timeline.Controllers
public async Task<IActionResult> Get([FromRoute][Username] string username, [FromHeader(Name = "If-None-Match")] string? ifNoneMatch)
{
_ = ifNoneMatch;
- long id;
- try
- {
- id = await _userService.GetUserIdByUsernameAsync(username);
- }
- catch (UserNotExistException e)
- {
- _logger.LogInformation(e, Log.Format(LogGetUserNotExist, ("Username", username)));
- return NotFound(ErrorResponse.UserCommon.NotExist());
- }
-
- return await DataCacheHelper.GenerateActionResult(this, () => _service.GetAvatarDigestAsync(id), () => _service.GetAvatarAsync(id));
+ long userId = await _userService.GetUserIdByUsernameAsync(username);
+ return await DataCacheHelper.GenerateActionResult(this, () => _service.GetAvatarDigestAsync(userId), () => _service.GetAvatarAsync(userId));
}
/// <summary>
@@ -84,43 +64,27 @@ namespace Timeline.Controllers
{
if (!this.UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username)
{
- _logger.LogInformation(Log.Format(LogPutForbid,
- ("Operator Username", User.Identity.Name), ("Username To Put Avatar", username)));
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage(Resource.MessageForbidNotAdministratorOrOwner);
}
- long id;
- try
- {
- id = await _userService.GetUserIdByUsernameAsync(username);
- }
- catch (UserNotExistException e)
- {
- _logger.LogInformation(e, Log.Format(LogPutUserNotExist, ("Username", username)));
- return BadRequest(ErrorResponse.UserCommon.NotExist());
- }
+ long id = await _userService.GetUserIdByUsernameAsync(username);
try
{
var digest = await _service.SetAvatarAsync(id, body);
- _logger.LogInformation(Log.Format(LogPutSuccess,
- ("Username", username), ("Mime Type", Request.ContentType)));
-
Response.Headers.Append("ETag", $"\"{digest.ETag}\"");
return Ok();
}
catch (ImageException e)
{
- _logger.LogInformation(e, Log.Format(LogPutUserBadFormat, ("Username", username)));
return BadRequest(e.Error switch
{
- ImageException.ErrorReason.CantDecode => ErrorResponse.UserAvatar.BadFormat_CantDecode(),
- ImageException.ErrorReason.UnmatchedFormat => ErrorResponse.UserAvatar.BadFormat_UnmatchedFormat(),
- ImageException.ErrorReason.BadSize => ErrorResponse.UserAvatar.BadFormat_BadSize(),
- _ =>
- throw new Exception(ExceptionUnknownAvatarFormatError)
+ ImageException.ErrorReason.CantDecode => new CommonResponse(ErrorCodes.Image.CantDecode, Resource.MessageImageDecodeFailed),
+ ImageException.ErrorReason.UnmatchedFormat => new CommonResponse(ErrorCodes.Image.UnmatchedFormat, Resource.MessageImageFormatUnmatch),
+ ImageException.ErrorReason.BadSize => new CommonResponse(ErrorCodes.Image.BadSize, Resource.MessageImageBadSize),
+ _ => new CommonResponse(ErrorCodes.Image.Unknown, Resource.MessageImageUnknownError)
});
}
}
@@ -143,21 +107,10 @@ namespace Timeline.Controllers
{
if (!this.UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username)
{
- _logger.LogInformation(Log.Format(LogDeleteForbid,
- ("Operator Username", User.Identity!.Name), ("Username To Delete Avatar", username)));
- return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
+ return this.ForbidWithMessage(Resource.MessageForbidNotAdministratorOrOwner);
}
- long id;
- try
- {
- id = await _userService.GetUserIdByUsernameAsync(username);
- }
- catch (UserNotExistException e)
- {
- _logger.LogInformation(e, Log.Format(LogDeleteNotExist, ("Username", username)));
- return BadRequest(ErrorResponse.UserCommon.NotExist());
- }
+ long id = await _userService.GetUserIdByUsernameAsync(username);
await _service.DeleteAvatarAsync(id);
return Ok();
diff --git a/BackEnd/Timeline/Controllers/UserController.cs b/BackEnd/Timeline/Controllers/UserController.cs
index 615eac2d..ec732caa 100644
--- a/BackEnd/Timeline/Controllers/UserController.cs
+++ b/BackEnd/Timeline/Controllers/UserController.cs
@@ -1,18 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Auth;
-using Timeline.Helpers;
using Timeline.Models.Http;
using Timeline.Models.Validation;
-using Timeline.Services;
using Timeline.Services.Mapper;
using Timeline.Services.User;
-using static Timeline.Resources.Controllers.UserController;
-using static Timeline.Resources.Messages;
namespace Timeline.Controllers
{
@@ -23,16 +18,14 @@ namespace Timeline.Controllers
[ProducesErrorResponseType(typeof(CommonResponse))]
public class UserController : Controller
{
- private readonly ILogger<UserController> _logger;
private readonly IUserService _userService;
private readonly IUserPermissionService _userPermissionService;
private readonly IUserDeleteService _userDeleteService;
private readonly IGenericMapper _mapper;
/// <summary></summary>
- public UserController(ILogger<UserController> logger, IUserService userService, IUserPermissionService userPermissionService, IUserDeleteService userDeleteService, IGenericMapper mapper)
+ public UserController(IUserService userService, IUserPermissionService userPermissionService, IUserDeleteService userDeleteService, IGenericMapper mapper)
{
- _logger = logger;
_userService = userService;
_userPermissionService = userPermissionService;
_userDeleteService = userDeleteService;
@@ -65,16 +58,10 @@ namespace Timeline.Controllers
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<ActionResult<HttpUser>> Post([FromBody] HttpUserPostRequest body)
{
- try
- {
- var user = await _userService.CreateUserAsync(
- new CreateUserParams(body.Username, body.Password) { Nickname = body.Nickname });
- return await _mapper.MapAsync<HttpUser>(user, Url, User);
- }
- catch (EntityAlreadyExistException e) when (e.EntityName == EntityNames.User)
- {
- return BadRequest(ErrorResponse.UserController.UsernameConflict());
- }
+
+ var user = await _userService.CreateUserAsync(
+ new CreateUserParams(body.Username, body.Password) { Nickname = body.Nickname });
+ return await _mapper.MapAsync<HttpUser>(user, Url, User);
}
/// <summary>
@@ -87,17 +74,9 @@ namespace Timeline.Controllers
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<HttpUser>> Get([FromRoute][Username] string username)
{
- try
- {
- var id = await _userService.GetUserIdByUsernameAsync(username);
- var user = await _userService.GetUserAsync(id);
- return await _mapper.MapAsync<HttpUser>(user, Url, User);
- }
- catch (UserNotExistException e)
- {
- _logger.LogInformation(e, Log.Format(LogGetUserNotExist, ("Username", username)));
- return NotFound(ErrorResponse.UserCommon.NotExist());
- }
+ var id = await _userService.GetUserIdByUsernameAsync(username);
+ var user = await _userService.GetUserAsync(id);
+ return await _mapper.MapAsync<HttpUser>(user, Url, User);
}
/// <summary>
@@ -116,35 +95,20 @@ namespace Timeline.Controllers
{
if (UserHasUserManagementPermission)
{
- try
- {
- var id = await _userService.GetUserIdByUsernameAsync(username);
- var user = await _userService.ModifyUserAsync(id, _mapper.AutoMapperMap<ModifyUserParams>(body));
- return await _mapper.MapAsync<HttpUser>(user, Url, User);
- }
- catch (UserNotExistException e)
- {
- _logger.LogInformation(e, Log.Format(LogPatchUserNotExist, ("Username", username)));
- return NotFound(ErrorResponse.UserCommon.NotExist());
- }
- catch (EntityAlreadyExistException e) when (e.EntityName == EntityNames.User)
- {
- return BadRequest(ErrorResponse.UserController.UsernameConflict());
- }
+ var id = await _userService.GetUserIdByUsernameAsync(username);
+ var user = await _userService.ModifyUserAsync(id, _mapper.AutoMapperMap<ModifyUserParams>(body));
+ return await _mapper.MapAsync<HttpUser>(user, Url, User);
}
else
{
if (User.Identity!.Name != username)
- return StatusCode(StatusCodes.Status403Forbidden,
- ErrorResponse.Common.CustomMessage_Forbid(Common_Forbid_NotSelf));
+ return this.ForbidWithMessage(Resource.MessageForbidNotAdministratorOrOwner);
if (body.Username != null)
- return StatusCode(StatusCodes.Status403Forbidden,
- ErrorResponse.Common.CustomMessage_Forbid(UserController_Patch_Forbid_Username));
+ return this.ForbidWithMessage(Resource.MessageForbidNotAdministrator);
if (body.Password != null)
- return StatusCode(StatusCodes.Status403Forbidden,
- ErrorResponse.Common.CustomMessage_Forbid(UserController_Patch_Forbid_Password));
+ return this.ForbidWithMessage(Resource.MessageForbidNotAdministrator);
var user = await _userService.ModifyUserAsync(this.GetUserId(), _mapper.AutoMapperMap<ModifyUserParams>(body));
return await _mapper.MapAsync<HttpUser>(user, Url, User);
@@ -173,7 +137,7 @@ namespace Timeline.Controllers
}
catch (InvalidOperationOnRootUserException)
{
- return BadRequest(ErrorResponse.UserController.Delete_RootUser());
+ return this.BadRequestWithCommonResponse(ErrorCodes.UserController.InvalidOperationOnRootUser, Resource.MessageInvalidOperationOnRootUser);
}
}
@@ -191,11 +155,9 @@ namespace Timeline.Controllers
await _userService.ChangePassword(this.GetUserId(), request.OldPassword, request.NewPassword);
return Ok();
}
- catch (BadPasswordException e)
+ catch (BadPasswordException)
{
- _logger.LogInformation(e, Log.Format(LogChangePasswordBadPassword,
- ("Username", User.Identity!.Name), ("Old Password", request.OldPassword)));
- return BadRequest(ErrorResponse.UserController.ChangePassword_BadOldPassword());
+ return this.BadRequestWithCommonResponse(ErrorCodes.UserController.ChangePasswordBadOldPassword, Resource.MessageOldPasswordWrong);
}
// User can't be non-existent or the token is bad.
}
@@ -214,13 +176,9 @@ namespace Timeline.Controllers
await _userPermissionService.AddPermissionToUserAsync(id, permission);
return Ok();
}
- catch (UserNotExistException)
- {
- return NotFound(ErrorResponse.UserCommon.NotExist());
- }
catch (InvalidOperationOnRootUserException)
{
- return BadRequest(ErrorResponse.UserController.ChangePermission_RootUser());
+ return this.BadRequestWithCommonResponse(ErrorCodes.UserController.InvalidOperationOnRootUser, Resource.MessageInvalidOperationOnRootUser);
}
}
@@ -238,13 +196,9 @@ namespace Timeline.Controllers
await _userPermissionService.RemovePermissionFromUserAsync(id, permission);
return Ok();
}
- catch (UserNotExistException)
- {
- return NotFound(ErrorResponse.UserCommon.NotExist());
- }
catch (InvalidOperationOnRootUserException)
{
- return BadRequest(ErrorResponse.UserController.ChangePermission_RootUser());
+ return this.BadRequestWithCommonResponse(ErrorCodes.UserController.InvalidOperationOnRootUser, Resource.MessageInvalidOperationOnRootUser);
}
}
}
diff --git a/BackEnd/Timeline/ErrorCodes.cs b/BackEnd/Timeline/ErrorCodes.cs
index 87d451f2..79054a6f 100644
--- a/BackEnd/Timeline/ErrorCodes.cs
+++ b/BackEnd/Timeline/ErrorCodes.cs
@@ -1,4 +1,4 @@
-namespace Timeline.Models.Http
+namespace Timeline
{
/// <summary>
/// All error code constants.
@@ -36,42 +36,50 @@
}
}
- public static class UserCommon
+ public static class NotExist
{
- public const int NotExist = 1_001_0001;
+ public const int Default = 2_001_00_00;
+ public const int User = 2_001_00_01;
+ public const int Timeline = 2_001_00_02;
+ public const int TimelinePost = 2_001_00_03;
+ public const int TimelinePostData = 2_001_00_04;
+ }
+
+ public static class Conflict
+ {
+ public const int Default = 2_002_00_00;
+ public const int User = 2_002_00_01;
+ public const int Timeline = 2_002_00_02;
+ public const int TimelinePost = 2_002_00_03;
+ public const int TimelinePostData = 2_002_00_04;
}
public static class TokenController
{
- public const int Create_BadCredential = 1_101_01_01;
- public const int Verify_BadFormat = 1_101_02_01;
- public const int Verify_UserNotExist = 1_101_02_02;
- public const int Verify_OldVersion = 1_101_02_03;
- public const int Verify_TimeExpired = 1_101_02_04;
+ public const int CreateBadCredential = 1_101_01_01;
+ public const int VerifyBadFormat = 1_101_02_01;
+ public const int VerifyUserNotExist = 1_101_02_02;
+ public const int VerifyOldVersion = 1_101_02_03;
+ public const int VerifyTimeExpired = 1_101_02_04;
}
public static class UserController
{
- public const int UsernameConflict = 1_102_01_01;
- public const int ChangePassword_BadOldPassword = 1_102_02_01;
- public const int ChangePermission_RootUser = 1_102_03_01;
- public const int Delete_RootUser = 1_102_04_01;
+ public const int ChangePasswordBadOldPassword = 1_102_01_01;
+ public const int InvalidOperationOnRootUser = 1_102_02_01;
}
- public static class UserAvatar
+ public static class Image
{
- public const int BadFormat_CantDecode = 1_103_00_01;
- public const int BadFormat_UnmatchedFormat = 1_103_00_02;
- public const int BadFormat_BadSize = 1_103_00_03;
+ public const int CantDecode = 1_103_00_01;
+ public const int UnmatchedFormat = 1_103_00_02;
+ public const int BadSize = 1_103_00_03;
+ public const int Unknown = 1_103_00_04;
}
public static class TimelineController
{
- public const int NameConflict = 1_104_01_01;
- public const int NotExist = 1_104_02_01;
public const int QueryRelateNotExist = 1_104_04_01;
- public const int PostNotExist = 1_104_05_01;
- public const int PostDataNotExist = 1_104_05_02;
}
public static class HighlightTimelineController
diff --git a/BackEnd/Timeline/Filters/CatchEntityAlreadyExistExceptionFilter.cs b/BackEnd/Timeline/Filters/CatchEntityAlreadyExistExceptionFilter.cs
new file mode 100644
index 00000000..67b260d2
--- /dev/null
+++ b/BackEnd/Timeline/Filters/CatchEntityAlreadyExistExceptionFilter.cs
@@ -0,0 +1,28 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Timeline.Models.Http;
+using Timeline.Services;
+
+namespace Timeline.Filters
+{
+ public class CatchEntityAlreadyExistExceptionFilter : IExceptionFilter
+ {
+ private static string MakeMessage(EntityAlreadyExistException e)
+ {
+ return string.Format(Resource.MessageEntityAlreadyExist, e.EntityType.Name, e.GenerateConstraintString());
+ }
+
+ private static CommonResponse MakeCommonResponse(EntityAlreadyExistException e)
+ {
+ return new CommonResponse(e.EntityType.ConflictErrorCode, MakeMessage(e));
+ }
+
+ public void OnException(ExceptionContext context)
+ {
+ if (context.Exception is EntityAlreadyExistException e)
+ {
+ context.Result = new BadRequestObjectResult(MakeCommonResponse(e));
+ }
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Filters/CatchEntityNotExistExceptionFilter.cs b/BackEnd/Timeline/Filters/CatchEntityNotExistExceptionFilter.cs
new file mode 100644
index 00000000..225fab4f
--- /dev/null
+++ b/BackEnd/Timeline/Filters/CatchEntityNotExistExceptionFilter.cs
@@ -0,0 +1,40 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Timeline.Models.Http;
+using Timeline.Services;
+
+namespace Timeline.Filters
+{
+ public class CatchEntityNotExistExceptionFilter : IExceptionFilter
+ {
+ private static string MakeMessage(EntityNotExistException e)
+ {
+ return string.Format(Resource.MessageEntityNotExist, e.EntityType.Name, e.GenerateConstraintString());
+ }
+
+ private static CommonResponse MakeCommonResponse(EntityNotExistException e)
+ {
+ return new CommonResponse(e.EntityType.NotExistErrorCode, MakeMessage(e));
+ }
+
+ public void OnException(ExceptionContext context)
+ {
+ if (context.Exception is EntityNotExistException e)
+ {
+ if (HttpMethods.IsGet(context.HttpContext.Request.Method))
+ {
+ context.Result = new NotFoundObjectResult(MakeCommonResponse(e));
+ }
+ else if (HttpMethods.IsDelete(context.HttpContext.Request.Method))
+ {
+ context.Result = new OkObjectResult(CommonDeleteResponse.NotExist());
+ }
+ else
+ {
+ context.Result = new BadRequestObjectResult(MakeCommonResponse(e));
+ }
+ }
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Filters/CatchTimelineNotExistExceptionAttribute.cs b/BackEnd/Timeline/Filters/CatchTimelineNotExistExceptionAttribute.cs
deleted file mode 100644
index 7a1352a3..00000000
--- a/BackEnd/Timeline/Filters/CatchTimelineNotExistExceptionAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Timeline.Models.Http;
-using Timeline.Services.Timeline;
-using Timeline.Services.User;
-
-namespace Timeline.Filters
-{
- public class CatchTimelineNotExistExceptionAttribute : ExceptionFilterAttribute
- {
- public override void OnException(ExceptionContext context)
- {
- if (context.Exception is TimelineNotExistException e)
- {
- if (e.InnerException is UserNotExistException)
- {
- if (HttpMethods.IsGet(context.HttpContext.Request.Method))
- context.Result = new NotFoundObjectResult(ErrorResponse.UserCommon.NotExist());
- else
- context.Result = new BadRequestObjectResult(ErrorResponse.UserCommon.NotExist());
- }
- else
- {
- if (HttpMethods.IsGet(context.HttpContext.Request.Method))
- context.Result = new NotFoundObjectResult(ErrorResponse.TimelineController.NotExist());
- else
- context.Result = new BadRequestObjectResult(ErrorResponse.TimelineController.NotExist());
- }
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Filters/CatchTimelinePostDataNotExistExceptionAttribute.cs b/BackEnd/Timeline/Filters/CatchTimelinePostDataNotExistExceptionAttribute.cs
deleted file mode 100644
index b4046c58..00000000
--- a/BackEnd/Timeline/Filters/CatchTimelinePostDataNotExistExceptionAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Timeline.Models.Http;
-using Timeline.Services.Timeline;
-
-namespace Timeline.Filters
-{
- public class CatchTimelinePostDataNotExistExceptionAttribute : ExceptionFilterAttribute
- {
- public override void OnException(ExceptionContext context)
- {
- const string message = "Timeline post data does not exist.";
-
- if (context.Exception is TimelinePostDataNotExistException e)
- {
- if (HttpMethods.IsGet(context.HttpContext.Request.Method))
- context.Result = new NotFoundObjectResult(new CommonResponse(ErrorCodes.TimelineController.PostNotExist, message));
- else
- context.Result = new BadRequestObjectResult(new CommonResponse(ErrorCodes.TimelineController.PostNotExist, message));
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Filters/CatchTimelinePostNotExistExceptionAttribute.cs b/BackEnd/Timeline/Filters/CatchTimelinePostNotExistExceptionAttribute.cs
deleted file mode 100644
index a288f890..00000000
--- a/BackEnd/Timeline/Filters/CatchTimelinePostNotExistExceptionAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Timeline.Models.Http;
-using Timeline.Services.Timeline;
-
-namespace Timeline.Filters
-{
- public class CatchTimelinePostNotExistExceptionAttribute : ExceptionFilterAttribute
- {
- public override void OnException(ExceptionContext context)
- {
- const string message = "Timeline post does not exist.";
-
- if (context.Exception is TimelinePostNotExistException e)
- {
- if (HttpMethods.IsGet(context.HttpContext.Request.Method))
- context.Result = new NotFoundObjectResult(new CommonResponse(ErrorCodes.TimelineController.PostNotExist, message));
- else
- context.Result = new BadRequestObjectResult(new CommonResponse(ErrorCodes.TimelineController.PostNotExist, message));
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Filters/MaxContentLengthAttribute.cs b/BackEnd/Timeline/Filters/MaxContentLengthAttribute.cs
new file mode 100644
index 00000000..507a6404
--- /dev/null
+++ b/BackEnd/Timeline/Filters/MaxContentLengthAttribute.cs
@@ -0,0 +1,26 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Timeline.Filters
+{
+ /// <summary>
+ /// Restrict max content length.
+ /// </summary>
+ public class MaxContentLengthAttribute : TypeFilterAttribute
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="maxByteLength">Max length.</param>
+ public MaxContentLengthAttribute(long maxByteLength)
+ : base(typeof(MaxContentLengthFilter))
+ {
+ MaxByteLength = maxByteLength;
+ Arguments = new object[] { maxByteLength };
+ }
+
+ /// <summary>
+ /// Max length.
+ /// </summary>
+ public long MaxByteLength { get; }
+ }
+}
diff --git a/BackEnd/Timeline/Filters/Header.cs b/BackEnd/Timeline/Filters/MaxContentLengthFilter.cs
index cc5ddd9f..0127971a 100644
--- a/BackEnd/Timeline/Filters/Header.cs
+++ b/BackEnd/Timeline/Filters/MaxContentLengthFilter.cs
@@ -34,30 +34,10 @@ namespace Timeline.Filters
var contentLength = context.HttpContext.Request.ContentLength;
if (contentLength != null && contentLength > MaxByteLength)
{
- context.Result = new BadRequestObjectResult(ErrorResponse.Common.Content.TooBig(MaxByteLength + "B"));
+ context.Result = new BadRequestObjectResult(
+ new CommonResponse(ErrorCodes.Common.Content.TooBig,
+ string.Format(Resource.MessageContentLengthTooBig, MaxByteLength + "B")));
}
}
}
-
- /// <summary>
- /// Restrict max content length.
- /// </summary>
- public class MaxContentLengthAttribute : TypeFilterAttribute
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="maxByteLength">Max length.</param>
- public MaxContentLengthAttribute(long maxByteLength)
- : base(typeof(MaxContentLengthFilter))
- {
- MaxByteLength = maxByteLength;
- Arguments = new object[] { maxByteLength };
- }
-
- /// <summary>
- /// Max length.
- /// </summary>
- public long MaxByteLength { get; }
- }
}
diff --git a/BackEnd/Timeline/Resources/Helper/DataCacheHelper.Designer.cs b/BackEnd/Timeline/Filters/Resource.Designer.cs
index acf56d13..d5b533d4 100644
--- a/BackEnd/Timeline/Resources/Helper/DataCacheHelper.Designer.cs
+++ b/BackEnd/Timeline/Filters/Resource.Designer.cs
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Timeline.Resources.Helper {
+namespace Timeline.Filters {
using System;
@@ -22,14 +22,14 @@ namespace Timeline.Resources.Helper {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class DataCacheHelper {
+ internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal DataCacheHelper() {
+ internal Resource() {
}
/// <summary>
@@ -39,7 +39,7 @@ namespace Timeline.Resources.Helper {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Helper.DataCacheHelper", typeof(DataCacheHelper).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Filters.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -61,29 +61,29 @@ namespace Timeline.Resources.Helper {
}
/// <summary>
- /// Looks up a localized string similar to Header If-None-Match is of bad format..
+ /// Looks up a localized string similar to Content length is too big. It can&apos;t be bigger than {0}..
/// </summary>
- internal static string LogBadIfNoneMatch {
+ internal static string MessageContentLengthTooBig {
get {
- return ResourceManager.GetString("LogBadIfNoneMatch", resourceCulture);
+ return ResourceManager.GetString("MessageContentLengthTooBig", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Cache is invalid and data is returned..
+ /// Looks up a localized string similar to The entity you want to create already exists. Entity type is {0}. Constraints are {1}..
/// </summary>
- internal static string LogResultData {
+ internal static string MessageEntityAlreadyExist {
get {
- return ResourceManager.GetString("LogResultData", resourceCulture);
+ return ResourceManager.GetString("MessageEntityAlreadyExist", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Cache is valid and 304 Not Modified is returned..
+ /// Looks up a localized string similar to The entity you operate on does not exist. Entity type is {0}. Constraints are {1}..
/// </summary>
- internal static string LogResultNotModified {
+ internal static string MessageEntityNotExist {
get {
- return ResourceManager.GetString("LogResultNotModified", resourceCulture);
+ return ResourceManager.GetString("MessageEntityNotExist", resourceCulture);
}
}
}
diff --git a/BackEnd/Timeline/Resources/Helper/DataCacheHelper.resx b/BackEnd/Timeline/Filters/Resource.resx
index 515cfa9b..d55e996c 100644
--- a/BackEnd/Timeline/Resources/Helper/DataCacheHelper.resx
+++ b/BackEnd/Timeline/Filters/Resource.resx
@@ -117,13 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="LogBadIfNoneMatch" xml:space="preserve">
- <value>Header If-None-Match is of bad format.</value>
+ <data name="MessageContentLengthTooBig" xml:space="preserve">
+ <value>Content length is too big. It can't be bigger than {0}.</value>
</data>
- <data name="LogResultData" xml:space="preserve">
- <value>Cache is invalid and data is returned.</value>
+ <data name="MessageEntityAlreadyExist" xml:space="preserve">
+ <value>The entity you want to create already exists. Entity type is {0}. Constraints are {1}.</value>
</data>
- <data name="LogResultNotModified" xml:space="preserve">
- <value>Cache is valid and 304 Not Modified is returned.</value>
+ <data name="MessageEntityNotExist" xml:space="preserve">
+ <value>The entity you operate on does not exist. Entity type is {0}. Constraints are {1}.</value>
</data>
</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/GlobalSuppressions.cs b/BackEnd/Timeline/GlobalSuppressions.cs
index 1d6905a5..c8bf2075 100644
--- a/BackEnd/Timeline/GlobalSuppressions.cs
+++ b/BackEnd/Timeline/GlobalSuppressions.cs
@@ -7,10 +7,4 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task", Justification = "This is not a UI application.")]
[assembly: SuppressMessage("Design", "CA1034:Nested types should not be visible", Justification = "This is not bad.")]
-[assembly: SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Generated error response identifiers.", Scope = "type", Target = "~T:Timeline.Models.Http.ErrorResponse")]
-[assembly: SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Generated error response identifiers.", Scope = "type", Target = "~T:Timeline.Models.Http.ErrorResponse")]
-[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "Generated error response.", Scope = "type", Target = "~T:Timeline.Models.Http.ErrorResponse")]
-[assembly: SuppressMessage("Design", "CA1056:Uri properties should not be strings", Justification = "That's unnecessary.")]
[assembly: SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "Redundant")]
-[assembly: SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "No localization demand.")]
-[assembly: SuppressMessage("Design", "CA1054:URI-like parameters should not be strings")]
diff --git a/BackEnd/Timeline/Helpers/Cache/DataCacheHelper.cs b/BackEnd/Timeline/Helpers/Cache/DataCacheHelper.cs
index b7d86b18..1d1ab64e 100644
--- a/BackEnd/Timeline/Helpers/Cache/DataCacheHelper.cs
+++ b/BackEnd/Timeline/Helpers/Cache/DataCacheHelper.cs
@@ -48,7 +48,7 @@ namespace Timeline.Helpers.Cache
{
if (!EntityTagHeaderValue.TryParseList(ifNonMatchHeaderValue, out var eTagList))
{
- return controller.BadRequest(ErrorResponse.Common.Header.IfNonMatch_BadFormat());
+ return controller.BadRequest(new CommonResponse(ErrorCodes.Common.Header.IfNonMatch_BadFormat, "Header If-None-Match is of bad format."));
}
if (eTagList.FirstOrDefault(e => e.Equals(eTag)) != null)
diff --git a/BackEnd/Timeline/Helpers/InvalidModelResponseFactory.cs b/BackEnd/Timeline/Helpers/InvalidModelResponseFactory.cs
index 9b253e7d..121aee6a 100644
--- a/BackEnd/Timeline/Helpers/InvalidModelResponseFactory.cs
+++ b/BackEnd/Timeline/Helpers/InvalidModelResponseFactory.cs
@@ -19,7 +19,7 @@ namespace Timeline.Helpers
messageBuilder.AppendLine(error.ErrorMessage);
}
- return new BadRequestObjectResult(ErrorResponse.Common.CustomMessage_InvalidModel(messageBuilder.ToString()));
+ return new BadRequestObjectResult(new CommonResponse(ErrorCodes.Common.InvalidModel, $"Request format is bad. {messageBuilder}"));
}
}
}
diff --git a/BackEnd/Timeline/Helpers/LanguageHelper.cs b/BackEnd/Timeline/Helpers/LanguageHelper.cs
deleted file mode 100644
index b0156b8b..00000000
--- a/BackEnd/Timeline/Helpers/LanguageHelper.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Linq;
-
-namespace Timeline.Helpers
-{
- public static class LanguageHelper
- {
- public static bool AreSame(this bool firstBool, params bool[] otherBools)
- {
- return otherBools.All(b => b == firstBool);
- }
- }
-}
diff --git a/BackEnd/Timeline/Helpers/Log.cs b/BackEnd/Timeline/Helpers/Log.cs
deleted file mode 100644
index af0b7e13..00000000
--- a/BackEnd/Timeline/Helpers/Log.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Text;
-
-namespace Timeline.Helpers
-{
- public static class Log
- {
- public static string Format(string summary, params (string, object?)[] properties)
- {
- var builder = new StringBuilder();
- builder.Append(summary);
- foreach (var property in properties)
- {
- var (key, value) = property;
- builder.AppendLine();
- builder.Append(key);
- builder.Append(" : ");
- builder.Append(value);
- }
- return builder.ToString();
- }
- }
-}
diff --git a/BackEnd/Timeline/Models/Http/CommonDataResponse.cs b/BackEnd/Timeline/Models/Http/CommonDataResponse.cs
new file mode 100644
index 00000000..93605e8c
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/CommonDataResponse.cs
@@ -0,0 +1,18 @@
+namespace Timeline.Models.Http
+{
+ public class CommonDataResponse<T> : CommonResponse
+ {
+ public CommonDataResponse()
+ {
+
+ }
+
+ public CommonDataResponse(int code, string message, T data)
+ : base(code, message)
+ {
+ Data = data;
+ }
+
+ public T Data { get; set; } = default!;
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs b/BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs
new file mode 100644
index 00000000..c8632f41
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/CommonDeleteResponse.cs
@@ -0,0 +1,54 @@
+namespace Timeline.Models.Http
+{
+ /// <summary>
+ /// Common response for delete method.
+ /// </summary>
+ public class CommonDeleteResponse : CommonDataResponse<CommonDeleteResponse.ResponseData>
+ {
+ /// <summary></summary>
+ public class ResponseData
+ {
+ /// <summary></summary>
+ public ResponseData() { }
+
+ /// <summary></summary>
+ public ResponseData(bool delete)
+ {
+ Delete = delete;
+ }
+
+ /// <summary>
+ /// True if the entry is deleted. False if the entry does not exist.
+ /// </summary>
+ public bool Delete { get; set; }
+ }
+
+ /// <summary></summary>
+ public CommonDeleteResponse()
+ {
+
+ }
+
+ /// <summary></summary>
+ public CommonDeleteResponse(int code, string message, bool delete)
+ : base(code, message, new ResponseData(delete))
+ {
+
+ }
+
+ internal static CommonDeleteResponse Create(bool delete)
+ {
+ return delete ? Delete() : NotExist();
+ }
+
+ internal static CommonDeleteResponse Delete()
+ {
+ return new CommonDeleteResponse(0, Resource.MessageDeleteDelete, true);
+ }
+
+ internal static CommonDeleteResponse NotExist()
+ {
+ return new CommonDeleteResponse(0, Resource.MessageDeleteNotExist, false);
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/CommonPutResponse.cs b/BackEnd/Timeline/Models/Http/CommonPutResponse.cs
new file mode 100644
index 00000000..06ca0bd2
--- /dev/null
+++ b/BackEnd/Timeline/Models/Http/CommonPutResponse.cs
@@ -0,0 +1,43 @@
+namespace Timeline.Models.Http
+{
+ public class CommonPutResponse : CommonDataResponse<CommonPutResponse.ResponseData>
+ {
+ public class ResponseData
+ {
+ public ResponseData() { }
+
+ public ResponseData(bool create)
+ {
+ Create = create;
+ }
+
+ public bool Create { get; set; }
+ }
+
+ public CommonPutResponse()
+ {
+
+ }
+
+ public CommonPutResponse(int code, string message, bool create)
+ : base(code, message, new ResponseData(create))
+ {
+
+ }
+
+ internal static CommonPutResponse Create(bool create)
+ {
+ return create ? Create() : Modify();
+ }
+
+ internal static CommonPutResponse Create()
+ {
+ return new CommonPutResponse(0, Resource.MessagePutCreate, true);
+ }
+
+ internal static CommonPutResponse Modify()
+ {
+ return new CommonPutResponse(0, Resource.MessagePutModify, false);
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Models/Http/CommonResponse.cs b/BackEnd/Timeline/Models/Http/CommonResponse.cs
index 3d0ed509..3666ea47 100644
--- a/BackEnd/Timeline/Models/Http/CommonResponse.cs
+++ b/BackEnd/Timeline/Models/Http/CommonResponse.cs
@@ -1,5 +1,3 @@
-using static Timeline.Resources.Models.Http.Common;
-
namespace Timeline.Models.Http
{
public class CommonResponse
@@ -18,113 +16,4 @@ namespace Timeline.Models.Http
public int Code { get; set; }
public string? Message { get; set; }
}
-
- public class CommonDataResponse<T> : CommonResponse
- {
- public CommonDataResponse()
- {
-
- }
-
- public CommonDataResponse(int code, string message, T data)
- : base(code, message)
- {
- Data = data;
- }
-
- public T Data { get; set; } = default!;
- }
-
- public class CommonPutResponse : CommonDataResponse<CommonPutResponse.ResponseData>
- {
- public class ResponseData
- {
- public ResponseData() { }
-
- public ResponseData(bool create)
- {
- Create = create;
- }
-
- public bool Create { get; set; }
- }
-
- public CommonPutResponse()
- {
-
- }
-
- public CommonPutResponse(int code, string message, bool create)
- : base(code, message, new ResponseData(create))
- {
-
- }
-
- internal static CommonPutResponse Create(bool create)
- {
- return new CommonPutResponse(0, MessagePutCreate, create);
- }
-
- internal static CommonPutResponse Create()
- {
- return new CommonPutResponse(0, MessagePutCreate, true);
- }
-
- internal static CommonPutResponse Modify()
- {
- return new CommonPutResponse(0, MessagePutModify, false);
- }
- }
-
- /// <summary>
- /// Common response for delete method.
- /// </summary>
- public class CommonDeleteResponse : CommonDataResponse<CommonDeleteResponse.ResponseData>
- {
- /// <summary></summary>
- public class ResponseData
- {
- /// <summary></summary>
- public ResponseData() { }
-
- /// <summary></summary>
- public ResponseData(bool delete)
- {
- Delete = delete;
- }
-
- /// <summary>
- /// True if the entry is deleted. False if the entry does not exist.
- /// </summary>
- public bool Delete { get; set; }
- }
-
- /// <summary></summary>
- public CommonDeleteResponse()
- {
-
- }
-
- /// <summary></summary>
- public CommonDeleteResponse(int code, string message, bool delete)
- : base(code, message, new ResponseData(delete))
- {
-
- }
-
- internal static CommonDeleteResponse Create(bool delete)
- {
- return new CommonDeleteResponse(0, MessageDeleteDelete, delete);
- }
-
- internal static CommonDeleteResponse Delete()
- {
- return new CommonDeleteResponse(0, MessageDeleteDelete, true);
- }
-
- internal static CommonDeleteResponse NotExist()
- {
- return new CommonDeleteResponse(0, MessageDeleteNotExist, false);
- }
- }
}
diff --git a/BackEnd/Timeline/Models/Http/ErrorResponse.cs b/BackEnd/Timeline/Models/Http/ErrorResponse.cs
deleted file mode 100644
index 3812471d..00000000
--- a/BackEnd/Timeline/Models/Http/ErrorResponse.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-using static Timeline.Resources.Messages;
-
-namespace Timeline.Models.Http
-{
- public static class ErrorResponse
- {
- public static class Common
- {
- public static CommonResponse InvalidModel(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.InvalidModel, string.Format(Common_InvalidModel, formatArgs));
- }
-
- public static CommonResponse CustomMessage_InvalidModel(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.InvalidModel, string.Format(message, formatArgs));
- }
-
- public static CommonResponse Forbid(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.Forbid, string.Format(Common_Forbid, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Forbid(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.Forbid, string.Format(message, formatArgs));
- }
-
- public static CommonResponse UnknownEndpoint(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.UnknownEndpoint, string.Format(Common_UnknownEndpoint, formatArgs));
- }
-
- public static CommonResponse CustomMessage_UnknownEndpoint(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.UnknownEndpoint, string.Format(message, formatArgs));
- }
-
- public static class Header
- {
- public static CommonResponse IfNonMatch_BadFormat(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.Header.IfNonMatch_BadFormat, string.Format(Common_Header_IfNonMatch_BadFormat, formatArgs));
- }
-
- public static CommonResponse CustomMessage_IfNonMatch_BadFormat(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.Header.IfNonMatch_BadFormat, string.Format(message, formatArgs));
- }
-
- }
-
- public static class Content
- {
- public static CommonResponse TooBig(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.Content.TooBig, string.Format(Common_Content_TooBig, formatArgs));
- }
-
- public static CommonResponse CustomMessage_TooBig(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.Common.Content.TooBig, string.Format(message, formatArgs));
- }
-
- }
-
- }
-
- public static class UserCommon
- {
- public static CommonResponse NotExist(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserCommon.NotExist, string.Format(UserCommon_NotExist, formatArgs));
- }
-
- public static CommonResponse CustomMessage_NotExist(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserCommon.NotExist, string.Format(message, formatArgs));
- }
-
- }
-
- public static class TokenController
- {
- public static CommonResponse Create_BadCredential(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Create_BadCredential, string.Format(TokenController_Create_BadCredential, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Create_BadCredential(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Create_BadCredential, string.Format(message, formatArgs));
- }
-
- public static CommonResponse Verify_BadFormat(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_BadFormat, string.Format(TokenController_Verify_BadFormat, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Verify_BadFormat(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_BadFormat, string.Format(message, formatArgs));
- }
-
- public static CommonResponse Verify_UserNotExist(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_UserNotExist, string.Format(TokenController_Verify_UserNotExist, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Verify_UserNotExist(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_UserNotExist, string.Format(message, formatArgs));
- }
-
- public static CommonResponse Verify_OldVersion(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_OldVersion, string.Format(TokenController_Verify_OldVersion, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Verify_OldVersion(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_OldVersion, string.Format(message, formatArgs));
- }
-
- public static CommonResponse Verify_TimeExpired(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_TimeExpired, string.Format(TokenController_Verify_TimeExpired, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Verify_TimeExpired(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TokenController.Verify_TimeExpired, string.Format(message, formatArgs));
- }
-
- }
-
- public static class UserController
- {
- public static CommonResponse UsernameConflict(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.UsernameConflict, string.Format(UserController_UsernameConflict, formatArgs));
- }
-
- public static CommonResponse CustomMessage_UsernameConflict(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.UsernameConflict, string.Format(message, formatArgs));
- }
-
- public static CommonResponse ChangePassword_BadOldPassword(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.ChangePassword_BadOldPassword, string.Format(UserController_ChangePassword_BadOldPassword, formatArgs));
- }
-
- public static CommonResponse CustomMessage_ChangePassword_BadOldPassword(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.ChangePassword_BadOldPassword, string.Format(message, formatArgs));
- }
-
- public static CommonResponse ChangePermission_RootUser(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.ChangePermission_RootUser, string.Format(UserController_ChangePermission_RootUser, formatArgs));
- }
-
- public static CommonResponse CustomMessage_ChangePermission_RootUser(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.ChangePermission_RootUser, string.Format(message, formatArgs));
- }
-
- public static CommonResponse Delete_RootUser(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.Delete_RootUser, string.Format(UserController_Delete_RootUser, formatArgs));
- }
-
- public static CommonResponse CustomMessage_Delete_RootUser(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserController.Delete_RootUser, string.Format(message, formatArgs));
- }
-
- }
-
- public static class UserAvatar
- {
- public static CommonResponse BadFormat_CantDecode(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_CantDecode, string.Format(UserAvatar_BadFormat_CantDecode, formatArgs));
- }
-
- public static CommonResponse CustomMessage_BadFormat_CantDecode(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_CantDecode, string.Format(message, formatArgs));
- }
-
- public static CommonResponse BadFormat_UnmatchedFormat(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_UnmatchedFormat, string.Format(UserAvatar_BadFormat_UnmatchedFormat, formatArgs));
- }
-
- public static CommonResponse CustomMessage_BadFormat_UnmatchedFormat(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_UnmatchedFormat, string.Format(message, formatArgs));
- }
-
- public static CommonResponse BadFormat_BadSize(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_BadSize, string.Format(UserAvatar_BadFormat_BadSize, formatArgs));
- }
-
- public static CommonResponse CustomMessage_BadFormat_BadSize(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_BadSize, string.Format(message, formatArgs));
- }
-
- }
-
- public static class TimelineController
- {
- public static CommonResponse NameConflict(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.NameConflict, string.Format(TimelineController_NameConflict, formatArgs));
- }
-
- public static CommonResponse CustomMessage_NameConflict(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.NameConflict, string.Format(message, formatArgs));
- }
-
- public static CommonResponse NotExist(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.NotExist, string.Format(TimelineController_NotExist, formatArgs));
- }
-
- public static CommonResponse CustomMessage_NotExist(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.NotExist, string.Format(message, formatArgs));
- }
-
- public static CommonResponse QueryRelateNotExist(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.QueryRelateNotExist, string.Format(TimelineController_QueryRelateNotExist, formatArgs));
- }
-
- public static CommonResponse CustomMessage_QueryRelateNotExist(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.QueryRelateNotExist, string.Format(message, formatArgs));
- }
-
- public static CommonResponse PostNotExist(params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.PostNotExist, string.Format(TimelineController_PostNotExist, formatArgs));
- }
-
- public static CommonResponse CustomMessage_PostNotExist(string message, params object?[] formatArgs)
- {
- return new CommonResponse(ErrorCodes.TimelineController.PostNotExist, string.Format(message, formatArgs));
- }
- }
-
- }
-
-}
diff --git a/BackEnd/Timeline/Resources/Models/Http/Common.Designer.cs b/BackEnd/Timeline/Models/Http/Resource.Designer.cs
index 5165463e..3e6aaa81 100644
--- a/BackEnd/Timeline/Resources/Models/Http/Common.Designer.cs
+++ b/BackEnd/Timeline/Models/Http/Resource.Designer.cs
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Timeline.Resources.Models.Http {
+namespace Timeline.Models.Http {
using System;
@@ -22,14 +22,14 @@ namespace Timeline.Resources.Models.Http {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Common {
+ internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Common() {
+ internal Resource() {
}
/// <summary>
@@ -39,7 +39,7 @@ namespace Timeline.Resources.Models.Http {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Models.Http.Common", typeof(Common).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Models.Http.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/BackEnd/Timeline/Resources/Models/Http/Common.resx b/BackEnd/Timeline/Models/Http/Resource.resx
index 85ec4d32..85ec4d32 100644
--- a/BackEnd/Timeline/Resources/Models/Http/Common.resx
+++ b/BackEnd/Timeline/Models/Http/Resource.resx
diff --git a/BackEnd/Timeline/Models/Validation/NameValidator.cs b/BackEnd/Timeline/Models/Validation/NameValidator.cs
index b74c40b7..2220de6f 100644
--- a/BackEnd/Timeline/Models/Validation/NameValidator.cs
+++ b/BackEnd/Timeline/Models/Validation/NameValidator.cs
@@ -1,6 +1,5 @@
using System.Linq;
using System.Text.RegularExpressions;
-using static Timeline.Resources.Models.Validation.NameValidator;
namespace Timeline.Models.Validation
{
@@ -14,26 +13,26 @@ namespace Timeline.Models.Validation
{
if (value.Length == 0)
{
- return (false, MessageEmptyString);
+ return (false, Resource.NameCantBeEmpty);
}
if (value.Length > MaxLength)
{
- return (false, MessageTooLong);
+ return (false, string.Format(Resource.NameCantBeLongerThan, MaxLength));
}
foreach ((char c, int i) in value.Select((c, i) => (c, i)))
{
if (!(char.IsLetterOrDigit(c) || c == '-' || c == '_'))
{
- return (false, MessageInvalidChar);
+ return (false, Resource.NameInvalidChar);
}
}
// Currently name can't be longer than 26. So this is not needed. But reserve it for future use.
if (UniqueIdRegex.IsMatch(value))
{
- return (false, MessageUnqiueId);
+ return (false, Resource.NameCantBeUniqueIdPattern);
}
return (true, GetSuccessMessage());
diff --git a/BackEnd/Timeline/Models/Validation/NicknameValidator.cs b/BackEnd/Timeline/Models/Validation/NicknameValidator.cs
index 1d6ab163..43365dce 100644
--- a/BackEnd/Timeline/Models/Validation/NicknameValidator.cs
+++ b/BackEnd/Timeline/Models/Validation/NicknameValidator.cs
@@ -1,5 +1,4 @@
using System;
-using static Timeline.Resources.Models.Validation.NicknameValidator;
namespace Timeline.Models.Validation
{
@@ -8,7 +7,7 @@ namespace Timeline.Models.Validation
protected override (bool, string) DoValidate(string value)
{
if (value.Length > 25)
- return (false, MessageTooLong);
+ return (false, Resource.NicknameTooLong);
return (true, GetSuccessMessage());
}
diff --git a/BackEnd/Timeline/Resources/Models/Validation/Validator.Designer.cs b/BackEnd/Timeline/Models/Validation/Resource.Designer.cs
index 74d4c169..47ad4248 100644
--- a/BackEnd/Timeline/Resources/Models/Validation/Validator.Designer.cs
+++ b/BackEnd/Timeline/Models/Validation/Resource.Designer.cs
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Timeline.Resources.Models.Validation {
+namespace Timeline.Models.Validation {
using System;
@@ -22,14 +22,14 @@ namespace Timeline.Resources.Models.Validation {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Validator {
+ internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Validator() {
+ internal Resource() {
}
/// <summary>
@@ -39,7 +39,7 @@ namespace Timeline.Resources.Models.Validation {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Models.Validation.Validator", typeof(Validator).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Models.Validation.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -61,47 +61,92 @@ namespace Timeline.Resources.Models.Validation {
}
/// <summary>
- /// Looks up a localized string similar to Failed to create a validator instance from default constructor. See inner exception..
+ /// Looks up a localized string similar to it can&apos;t be null.
/// </summary>
- internal static string ValidateWithAttributeExceptionCreateFail {
+ internal static string CantBeNull {
get {
- return ResourceManager.GetString("ValidateWithAttributeExceptionCreateFail", resourceCulture);
+ return ResourceManager.GetString("CantBeNull", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Given type is not assignable to IValidator..
+ /// Looks up a localized string similar to name can&apos;t be empty.
/// </summary>
- internal static string ValidateWithAttributeExceptionNotValidator {
+ internal static string NameCantBeEmpty {
get {
- return ResourceManager.GetString("ValidateWithAttributeExceptionNotValidator", resourceCulture);
+ return ResourceManager.GetString("NameCantBeEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to name can&apos;t be longer than {0}.
+ /// </summary>
+ internal static string NameCantBeLongerThan {
+ get {
+ return ResourceManager.GetString("NameCantBeLongerThan", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to name can&apos;t has the same pattern of unique id.
+ /// </summary>
+ internal static string NameCantBeUniqueIdPattern {
+ get {
+ return ResourceManager.GetString("NameCantBeUniqueIdPattern", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to name can only consists of alphabet, number, &apos;_&apos; and &apos;-&apos; .
+ /// </summary>
+ internal static string NameInvalidChar {
+ get {
+ return ResourceManager.GetString("NameInvalidChar", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to nickname can&apos;t be longer than 25.
+ /// </summary>
+ internal static string NicknameTooLong {
+ get {
+ return ResourceManager.GetString("NicknameTooLong", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Value is not of type {0}..
+ /// Looks up a localized string similar to it is not of type {0}.
/// </summary>
- internal static string ValidatorMessageBadType {
+ internal static string NotOfType {
get {
- return ResourceManager.GetString("ValidatorMessageBadType", resourceCulture);
+ return ResourceManager.GetString("NotOfType", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Value can&apos;t be null..
+ /// Looks up a localized string similar to Failed to create validator instance..
/// </summary>
- internal static string ValidatorMessageNull {
+ internal static string ValidateWithAttributeExceptionCreateFail {
get {
- return ResourceManager.GetString("ValidatorMessageNull", resourceCulture);
+ return ResourceManager.GetString("ValidateWithAttributeExceptionCreateFail", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Given type is not a IValidator instance..
+ /// </summary>
+ internal static string ValidateWithAttributeExceptionNotValidator {
+ get {
+ return ResourceManager.GetString("ValidateWithAttributeExceptionNotValidator", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Validation succeeded..
+ /// Looks up a localized string similar to validation passed.
/// </summary>
- internal static string ValidatorMessageSuccess {
+ internal static string ValidationPassed {
get {
- return ResourceManager.GetString("ValidatorMessageSuccess", resourceCulture);
+ return ResourceManager.GetString("ValidationPassed", resourceCulture);
}
}
}
diff --git a/BackEnd/Timeline/Resources/Models/Validation/Validator.resx b/BackEnd/Timeline/Models/Validation/Resource.resx
index 8317e3eb..68ba3810 100644
--- a/BackEnd/Timeline/Resources/Models/Validation/Validator.resx
+++ b/BackEnd/Timeline/Models/Validation/Resource.resx
@@ -117,19 +117,34 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="ValidateWithAttributeExceptionCreateFail" xml:space="preserve">
- <value>Failed to create a validator instance from default constructor. See inner exception.</value>
+ <data name="CantBeNull" xml:space="preserve">
+ <value>it can't be null</value>
</data>
- <data name="ValidateWithAttributeExceptionNotValidator" xml:space="preserve">
- <value>Given type is not assignable to IValidator.</value>
+ <data name="NameCantBeEmpty" xml:space="preserve">
+ <value>name can't be empty</value>
+ </data>
+ <data name="NameCantBeLongerThan" xml:space="preserve">
+ <value>name can't be longer than {0}</value>
+ </data>
+ <data name="NameCantBeUniqueIdPattern" xml:space="preserve">
+ <value>name can't has the same pattern of unique id</value>
+ </data>
+ <data name="NameInvalidChar" xml:space="preserve">
+ <value>name can only consists of alphabet, number, '_' and '-' </value>
</data>
- <data name="ValidatorMessageBadType" xml:space="preserve">
- <value>Value is not of type {0}.</value>
+ <data name="NicknameTooLong" xml:space="preserve">
+ <value>nickname can't be longer than 25</value>
</data>
- <data name="ValidatorMessageNull" xml:space="preserve">
- <value>Value can't be null.</value>
+ <data name="NotOfType" xml:space="preserve">
+ <value>it is not of type {0}</value>
+ </data>
+ <data name="ValidateWithAttributeExceptionCreateFail" xml:space="preserve">
+ <value>Failed to create validator instance.</value>
+ </data>
+ <data name="ValidateWithAttributeExceptionNotValidator" xml:space="preserve">
+ <value>Given type is not a IValidator instance.</value>
</data>
- <data name="ValidatorMessageSuccess" xml:space="preserve">
- <value>Validation succeeded.</value>
+ <data name="ValidationPassed" xml:space="preserve">
+ <value>validation passed</value>
</data>
</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Models/Validation/Validator.cs b/BackEnd/Timeline/Models/Validation/Validator.cs
index ec6cc0af..d334960e 100644
--- a/BackEnd/Timeline/Models/Validation/Validator.cs
+++ b/BackEnd/Timeline/Models/Validation/Validator.cs
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
-using static Timeline.Resources.Models.Validation.Validator;
namespace Timeline.Models.Validation
{
@@ -56,7 +55,7 @@ namespace Timeline.Models.Validation
if (PermitNull)
return (true, GetSuccessMessage());
else
- return (false, ValidatorMessageNull);
+ return (false, Resource.CantBeNull);
}
if (value is T v)
@@ -65,11 +64,11 @@ namespace Timeline.Models.Validation
}
else
{
- return (false, ValidatorMessageBadType);
+ return (false, string.Format(Resource.NotOfType, typeof(T).Name));
}
}
- protected static string GetSuccessMessage() => ValidatorMessageSuccess;
+ protected static string GetSuccessMessage() => Resource.ValidationPassed;
protected abstract (bool, string) DoValidate(T value);
}
@@ -99,7 +98,7 @@ namespace Timeline.Models.Validation
throw new ArgumentNullException(nameof(validatorType));
if (!typeof(IValidator).IsAssignableFrom(validatorType))
- throw new ArgumentException(ValidateWithAttributeExceptionNotValidator, nameof(validatorType));
+ throw new ArgumentException(Resource.ValidateWithAttributeExceptionNotValidator, nameof(validatorType));
try
{
@@ -107,7 +106,7 @@ namespace Timeline.Models.Validation
}
catch (Exception e)
{
- throw new ArgumentException(ValidateWithAttributeExceptionCreateFail, e);
+ throw new ArgumentException(Resource.ValidateWithAttributeExceptionCreateFail, e);
}
}
diff --git a/BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.Designer.cs b/BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.Designer.cs
deleted file mode 100644
index 70a1d605..00000000
--- a/BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.Designer.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Controllers {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class ControllerAuthExtensions {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal ControllerAuthExtensions() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Controllers.ControllerAuthExtensions", typeof(ControllerAuthExtensions).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Failed to get user id because User has no NameIdentifier claim..
- /// </summary>
- internal static string ExceptionNoUserIdentifierClaim {
- get {
- return ResourceManager.GetString("ExceptionNoUserIdentifierClaim", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Failed to get user id because NameIdentifier claim is not a number..
- /// </summary>
- internal static string ExceptionUserIdentifierClaimBadFormat {
- get {
- return ResourceManager.GetString("ExceptionUserIdentifierClaimBadFormat", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.resx b/BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.resx
deleted file mode 100644
index 03e6d95a..00000000
--- a/BackEnd/Timeline/Resources/Controllers/ControllerAuthExtensions.resx
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionNoUserIdentifierClaim" xml:space="preserve">
- <value>Failed to get user id because User has no NameIdentifier claim.</value>
- </data>
- <data name="ExceptionUserIdentifierClaimBadFormat" xml:space="preserve">
- <value>Failed to get user id because NameIdentifier claim is not a number.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Controllers/TimelineController.Designer.cs b/BackEnd/Timeline/Resources/Controllers/TimelineController.Designer.cs
deleted file mode 100644
index ae6414e6..00000000
--- a/BackEnd/Timeline/Resources/Controllers/TimelineController.Designer.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Controllers {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class TimelineController {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal TimelineController() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Controllers.TimelineController", typeof(TimelineController).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An unknown timeline visibility value. Can&apos;t convert it..
- /// </summary>
- internal static string ExceptionStringToVisibility {
- get {
- return ResourceManager.GetString("ExceptionStringToVisibility", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An unknown TimelineMemberOperationUserException is thrown. Can&apos;t recognize its inner exception. It is rethrown..
- /// </summary>
- internal static string LogUnknownTimelineMemberOperationUserException {
- get {
- return ResourceManager.GetString("LogUnknownTimelineMemberOperationUserException", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Controllers/TimelineController.resx b/BackEnd/Timeline/Resources/Controllers/TimelineController.resx
deleted file mode 100644
index 4cf3d6fb..00000000
--- a/BackEnd/Timeline/Resources/Controllers/TimelineController.resx
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionStringToVisibility" xml:space="preserve">
- <value>An unknown timeline visibility value. Can't convert it.</value>
- </data>
- <data name="LogUnknownTimelineMemberOperationUserException" xml:space="preserve">
- <value>An unknown TimelineMemberOperationUserException is thrown. Can't recognize its inner exception. It is rethrown.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Controllers/TokenController.Designer.cs b/BackEnd/Timeline/Resources/Controllers/TokenController.Designer.cs
deleted file mode 100644
index a7c2864b..00000000
--- a/BackEnd/Timeline/Resources/Controllers/TokenController.Designer.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Controllers {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class TokenController {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal TokenController() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Controllers.TokenController", typeof(TokenController).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The password is wrong..
- /// </summary>
- internal static string LogBadPassword {
- get {
- return ResourceManager.GetString("LogBadPassword", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A user failed to create a token..
- /// </summary>
- internal static string LogCreateFailure {
- get {
- return ResourceManager.GetString("LogCreateFailure", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A user succeeded to create a token..
- /// </summary>
- internal static string LogCreateSuccess {
- get {
- return ResourceManager.GetString("LogCreateSuccess", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The user does not exist..
- /// </summary>
- internal static string LogUserNotExist {
- get {
- return ResourceManager.GetString("LogUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The token is of bad format. It might not be created by the server..
- /// </summary>
- internal static string LogVerifyBadFormat {
- get {
- return ResourceManager.GetString("LogVerifyBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The token is expired..
- /// </summary>
- internal static string LogVerifyExpire {
- get {
- return ResourceManager.GetString("LogVerifyExpire", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A token failed to be verified..
- /// </summary>
- internal static string LogVerifyFailure {
- get {
- return ResourceManager.GetString("LogVerifyFailure", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Token has an old version. User might have update some info..
- /// </summary>
- internal static string LogVerifyOldVersion {
- get {
- return ResourceManager.GetString("LogVerifyOldVersion", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A token succeeded to be verified..
- /// </summary>
- internal static string LogVerifySuccess {
- get {
- return ResourceManager.GetString("LogVerifySuccess", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to User does not exist. Administrator might have deleted this user..
- /// </summary>
- internal static string LogVerifyUserNotExist {
- get {
- return ResourceManager.GetString("LogVerifyUserNotExist", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Controllers/TokenController.resx b/BackEnd/Timeline/Resources/Controllers/TokenController.resx
deleted file mode 100644
index 683d6cc9..00000000
--- a/BackEnd/Timeline/Resources/Controllers/TokenController.resx
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="LogBadPassword" xml:space="preserve">
- <value>The password is wrong.</value>
- </data>
- <data name="LogCreateFailure" xml:space="preserve">
- <value>A user failed to create a token.</value>
- </data>
- <data name="LogCreateSuccess" xml:space="preserve">
- <value>A user succeeded to create a token.</value>
- </data>
- <data name="LogUserNotExist" xml:space="preserve">
- <value>The user does not exist.</value>
- </data>
- <data name="LogVerifyBadFormat" xml:space="preserve">
- <value>The token is of bad format. It might not be created by the server.</value>
- </data>
- <data name="LogVerifyExpire" xml:space="preserve">
- <value>The token is expired.</value>
- </data>
- <data name="LogVerifyFailure" xml:space="preserve">
- <value>A token failed to be verified.</value>
- </data>
- <data name="LogVerifyOldVersion" xml:space="preserve">
- <value>Token has an old version. User might have update some info.</value>
- </data>
- <data name="LogVerifySuccess" xml:space="preserve">
- <value>A token succeeded to be verified.</value>
- </data>
- <data name="LogVerifyUserNotExist" xml:space="preserve">
- <value>User does not exist. Administrator might have deleted this user.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Controllers/UserAvatarController.Designer.cs b/BackEnd/Timeline/Resources/Controllers/UserAvatarController.Designer.cs
deleted file mode 100644
index b0c35ff9..00000000
--- a/BackEnd/Timeline/Resources/Controllers/UserAvatarController.Designer.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Controllers {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class UserAvatarController {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal UserAvatarController() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Controllers.UserAvatarController", typeof(UserAvatarController).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown AvatarDataException.ErrorReason value..
- /// </summary>
- internal static string ExceptionUnknownAvatarFormatError {
- get {
- return ResourceManager.GetString("ExceptionUnknownAvatarFormatError", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to delete a avatar of other user as a non-admin failed..
- /// </summary>
- internal static string LogDeleteForbid {
- get {
- return ResourceManager.GetString("LogDeleteForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to delete a avatar of a non-existent user failed..
- /// </summary>
- internal static string LogDeleteNotExist {
- get {
- return ResourceManager.GetString("LogDeleteNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Succeed to delete a avatar of a user..
- /// </summary>
- internal static string LogDeleteSuccess {
- get {
- return ResourceManager.GetString("LogDeleteSuccess", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to get a avatar of a non-existent user failed..
- /// </summary>
- internal static string LogGetUserNotExist {
- get {
- return ResourceManager.GetString("LogGetUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to put a avatar of other user as a non-admin failed..
- /// </summary>
- internal static string LogPutForbid {
- get {
- return ResourceManager.GetString("LogPutForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Succeed to put a avatar of a user..
- /// </summary>
- internal static string LogPutSuccess {
- get {
- return ResourceManager.GetString("LogPutSuccess", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to put a avatar of a bad format failed..
- /// </summary>
- internal static string LogPutUserBadFormat {
- get {
- return ResourceManager.GetString("LogPutUserBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to put a avatar of a non-existent user failed..
- /// </summary>
- internal static string LogPutUserNotExist {
- get {
- return ResourceManager.GetString("LogPutUserNotExist", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Controllers/UserAvatarController.resx b/BackEnd/Timeline/Resources/Controllers/UserAvatarController.resx
deleted file mode 100644
index 864d96c0..00000000
--- a/BackEnd/Timeline/Resources/Controllers/UserAvatarController.resx
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionUnknownAvatarFormatError" xml:space="preserve">
- <value>Unknown AvatarDataException.ErrorReason value.</value>
- </data>
- <data name="LogDeleteForbid" xml:space="preserve">
- <value>Attempt to delete a avatar of other user as a non-admin failed.</value>
- </data>
- <data name="LogDeleteNotExist" xml:space="preserve">
- <value>Attempt to delete a avatar of a non-existent user failed.</value>
- </data>
- <data name="LogDeleteSuccess" xml:space="preserve">
- <value>Succeed to delete a avatar of a user.</value>
- </data>
- <data name="LogGetUserNotExist" xml:space="preserve">
- <value>Attempt to get a avatar of a non-existent user failed.</value>
- </data>
- <data name="LogPutForbid" xml:space="preserve">
- <value>Attempt to put a avatar of other user as a non-admin failed.</value>
- </data>
- <data name="LogPutSuccess" xml:space="preserve">
- <value>Succeed to put a avatar of a user.</value>
- </data>
- <data name="LogPutUserBadFormat" xml:space="preserve">
- <value>Attempt to put a avatar of a bad format failed.</value>
- </data>
- <data name="LogPutUserNotExist" xml:space="preserve">
- <value>Attempt to put a avatar of a non-existent user failed.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Controllers/UserController.Designer.cs b/BackEnd/Timeline/Resources/Controllers/UserController.Designer.cs
deleted file mode 100644
index c8067614..00000000
--- a/BackEnd/Timeline/Resources/Controllers/UserController.Designer.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Controllers {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class UserController {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal UserController() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Controllers.UserController", typeof(UserController).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown PutResult..
- /// </summary>
- internal static string ExceptionUnknownPutResult {
- get {
- return ResourceManager.GetString("ExceptionUnknownPutResult", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to change password with wrong old password failed..
- /// </summary>
- internal static string LogChangePasswordBadPassword {
- get {
- return ResourceManager.GetString("LogChangePasswordBadPassword", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to change a user&apos;s username to a existent one failed..
- /// </summary>
- internal static string LogChangeUsernameConflict {
- get {
- return ResourceManager.GetString("LogChangeUsernameConflict", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to change a username of a user that does not exist failed..
- /// </summary>
- internal static string LogChangeUsernameNotExist {
- get {
- return ResourceManager.GetString("LogChangeUsernameNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to retrieve info of a user that does not exist failed..
- /// </summary>
- internal static string LogGetUserNotExist {
- get {
- return ResourceManager.GetString("LogGetUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to patch a user that does not exist failed..
- /// </summary>
- internal static string LogPatchUserNotExist {
- get {
- return ResourceManager.GetString("LogPatchUserNotExist", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Controllers/UserController.resx b/BackEnd/Timeline/Resources/Controllers/UserController.resx
deleted file mode 100644
index 0bdf4845..00000000
--- a/BackEnd/Timeline/Resources/Controllers/UserController.resx
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionUnknownPutResult" xml:space="preserve">
- <value>Unknown PutResult.</value>
- </data>
- <data name="LogChangePasswordBadPassword" xml:space="preserve">
- <value>Attempt to change password with wrong old password failed.</value>
- </data>
- <data name="LogChangeUsernameConflict" xml:space="preserve">
- <value>Attempt to change a user's username to a existent one failed.</value>
- </data>
- <data name="LogChangeUsernameNotExist" xml:space="preserve">
- <value>Attempt to change a username of a user that does not exist failed.</value>
- </data>
- <data name="LogGetUserNotExist" xml:space="preserve">
- <value>Attempt to retrieve info of a user that does not exist failed.</value>
- </data>
- <data name="LogPatchUserNotExist" xml:space="preserve">
- <value>Attempt to patch a user that does not exist failed.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Entities.resx b/BackEnd/Timeline/Resources/Entities.resx
deleted file mode 100644
index 1538b533..00000000
--- a/BackEnd/Timeline/Resources/Entities.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionOnlySqliteSupported" xml:space="preserve">
- <value>Only sqlite is supported.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Filters.Designer.cs b/BackEnd/Timeline/Resources/Filters.Designer.cs
deleted file mode 100644
index dedfe498..00000000
--- a/BackEnd/Timeline/Resources/Filters.Designer.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Filters {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Filters() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Filters", typeof(Filters).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You apply a SelfOrAdminAttribute on an action, but there is no user. Try add AuthorizeAttribute..
- /// </summary>
- internal static string LogSelfOrAdminNoUser {
- get {
- return ResourceManager.GetString("LogSelfOrAdminNoUser", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You apply a SelfOrAdminAttribute on an action, but it does not have a model named username..
- /// </summary>
- internal static string LogSelfOrAdminNoUsername {
- get {
- return ResourceManager.GetString("LogSelfOrAdminNoUsername", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You apply a SelfOrAdminAttribute on an action, found a model named username, but it is not string..
- /// </summary>
- internal static string LogSelfOrAdminUsernameNotString {
- get {
- return ResourceManager.GetString("LogSelfOrAdminUsernameNotString", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Filters.resx b/BackEnd/Timeline/Resources/Filters.resx
deleted file mode 100644
index 22620889..00000000
--- a/BackEnd/Timeline/Resources/Filters.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="LogSelfOrAdminNoUser" xml:space="preserve">
- <value>You apply a SelfOrAdminAttribute on an action, but there is no user. Try add AuthorizeAttribute.</value>
- </data>
- <data name="LogSelfOrAdminNoUsername" xml:space="preserve">
- <value>You apply a SelfOrAdminAttribute on an action, but it does not have a model named username.</value>
- </data>
- <data name="LogSelfOrAdminUsernameNotString" xml:space="preserve">
- <value>You apply a SelfOrAdminAttribute on an action, found a model named username, but it is not string.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Messages.Designer.cs b/BackEnd/Timeline/Resources/Messages.Designer.cs
deleted file mode 100644
index c6b7d5e7..00000000
--- a/BackEnd/Timeline/Resources/Messages.Designer.cs
+++ /dev/null
@@ -1,414 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Messages {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Messages() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Messages", typeof(Messages).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Body is too big. It can&apos;t be bigger than {0}..
- /// </summary>
- internal static string Common_Content_TooBig {
- get {
- return ResourceManager.GetString("Common_Content_TooBig", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Actual body length is bigger than it in header..
- /// </summary>
- internal static string Common_Content_UnmatchedLength_Bigger {
- get {
- return ResourceManager.GetString("Common_Content_UnmatchedLength_Bigger", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Actual body length is smaller than it in header..
- /// </summary>
- internal static string Common_Content_UnmatchedLength_Smaller {
- get {
- return ResourceManager.GetString("Common_Content_UnmatchedLength_Smaller", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You have no permission to do the operation..
- /// </summary>
- internal static string Common_Forbid {
- get {
- return ResourceManager.GetString("Common_Forbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You are not the resource owner..
- /// </summary>
- internal static string Common_Forbid_NotSelf {
- get {
- return ResourceManager.GetString("Common_Forbid_NotSelf", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Length is missing or of bad format..
- /// </summary>
- internal static string Common_Header_ContentLength_Missing {
- get {
- return ResourceManager.GetString("Common_Header_ContentLength_Missing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Length must not be 0..
- /// </summary>
- internal static string Common_Header_ContentLength_Zero {
- get {
- return ResourceManager.GetString("Common_Header_ContentLength_Zero", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Type is missing..
- /// </summary>
- internal static string Common_Header_ContentType_Missing {
- get {
- return ResourceManager.GetString("Common_Header_ContentType_Missing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header If-Non-Match is of bad format..
- /// </summary>
- internal static string Common_Header_IfNonMatch_BadFormat {
- get {
- return ResourceManager.GetString("Common_Header_IfNonMatch_BadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Model is of bad format..
- /// </summary>
- internal static string Common_InvalidModel {
- get {
- return ResourceManager.GetString("Common_InvalidModel", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The api endpoint you request is unknown. You might get the wrong api entry..
- /// </summary>
- internal static string Common_UnknownEndpoint {
- get {
- return ResourceManager.GetString("Common_UnknownEndpoint", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown type of post content..
- /// </summary>
- internal static string TimelineController_ContentUnknownType {
- get {
- return ResourceManager.GetString("TimelineController_ContentUnknownType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Data field is not a valid base64 string in image content..
- /// </summary>
- internal static string TimelineController_ImageContentDataNotBase64 {
- get {
- return ResourceManager.GetString("TimelineController_ImageContentDataNotBase64", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Data field is not a valid image after base64 decoding in image content..
- /// </summary>
- internal static string TimelineController_ImageContentDataNotImage {
- get {
- return ResourceManager.GetString("TimelineController_ImageContentDataNotImage", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Data field is required for image content..
- /// </summary>
- internal static string TimelineController_ImageContentDataRequired {
- get {
- return ResourceManager.GetString("TimelineController_ImageContentDataRequired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The user to set as member does not exist..
- /// </summary>
- internal static string TimelineController_MemberPut_NotExist {
- get {
- return ResourceManager.GetString("TimelineController_MemberPut_NotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A timeline with given name already exists..
- /// </summary>
- internal static string TimelineController_NameConflict {
- get {
- return ResourceManager.GetString("TimelineController_NameConflict", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The timeline with given name does not exist..
- /// </summary>
- internal static string TimelineController_NotExist {
- get {
- return ResourceManager.GetString("TimelineController_NotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The post of that type has no data..
- /// </summary>
- internal static string TimelineController_PostNoData {
- get {
- return ResourceManager.GetString("TimelineController_PostNoData", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The post to operate on does not exist..
- /// </summary>
- internal static string TimelineController_PostNotExist {
- get {
- return ResourceManager.GetString("TimelineController_PostNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The user specified by query param &quot;relate&quot; does not exist..
- /// </summary>
- internal static string TimelineController_QueryRelateNotExist {
- get {
- return ResourceManager.GetString("TimelineController_QueryRelateNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to &apos;{0}&apos; is an unkown visibility in the query parameter &apos;visibility&apos;. .
- /// </summary>
- internal static string TimelineController_QueryVisibilityUnknown {
- get {
- return ResourceManager.GetString("TimelineController_QueryVisibilityUnknown", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Text field is required for text content..
- /// </summary>
- internal static string TimelineController_TextContentTextRequired {
- get {
- return ResourceManager.GetString("TimelineController_TextContentTextRequired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Username or password is invalid..
- /// </summary>
- internal static string TokenController_Create_BadCredential {
- get {
- return ResourceManager.GetString("TokenController_Create_BadCredential", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The token is of bad format. It might not be created by the server..
- /// </summary>
- internal static string TokenController_Verify_BadFormat {
- get {
- return ResourceManager.GetString("TokenController_Verify_BadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Token has an old version. User might have update some info..
- /// </summary>
- internal static string TokenController_Verify_OldVersion {
- get {
- return ResourceManager.GetString("TokenController_Verify_OldVersion", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The token is expired..
- /// </summary>
- internal static string TokenController_Verify_TimeExpired {
- get {
- return ResourceManager.GetString("TokenController_Verify_TimeExpired", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to User does not exist. Administrator might have deleted this user..
- /// </summary>
- internal static string TokenController_Verify_UserNotExist {
- get {
- return ResourceManager.GetString("TokenController_Verify_UserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image is not a square..
- /// </summary>
- internal static string UserAvatar_BadFormat_BadSize {
- get {
- return ResourceManager.GetString("UserAvatar_BadFormat_BadSize", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image decode failed..
- /// </summary>
- internal static string UserAvatar_BadFormat_CantDecode {
- get {
- return ResourceManager.GetString("UserAvatar_BadFormat_CantDecode", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image format does not match the one in header..
- /// </summary>
- internal static string UserAvatar_BadFormat_UnmatchedFormat {
- get {
- return ResourceManager.GetString("UserAvatar_BadFormat_UnmatchedFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The user to operate on does not exist..
- /// </summary>
- internal static string UserCommon_NotExist {
- get {
- return ResourceManager.GetString("UserCommon_NotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Old password is wrong..
- /// </summary>
- internal static string UserController_ChangePassword_BadOldPassword {
- get {
- return ResourceManager.GetString("UserController_ChangePassword_BadOldPassword", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You can&apos;t change permission of root user..
- /// </summary>
- internal static string UserController_ChangePermission_RootUser {
- get {
- return ResourceManager.GetString("UserController_ChangePermission_RootUser", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You can&apos;t delete root user..
- /// </summary>
- internal static string UserController_Delete_RootUser {
- get {
- return ResourceManager.GetString("UserController_Delete_RootUser", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You can&apos;t set permission unless you are administrator..
- /// </summary>
- internal static string UserController_Patch_Forbid_Administrator {
- get {
- return ResourceManager.GetString("UserController_Patch_Forbid_Administrator", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You can&apos;t set password unless you are administrator. If you want to change password, use /userop/changepassword ..
- /// </summary>
- internal static string UserController_Patch_Forbid_Password {
- get {
- return ResourceManager.GetString("UserController_Patch_Forbid_Password", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You can&apos;t set username unless you are administrator..
- /// </summary>
- internal static string UserController_Patch_Forbid_Username {
- get {
- return ResourceManager.GetString("UserController_Patch_Forbid_Username", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A user with given username already exists..
- /// </summary>
- internal static string UserController_UsernameConflict {
- get {
- return ResourceManager.GetString("UserController_UsernameConflict", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Messages.resx b/BackEnd/Timeline/Resources/Messages.resx
deleted file mode 100644
index 2386d1eb..00000000
--- a/BackEnd/Timeline/Resources/Messages.resx
+++ /dev/null
@@ -1,237 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="Common_Content_TooBig" xml:space="preserve">
- <value>Body is too big. It can't be bigger than {0}.</value>
- </data>
- <data name="Common_Content_UnmatchedLength_Bigger" xml:space="preserve">
- <value>Actual body length is bigger than it in header.</value>
- </data>
- <data name="Common_Content_UnmatchedLength_Smaller" xml:space="preserve">
- <value>Actual body length is smaller than it in header.</value>
- </data>
- <data name="Common_Forbid" xml:space="preserve">
- <value>You have no permission to do the operation.</value>
- </data>
- <data name="Common_Forbid_NotSelf" xml:space="preserve">
- <value>You are not the resource owner.</value>
- </data>
- <data name="Common_Header_ContentLength_Missing" xml:space="preserve">
- <value>Header Content-Length is missing or of bad format.</value>
- </data>
- <data name="Common_Header_ContentLength_Zero" xml:space="preserve">
- <value>Header Content-Length must not be 0.</value>
- </data>
- <data name="Common_Header_ContentType_Missing" xml:space="preserve">
- <value>Header Content-Type is missing.</value>
- </data>
- <data name="Common_Header_IfNonMatch_BadFormat" xml:space="preserve">
- <value>Header If-Non-Match is of bad format.</value>
- </data>
- <data name="Common_InvalidModel" xml:space="preserve">
- <value>Model is of bad format.</value>
- </data>
- <data name="Common_UnknownEndpoint" xml:space="preserve">
- <value>The api endpoint you request is unknown. You might get the wrong api entry.</value>
- </data>
- <data name="TimelineController_ContentUnknownType" xml:space="preserve">
- <value>Unknown type of post content.</value>
- </data>
- <data name="TimelineController_ImageContentDataNotBase64" xml:space="preserve">
- <value>Data field is not a valid base64 string in image content.</value>
- </data>
- <data name="TimelineController_ImageContentDataNotImage" xml:space="preserve">
- <value>Data field is not a valid image after base64 decoding in image content.</value>
- </data>
- <data name="TimelineController_ImageContentDataRequired" xml:space="preserve">
- <value>Data field is required for image content.</value>
- </data>
- <data name="TimelineController_MemberPut_NotExist" xml:space="preserve">
- <value>The user to set as member does not exist.</value>
- </data>
- <data name="TimelineController_NameConflict" xml:space="preserve">
- <value>A timeline with given name already exists.</value>
- </data>
- <data name="TimelineController_NotExist" xml:space="preserve">
- <value>The timeline with given name does not exist.</value>
- </data>
- <data name="TimelineController_PostNoData" xml:space="preserve">
- <value>The post of that type has no data.</value>
- </data>
- <data name="TimelineController_PostNotExist" xml:space="preserve">
- <value>The post to operate on does not exist.</value>
- </data>
- <data name="TimelineController_QueryRelateNotExist" xml:space="preserve">
- <value>The user specified by query param "relate" does not exist.</value>
- </data>
- <data name="TimelineController_QueryVisibilityUnknown" xml:space="preserve">
- <value>'{0}' is an unkown visibility in the query parameter 'visibility'. </value>
- </data>
- <data name="TimelineController_TextContentTextRequired" xml:space="preserve">
- <value>Text field is required for text content.</value>
- </data>
- <data name="TokenController_Create_BadCredential" xml:space="preserve">
- <value>Username or password is invalid.</value>
- </data>
- <data name="TokenController_Verify_BadFormat" xml:space="preserve">
- <value>The token is of bad format. It might not be created by the server.</value>
- </data>
- <data name="TokenController_Verify_OldVersion" xml:space="preserve">
- <value>Token has an old version. User might have update some info.</value>
- </data>
- <data name="TokenController_Verify_TimeExpired" xml:space="preserve">
- <value>The token is expired.</value>
- </data>
- <data name="TokenController_Verify_UserNotExist" xml:space="preserve">
- <value>User does not exist. Administrator might have deleted this user.</value>
- </data>
- <data name="UserAvatar_BadFormat_BadSize" xml:space="preserve">
- <value>Image is not a square.</value>
- </data>
- <data name="UserAvatar_BadFormat_CantDecode" xml:space="preserve">
- <value>Image decode failed.</value>
- </data>
- <data name="UserAvatar_BadFormat_UnmatchedFormat" xml:space="preserve">
- <value>Image format does not match the one in header.</value>
- </data>
- <data name="UserCommon_NotExist" xml:space="preserve">
- <value>The user to operate on does not exist.</value>
- </data>
- <data name="UserController_ChangePassword_BadOldPassword" xml:space="preserve">
- <value>Old password is wrong.</value>
- </data>
- <data name="UserController_ChangePermission_RootUser" xml:space="preserve">
- <value>You can't change permission of root user.</value>
- </data>
- <data name="UserController_Delete_RootUser" xml:space="preserve">
- <value>You can't delete root user.</value>
- </data>
- <data name="UserController_Patch_Forbid_Administrator" xml:space="preserve">
- <value>You can't set permission unless you are administrator.</value>
- </data>
- <data name="UserController_Patch_Forbid_Password" xml:space="preserve">
- <value>You can't set password unless you are administrator. If you want to change password, use /userop/changepassword .</value>
- </data>
- <data name="UserController_Patch_Forbid_Username" xml:space="preserve">
- <value>You can't set username unless you are administrator.</value>
- </data>
- <data name="UserController_UsernameConflict" xml:space="preserve">
- <value>A user with given username already exists.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Models/Http/Exception.Designer.cs b/BackEnd/Timeline/Resources/Models/Http/Exception.Designer.cs
deleted file mode 100644
index 19f42793..00000000
--- a/BackEnd/Timeline/Resources/Models/Http/Exception.Designer.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Models.Http {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Exception {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Exception() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Models.Http.Exception", typeof(Exception).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to No action context currently, can&apos;t fill urls in value resolver..
- /// </summary>
- internal static string ActionContextNull {
- get {
- return ResourceManager.GetString("ActionContextNull", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown post content type..
- /// </summary>
- internal static string UnknownPostContentType {
- get {
- return ResourceManager.GetString("UnknownPostContentType", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Models/Http/Exception.resx b/BackEnd/Timeline/Resources/Models/Http/Exception.resx
deleted file mode 100644
index 3f7bddb6..00000000
--- a/BackEnd/Timeline/Resources/Models/Http/Exception.resx
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ActionContextNull" xml:space="preserve">
- <value>No action context currently, can't fill urls in value resolver.</value>
- </data>
- <data name="UnknownPostContentType" xml:space="preserve">
- <value>Unknown post content type.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Models/Validation/NameValidator.Designer.cs b/BackEnd/Timeline/Resources/Models/Validation/NameValidator.Designer.cs
deleted file mode 100644
index 3050049e..00000000
--- a/BackEnd/Timeline/Resources/Models/Validation/NameValidator.Designer.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Models.Validation {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class NameValidator {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal NameValidator() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Models.Validation.NameValidator", typeof(NameValidator).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to An empty string is not allowed..
- /// </summary>
- internal static string MessageEmptyString {
- get {
- return ResourceManager.GetString("MessageEmptyString", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Invalid character, only alphabet, digit, underscore and hyphen are allowed..
- /// </summary>
- internal static string MessageInvalidChar {
- get {
- return ResourceManager.GetString("MessageInvalidChar", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Too long, more than 26 characters is not premitted..
- /// </summary>
- internal static string MessageTooLong {
- get {
- return ResourceManager.GetString("MessageTooLong", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Name can&apos;t be of the same format of unique id..
- /// </summary>
- internal static string MessageUnqiueId {
- get {
- return ResourceManager.GetString("MessageUnqiueId", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Models/Validation/NameValidator.resx b/BackEnd/Timeline/Resources/Models/Validation/NameValidator.resx
deleted file mode 100644
index 5e7e1745..00000000
--- a/BackEnd/Timeline/Resources/Models/Validation/NameValidator.resx
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="MessageEmptyString" xml:space="preserve">
- <value>An empty string is not allowed.</value>
- </data>
- <data name="MessageInvalidChar" xml:space="preserve">
- <value>Invalid character, only alphabet, digit, underscore and hyphen are allowed.</value>
- </data>
- <data name="MessageTooLong" xml:space="preserve">
- <value>Too long, more than 26 characters is not premitted.</value>
- </data>
- <data name="MessageUnqiueId" xml:space="preserve">
- <value>Name can't be of the same format of unique id.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.Designer.cs b/BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.Designer.cs
deleted file mode 100644
index 522f305a..00000000
--- a/BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.Designer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Models.Validation {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class NicknameValidator {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal NicknameValidator() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Models.Validation.NicknameValidator", typeof(NicknameValidator).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Nickname is too long..
- /// </summary>
- internal static string MessageTooLong {
- get {
- return ResourceManager.GetString("MessageTooLong", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.resx b/BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.resx
deleted file mode 100644
index b191b505..00000000
--- a/BackEnd/Timeline/Resources/Models/Validation/NicknameValidator.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="MessageTooLong" xml:space="preserve">
- <value>Nickname is too long.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs b/BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs
deleted file mode 100644
index e16c1337..00000000
--- a/BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Services {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class TimelineService {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal TimelineService() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Services.TimelineService", typeof(TimelineService).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The number {0} username is invalid..
- /// </summary>
- internal static string ExceptionChangeMemberUsernameBadFormat {
- get {
- return ResourceManager.GetString("ExceptionChangeMemberUsernameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown post content type &quot;{0}&quot; is saved in database..
- /// </summary>
- internal static string ExceptionDatabaseUnknownContentType {
- get {
- return ResourceManager.GetString("ExceptionDatabaseUnknownContentType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The owner username of personal timeline is of bad format..
- /// </summary>
- internal static string ExceptionFindTimelineUsernameBadFormat {
- get {
- return ResourceManager.GetString("ExceptionFindTimelineUsernameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The data entry of the tag of the image post does not exist..
- /// </summary>
- internal static string ExceptionGetDataDataEntryNotExist {
- get {
- return ResourceManager.GetString("ExceptionGetDataDataEntryNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Can&apos;t get data of a non-image post..
- /// </summary>
- internal static string ExceptionGetDataNonImagePost {
- get {
- return ResourceManager.GetString("ExceptionGetDataNonImagePost", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The post has been deleted because content of entity is null..
- /// </summary>
- internal static string ExceptionPostDeleted {
- get {
- return ResourceManager.GetString("ExceptionPostDeleted", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The timeline name is of bad format..
- /// </summary>
- internal static string ExceptionTimelineNameBadFormat {
- get {
- return ResourceManager.GetString("ExceptionTimelineNameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The timeline with given name already exists..
- /// </summary>
- internal static string ExceptionTimelineNameConflict {
- get {
- return ResourceManager.GetString("ExceptionTimelineNameConflict", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image format type of the post does not exist in column &quot;extra_content&quot;. Normally this couldn&apos;t be possible because it should be saved when post was created. However, we now re-detect the format and save it..
- /// </summary>
- internal static string LogGetDataNoFormat {
- get {
- return ResourceManager.GetString("LogGetDataNoFormat", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Services/TimelineService.resx b/BackEnd/Timeline/Resources/Services/TimelineService.resx
deleted file mode 100644
index 9314f51b..00000000
--- a/BackEnd/Timeline/Resources/Services/TimelineService.resx
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionChangeMemberUsernameBadFormat" xml:space="preserve">
- <value>The number {0} username is invalid.</value>
- </data>
- <data name="ExceptionDatabaseUnknownContentType" xml:space="preserve">
- <value>Unknown post content type "{0}" is saved in database.</value>
- </data>
- <data name="ExceptionFindTimelineUsernameBadFormat" xml:space="preserve">
- <value>The owner username of personal timeline is of bad format.</value>
- </data>
- <data name="ExceptionGetDataDataEntryNotExist" xml:space="preserve">
- <value>The data entry of the tag of the image post does not exist.</value>
- </data>
- <data name="ExceptionGetDataNonImagePost" xml:space="preserve">
- <value>Can't get data of a non-image post.</value>
- </data>
- <data name="ExceptionTimelineNameBadFormat" xml:space="preserve">
- <value>The timeline name is of bad format.</value>
- </data>
- <data name="ExceptionTimelineNameConflict" xml:space="preserve">
- <value>The timeline with given name already exists.</value>
- </data>
- <data name="LogGetDataNoFormat" xml:space="preserve">
- <value>Image format type of the post does not exist in column "extra_content". Normally this couldn't be possible because it should be saved when post was created. However, we now re-detect the format and save it.</value>
- </data>
- <data name="ExceptionPostDeleted" xml:space="preserve">
- <value>The post has been deleted because content of entity is null.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs b/BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs
deleted file mode 100644
index 3c3c7e41..00000000
--- a/BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Services {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class UserTokenService {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal UserTokenService() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Services.UserTokenService", typeof(UserTokenService).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Jwt token key is not set in database. Maybe you forget to migrate the database..
- /// </summary>
- internal static string JwtKeyNotExist {
- get {
- return ResourceManager.GetString("JwtKeyNotExist", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Entities.Designer.cs b/BackEnd/Timeline/Routes/Resource.Designer.cs
index 5f286f23..1fbbb704 100644
--- a/BackEnd/Timeline/Resources/Entities.Designer.cs
+++ b/BackEnd/Timeline/Routes/Resource.Designer.cs
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Timeline.Resources {
+namespace Timeline.Routes {
using System;
@@ -22,14 +22,14 @@ namespace Timeline.Resources {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Entities {
+ internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Entities() {
+ internal Resource() {
}
/// <summary>
@@ -39,7 +39,7 @@ namespace Timeline.Resources {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Entities", typeof(Entities).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Routes.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -61,11 +61,11 @@ namespace Timeline.Resources {
}
/// <summary>
- /// Looks up a localized string similar to Only sqlite is supported..
+ /// Looks up a localized string similar to The api endpoint you request is unknown. You might get the wrong api entry..
/// </summary>
- internal static string ExceptionOnlySqliteSupported {
+ internal static string MessageUnknownEndpoint {
get {
- return ResourceManager.GetString("ExceptionOnlySqliteSupported", resourceCulture);
+ return ResourceManager.GetString("MessageUnknownEndpoint", resourceCulture);
}
}
}
diff --git a/BackEnd/Timeline/Resources/Services/UserTokenService.resx b/BackEnd/Timeline/Routes/Resource.resx
index 1ce78427..f7e2aec9 100644
--- a/BackEnd/Timeline/Resources/Services/UserTokenService.resx
+++ b/BackEnd/Timeline/Routes/Resource.resx
@@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="JwtKeyNotExist" xml:space="preserve">
- <value>Jwt token key is not set in database. Maybe you forget to migrate the database.</value>
+ <data name="MessageUnknownEndpoint" xml:space="preserve">
+ <value>The api endpoint you request is unknown. You might get the wrong api entry.</value>
</data>
</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs b/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs
index 25ec563c..d3f78fd9 100644
--- a/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs
+++ b/BackEnd/Timeline/Routes/UnknownEndpointMiddleware.cs
@@ -24,7 +24,9 @@ namespace Timeline.Routes
context.Response.StatusCode = StatusCodes.Status400BadRequest;
context.Response.ContentType = MediaTypeNames.Application.Json;
- var body = JsonSerializer.SerializeToUtf8Bytes(ErrorResponse.Common.UnknownEndpoint(), new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+ var body = JsonSerializer.SerializeToUtf8Bytes(
+ new CommonResponse(ErrorCodes.Common.UnknownEndpoint, Resource.MessageUnknownEndpoint),
+ new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
context.Response.ContentLength = body.Length;
await context.Response.Body.WriteAsync(body);
diff --git a/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs b/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs
index 37b55199..de70a9db 100644
--- a/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs
+++ b/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs
@@ -1,5 +1,4 @@
using Microsoft.EntityFrameworkCore;
-using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -10,74 +9,6 @@ using Timeline.Services.User;
namespace Timeline.Services.Api
{
- [Serializable]
- public class InvalidBookmarkException : Exception
- {
- public InvalidBookmarkException() { }
- public InvalidBookmarkException(string message) : base(message) { }
- public InvalidBookmarkException(string message, Exception inner) : base(message, inner) { }
- protected InvalidBookmarkException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-
- /// <summary>
- /// Service interface that manages timeline bookmarks.
- /// </summary>
- public interface IBookmarkTimelineService
- {
- /// <summary>
- /// Get bookmarks of a user.
- /// </summary>
- /// <param name="userId">User id of bookmark owner.</param>
- /// <returns>Id of Bookmark timelines in order.</returns>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
- Task<List<long>> GetBookmarks(long userId);
-
- /// <summary>
- /// Check if a timeline is a bookmark.
- /// </summary>
- /// <param name="userId">The user id.</param>
- /// <param name="timelineId">Timeline id.</param>
- /// <param name="checkUserExistence">If true it will throw when user does not exist.</param>
- /// <param name="checkTimelineExistence">If true it will throw when timeline does not exist.</param>
- /// <returns>True if timeline is a bookmark. Otherwise false.</returns>
- /// <exception cref="UserNotExistException">Throw if user does not exist and <paramref name="checkUserExistence"/> is true.</exception>
- /// <exception cref="TimelineNotExistException">Thrown if timeline does not exist and <paramref name="checkTimelineExistence"/> is true.</exception>
- Task<bool> IsBookmark(long userId, long timelineId, bool checkUserExistence = true, bool checkTimelineExistence = true);
-
- /// <summary>
- /// Add a bookmark to tail to a user.
- /// </summary>
- /// <param name="userId">User id of bookmark owner.</param>
- /// <param name="timelineId">Timeline id.</param>
- /// <returns>True if timeline is added to bookmark. False if it already is.</returns>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- Task<bool> AddBookmark(long userId, long timelineId);
-
- /// <summary>
- /// Remove a bookmark from a user.
- /// </summary>
- /// <param name="userId">User id of bookmark owner.</param>
- /// <param name="timelineId">Timeline id.</param>
- /// <returns>True if deletion is performed. False if bookmark does not exist.</returns>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- Task<bool> RemoveBookmark(long userId, long timelineId);
-
- /// <summary>
- /// Move bookmark to a new position.
- /// </summary>
- /// <param name="userId">User id of bookmark owner.</param>
- /// <param name="timelineId">Timeline name.</param>
- /// <param name="newPosition">New position. Starts at 1.</param>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="InvalidBookmarkException">Thrown when the timeline is not a bookmark.</exception>
- Task MoveBookmark(long userId, long timelineId, long newPosition);
- }
-
public class BookmarkTimelineService : IBookmarkTimelineService
{
private readonly DatabaseContext _database;
@@ -91,13 +22,10 @@ namespace Timeline.Services.Api
_timelineService = timelineService;
}
- public async Task<bool> AddBookmark(long userId, long timelineId)
+ public async Task<bool> AddBookmarkAsync(long userId, long timelineId)
{
- if (!await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
-
- if (!await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ await _userService.ThrowIfUserNotExist(userId);
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
if (await _database.BookmarkTimelines.AnyAsync(t => t.TimelineId == timelineId && t.UserId == userId))
return false;
@@ -113,34 +41,30 @@ namespace Timeline.Services.Api
return true;
}
- public async Task<List<long>> GetBookmarks(long userId)
+ public async Task<List<long>> GetBookmarksAsync(long userId)
{
- if (!await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
+ await _userService.ThrowIfUserNotExist(userId);
var entities = await _database.BookmarkTimelines.Where(t => t.UserId == userId).OrderBy(t => t.Rank).Select(t => new { t.TimelineId }).ToListAsync();
return entities.Select(e => e.TimelineId).ToList();
}
- public async Task<bool> IsBookmark(long userId, long timelineId, bool checkUserExistence = true, bool checkTimelineExistence = true)
+ public async Task<bool> IsBookmarkAsync(long userId, long timelineId, bool checkUserExistence = true, bool checkTimelineExistence = true)
{
- if (checkUserExistence && !await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
+ if (checkUserExistence)
+ await _userService.ThrowIfUserNotExist(userId);
- if (checkTimelineExistence && !await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ if (checkTimelineExistence)
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
return await _database.BookmarkTimelines.AnyAsync(b => b.TimelineId == timelineId && b.UserId == userId);
}
- public async Task MoveBookmark(long userId, long timelineId, long newPosition)
+ public async Task MoveBookmarkAsync(long userId, long timelineId, long newPosition)
{
- if (!await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
-
- if (!await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ await _userService.ThrowIfUserNotExist(userId);
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
var entity = await _database.BookmarkTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId && t.UserId == userId);
@@ -176,13 +100,10 @@ namespace Timeline.Services.Api
await transaction.CommitAsync();
}
- public async Task<bool> RemoveBookmark(long userId, long timelineId)
+ public async Task<bool> RemoveBookmarkAsync(long userId, long timelineId)
{
- if (!await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
-
- if (!await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ await _userService.ThrowIfUserNotExist(userId);
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
var entity = await _database.BookmarkTimelines.SingleOrDefaultAsync(t => t.UserId == userId && t.TimelineId == timelineId);
diff --git a/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs b/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs
index 8224f1fe..d4367e57 100644
--- a/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs
+++ b/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs
@@ -1,5 +1,4 @@
using Microsoft.EntityFrameworkCore;
-using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -9,72 +8,6 @@ using Timeline.Services.User;
namespace Timeline.Services.Api
{
-
- [Serializable]
- public class InvalidHighlightTimelineException : Exception
- {
- public InvalidHighlightTimelineException() { }
- public InvalidHighlightTimelineException(string message) : base(message) { }
- public InvalidHighlightTimelineException(string message, Exception inner) : base(message, inner) { }
- protected InvalidHighlightTimelineException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-
- /// <summary>
- /// Service that controls highlight timeline.
- /// </summary>
- public interface IHighlightTimelineService
- {
- /// <summary>
- /// Get all highlight timelines in order.
- /// </summary>
- /// <returns>Id list of all highlight timelines.</returns>
- Task<List<long>> GetHighlightTimelines();
-
- /// <summary>
- /// Check if a timeline is highlight timeline.
- /// </summary>
- /// <param name="timelineId">Timeline id.</param>
- /// <param name="checkTimelineExistence">If true it will throw if timeline does not exist.</param>
- /// <returns>True if timeline is highlight. Otherwise false.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist and <paramref name="checkTimelineExistence"/> is true.</exception>
- Task<bool> IsHighlightTimeline(long timelineId, bool checkTimelineExistence = true);
-
- /// <summary>
- /// Add a timeline to highlight list.
- /// </summary>
- /// <param name="timelineId">The timeline id.</param>
- /// <param name="operatorId">The user id of operator.</param>
- /// <returns>True if timeline is actually added to highligh. False if it already is.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline with given id does not exist.</exception>
- /// <exception cref="UserNotExistException">Thrown when user with given operator id does not exist.</exception>
- Task<bool> AddHighlightTimeline(long timelineId, long? operatorId);
-
- /// <summary>
- /// Remove a timeline from highlight list.
- /// </summary>
- /// <param name="timelineId">The timeline id.</param>
- /// <param name="operatorId">The user id of operator.</param>
- /// <returns>True if deletion is actually performed. Otherwise false (timeline was not in the list).</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline with given id does not exist.</exception>
- /// <exception cref="UserNotExistException">Thrown when user with given operator id does not exist.</exception>
- Task<bool> RemoveHighlightTimeline(long timelineId, long? operatorId);
-
- /// <summary>
- /// Move a highlight timeline to a new position.
- /// </summary>
- /// <param name="timelineId">The timeline name.</param>
- /// <param name="newPosition">The new position. Starts at 1.</param>
- /// <exception cref="TimelineNotExistException">Thrown when timeline with given id does not exist.</exception>
- /// <exception cref="InvalidHighlightTimelineException">Thrown when given timeline is not a highlight timeline.</exception>
- /// <remarks>
- /// If <paramref name="newPosition"/> is smaller than 1. Then move the timeline to head.
- /// If <paramref name="newPosition"/> is bigger than total count. Then move the timeline to tail.
- /// </remarks>
- Task MoveHighlightTimeline(long timelineId, long newPosition);
- }
-
public class HighlightTimelineService : IHighlightTimelineService
{
private readonly DatabaseContext _database;
@@ -90,14 +23,13 @@ namespace Timeline.Services.Api
_clock = clock;
}
- public async Task<bool> AddHighlightTimeline(long timelineId, long? operatorId)
+ public async Task<bool> AddHighlightTimelineAsync(long timelineId, long? operatorId)
{
- if (!await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
- if (operatorId.HasValue && !await _userService.CheckUserExistenceAsync(operatorId.Value))
+ if (operatorId.HasValue)
{
- throw new UserNotExistException(null, operatorId.Value, "User with given operator id does not exist.", null);
+ await _userService.ThrowIfUserNotExist(operatorId.Value);
}
var alreadyIs = await _database.HighlightTimelines.AnyAsync(t => t.TimelineId == timelineId);
@@ -109,21 +41,20 @@ namespace Timeline.Services.Api
return true;
}
- public async Task<List<long>> GetHighlightTimelines()
+ public async Task<List<long>> GetHighlightTimelinesAsync()
{
var entities = await _database.HighlightTimelines.OrderBy(t => t.Order).Select(t => new { t.TimelineId }).ToListAsync();
return entities.Select(e => e.TimelineId).ToList();
}
- public async Task<bool> RemoveHighlightTimeline(long timelineId, long? operatorId)
+ public async Task<bool> RemoveHighlightTimelineAsync(long timelineId, long? operatorId)
{
- if (!await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
- if (operatorId.HasValue && !await _userService.CheckUserExistenceAsync(operatorId.Value))
+ if (operatorId.HasValue)
{
- throw new UserNotExistException(null, operatorId.Value, "User with given operator id does not exist.", null);
+ await _userService.ThrowIfUserNotExist(operatorId.Value);
}
var entity = await _database.HighlightTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId);
@@ -144,10 +75,9 @@ namespace Timeline.Services.Api
return true;
}
- public async Task MoveHighlightTimeline(long timelineId, long newPosition)
+ public async Task MoveHighlightTimelineAsync(long timelineId, long newPosition)
{
- if (!await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
var entity = await _database.HighlightTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId);
@@ -183,10 +113,10 @@ namespace Timeline.Services.Api
await transaction.CommitAsync();
}
- public async Task<bool> IsHighlightTimeline(long timelineId, bool checkTimelineExistence = true)
+ public async Task<bool> IsHighlightTimelineAsync(long timelineId, bool checkTimelineExistence = true)
{
- if (checkTimelineExistence && !await _timelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ if (checkTimelineExistence)
+ await _timelineService.ThrowIfTimelineNotExist(timelineId);
return await _database.HighlightTimelines.AnyAsync(t => t.TimelineId == timelineId);
}
diff --git a/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs b/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs
new file mode 100644
index 00000000..c3cda450
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs
@@ -0,0 +1,62 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Timeline.Services.Api
+{
+ /// <summary>
+ /// Service interface that manages timeline bookmarks.
+ /// </summary>
+ public interface IBookmarkTimelineService
+ {
+ /// <summary>
+ /// Get bookmarks of a user.
+ /// </summary>
+ /// <param name="userId">User id of bookmark owner.</param>
+ /// <returns>Id of Bookmark timelines in order.</returns>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
+ Task<List<long>> GetBookmarksAsync(long userId);
+
+ /// <summary>
+ /// Check if a timeline is a bookmark.
+ /// </summary>
+ /// <param name="userId">The user id.</param>
+ /// <param name="timelineId">Timeline id.</param>
+ /// <param name="checkUserExistence">If true it will throw when user does not exist.</param>
+ /// <param name="checkTimelineExistence">If true it will throw when timeline does not exist.</param>
+ /// <returns>True if timeline is a bookmark. Otherwise false.</returns>
+ /// <exception cref="EntityNotExistException">Throw if user does not exist and <paramref name="checkUserExistence"/> is true.</exception>
+ /// <exception cref="EntityNotExistException">Thrown if timeline does not exist and <paramref name="checkTimelineExistence"/> is true.</exception>
+ Task<bool> IsBookmarkAsync(long userId, long timelineId, bool checkUserExistence = true, bool checkTimelineExistence = true);
+
+ /// <summary>
+ /// Add a bookmark to tail to a user.
+ /// </summary>
+ /// <param name="userId">User id of bookmark owner.</param>
+ /// <param name="timelineId">Timeline id.</param>
+ /// <returns>True if timeline is added to bookmark. False if it already is.</returns>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ Task<bool> AddBookmarkAsync(long userId, long timelineId);
+
+ /// <summary>
+ /// Remove a bookmark from a user.
+ /// </summary>
+ /// <param name="userId">User id of bookmark owner.</param>
+ /// <param name="timelineId">Timeline id.</param>
+ /// <returns>True if deletion is performed. False if bookmark does not exist.</returns>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ Task<bool> RemoveBookmarkAsync(long userId, long timelineId);
+
+ /// <summary>
+ /// Move bookmark to a new position.
+ /// </summary>
+ /// <param name="userId">User id of bookmark owner.</param>
+ /// <param name="timelineId">Timeline name.</param>
+ /// <param name="newPosition">New position. Starts at 1.</param>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="InvalidBookmarkException">Thrown when the timeline is not a bookmark.</exception>
+ Task MoveBookmarkAsync(long userId, long timelineId, long newPosition);
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs b/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs
new file mode 100644
index 00000000..56a0fb35
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs
@@ -0,0 +1,59 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Timeline.Services.Api
+{
+ /// <summary>
+ /// Service that controls highlight timeline.
+ /// </summary>
+ public interface IHighlightTimelineService
+ {
+ /// <summary>
+ /// Get all highlight timelines in order.
+ /// </summary>
+ /// <returns>Id list of all highlight timelines.</returns>
+ Task<List<long>> GetHighlightTimelinesAsync();
+
+ /// <summary>
+ /// Check if a timeline is highlight timeline.
+ /// </summary>
+ /// <param name="timelineId">Timeline id.</param>
+ /// <param name="checkTimelineExistence">If true it will throw if timeline does not exist.</param>
+ /// <returns>True if timeline is highlight. Otherwise false.</returns>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist and <paramref name="checkTimelineExistence"/> is true.</exception>
+ Task<bool> IsHighlightTimelineAsync(long timelineId, bool checkTimelineExistence = true);
+
+ /// <summary>
+ /// Add a timeline to highlight list.
+ /// </summary>
+ /// <param name="timelineId">The timeline id.</param>
+ /// <param name="operatorId">The user id of operator.</param>
+ /// <returns>True if timeline is actually added to highligh. False if it already is.</returns>
+ /// <exception cref="EntityNotExistException">Thrown when timeline with given id does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user with given operator id does not exist.</exception>
+ Task<bool> AddHighlightTimelineAsync(long timelineId, long? operatorId);
+
+ /// <summary>
+ /// Remove a timeline from highlight list.
+ /// </summary>
+ /// <param name="timelineId">The timeline id.</param>
+ /// <param name="operatorId">The user id of operator.</param>
+ /// <returns>True if deletion is actually performed. Otherwise false (timeline was not in the list).</returns>
+ /// <exception cref="EntityNotExistException">Thrown when timeline with given id does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user with given operator id does not exist.</exception>
+ Task<bool> RemoveHighlightTimelineAsync(long timelineId, long? operatorId);
+
+ /// <summary>
+ /// Move a highlight timeline to a new position.
+ /// </summary>
+ /// <param name="timelineId">The timeline name.</param>
+ /// <param name="newPosition">The new position. Starts at 1.</param>
+ /// <exception cref="EntityNotExistException">Thrown when timeline with given id does not exist.</exception>
+ /// <exception cref="InvalidHighlightTimelineException">Thrown when given timeline is not a highlight timeline.</exception>
+ /// <remarks>
+ /// If <paramref name="newPosition"/> is smaller than 1. Then move the timeline to head.
+ /// If <paramref name="newPosition"/> is bigger than total count. Then move the timeline to tail.
+ /// </remarks>
+ Task MoveHighlightTimelineAsync(long timelineId, long newPosition);
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/ISearchService.cs b/BackEnd/Timeline/Services/Api/ISearchService.cs
new file mode 100644
index 00000000..d8b4bb44
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/ISearchService.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Threading.Tasks;
+using Timeline.Entities;
+
+namespace Timeline.Services.Api
+{
+ public interface ISearchService
+ {
+ /// <summary>
+ /// Search timelines whose name or title contains query string.
+ /// </summary>
+ /// <param name="query">String to contain.</param>
+ /// <returns>Search results.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when <paramref name="query"/> is null.</exception>
+ /// <exception cref="ArgumentException">Thrown when <paramref name="query"/> is empty.</exception>
+ /// <remarks>
+ /// Implementation should promise high score is at first.
+ /// </remarks>
+ Task<SearchResult<TimelineEntity>> SearchTimelineAsync(string query);
+
+ /// <summary>
+ /// Search users whose username or nickname contains query string.
+ /// </summary>
+ /// <param name="query">String to contain.</param>
+ /// <returns>Search results.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when <paramref name="query"/> is null.</exception>
+ /// <exception cref="ArgumentException">Thrown when <paramref name="query"/> is empty.</exception>
+ /// <remarks>
+ /// Implementation should promise high score is at first.
+ /// </remarks>
+ Task<SearchResult<UserEntity>> SearchUserAsync(string query);
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs b/BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs
new file mode 100644
index 00000000..39572b38
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace Timeline.Services.Api
+{
+ [Serializable]
+ public class InvalidBookmarkException : Exception
+ {
+ public InvalidBookmarkException() { }
+ public InvalidBookmarkException(string message) : base(message) { }
+ public InvalidBookmarkException(string message, Exception inner) : base(message, inner) { }
+ protected InvalidBookmarkException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs b/BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs
new file mode 100644
index 00000000..13b04a6b
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace Timeline.Services.Api
+{
+ [Serializable]
+ public class InvalidHighlightTimelineException : Exception
+ {
+ public InvalidHighlightTimelineException() { }
+ public InvalidHighlightTimelineException(string message) : base(message) { }
+ public InvalidHighlightTimelineException(string message, Exception inner) : base(message, inner) { }
+ protected InvalidHighlightTimelineException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/SearchResult.cs b/BackEnd/Timeline/Services/Api/SearchResult.cs
new file mode 100644
index 00000000..7c95ae5d
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/SearchResult.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+
+namespace Timeline.Services.Api
+{
+ public class SearchResult<TItem>
+ {
+#pragma warning disable CA2227 // Collection properties should be read only
+ public List<SearchResultItem<TItem>> Items { get; set; } = new();
+#pragma warning restore CA2227 // Collection properties should be read only
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/SearchResultItem.cs b/BackEnd/Timeline/Services/Api/SearchResultItem.cs
new file mode 100644
index 00000000..ac40281f
--- /dev/null
+++ b/BackEnd/Timeline/Services/Api/SearchResultItem.cs
@@ -0,0 +1,18 @@
+namespace Timeline.Services.Api
+{
+ public class SearchResultItem<TItem>
+ {
+ public SearchResultItem(TItem item, int score)
+ {
+ Item = item;
+ Score = score;
+ }
+
+ public TItem Item { get; set; } = default!;
+
+ /// <summary>
+ /// Bigger is better.
+ /// </summary>
+ public int Score { get; set; }
+ }
+}
diff --git a/BackEnd/Timeline/Services/Api/SearchService.cs b/BackEnd/Timeline/Services/Api/SearchService.cs
index eec5001f..037f0490 100644
--- a/BackEnd/Timeline/Services/Api/SearchService.cs
+++ b/BackEnd/Timeline/Services/Api/SearchService.cs
@@ -1,62 +1,11 @@
using Microsoft.EntityFrameworkCore;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Timeline.Entities;
namespace Timeline.Services.Api
{
- public class SearchResultItem<TItem>
- {
- public SearchResultItem(TItem item, int score)
- {
- Item = item;
- Score = score;
- }
-
- public TItem Item { get; set; } = default!;
-
- /// <summary>
- /// Bigger is better.
- /// </summary>
- public int Score { get; set; }
- }
-
- public class SearchResult<TItem>
- {
-#pragma warning disable CA2227 // Collection properties should be read only
- public List<SearchResultItem<TItem>> Items { get; set; } = new();
-#pragma warning restore CA2227 // Collection properties should be read only
- }
-
- public interface ISearchService
- {
- /// <summary>
- /// Search timelines whose name or title contains query string.
- /// </summary>
- /// <param name="query">String to contain.</param>
- /// <returns>Search results.</returns>
- /// <exception cref="ArgumentNullException">Thrown when <paramref name="query"/> is null.</exception>
- /// <exception cref="ArgumentException">Thrown when <paramref name="query"/> is empty.</exception>
- /// <remarks>
- /// Implementation should promise high score is at first.
- /// </remarks>
- Task<SearchResult<TimelineEntity>> SearchTimeline(string query);
-
- /// <summary>
- /// Search users whose username or nickname contains query string.
- /// </summary>
- /// <param name="query">String to contain.</param>
- /// <returns>Search results.</returns>
- /// <exception cref="ArgumentNullException">Thrown when <paramref name="query"/> is null.</exception>
- /// <exception cref="ArgumentException">Thrown when <paramref name="query"/> is empty.</exception>
- /// <remarks>
- /// Implementation should promise high score is at first.
- /// </remarks>
- Task<SearchResult<UserEntity>> SearchUser(string query);
- }
-
public class SearchService : ISearchService
{
private readonly DatabaseContext _database;
@@ -66,7 +15,7 @@ namespace Timeline.Services.Api
_database = database;
}
- public async Task<SearchResult<TimelineEntity>> SearchTimeline(string query)
+ public async Task<SearchResult<TimelineEntity>> SearchTimelineAsync(string query)
{
if (query is null)
throw new ArgumentNullException(nameof(query));
@@ -83,7 +32,7 @@ namespace Timeline.Services.Api
return searchResult;
}
- public async Task<SearchResult<UserEntity>> SearchUser(string query)
+ public async Task<SearchResult<UserEntity>> SearchUserAsync(string query)
{
if (query is null)
throw new ArgumentNullException(nameof(query));
diff --git a/BackEnd/Timeline/Services/EntityAlreadyExistException.cs b/BackEnd/Timeline/Services/EntityAlreadyExistException.cs
index 2d3de368..0aaea012 100644
--- a/BackEnd/Timeline/Services/EntityAlreadyExistException.cs
+++ b/BackEnd/Timeline/Services/EntityAlreadyExistException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
namespace Timeline.Services
{
@@ -9,24 +10,18 @@ namespace Timeline.Services
/// For example, want to create a timeline but a timeline with the same name already exists.
/// </remarks>
[Serializable]
- public class EntityAlreadyExistException : Exception
+ public class EntityAlreadyExistException : EntityException
{
- public EntityAlreadyExistException() : this(null, null, null, null) { }
- public EntityAlreadyExistException(string? entityName) : this(entityName, null, null, null) { }
- public EntityAlreadyExistException(string? entityName, Exception? inner) : this(entityName, null, null, inner) { }
- public EntityAlreadyExistException(string? entityName, object? entity, Exception inner) : this(entityName, entity, null, inner) { }
- public EntityAlreadyExistException(string? entityName, object? entity, string? message, Exception? inner) : base(message ?? Resource.ExceptionEntityAlreadyExist, inner)
+ public EntityAlreadyExistException() : base() { }
+ public EntityAlreadyExistException(string? message) : base(message) { }
+ public EntityAlreadyExistException(string? message, Exception? inner) : base(message, inner) { }
+ public EntityAlreadyExistException(EntityType entityType, IDictionary<string, object> constraints, string? message = null, Exception? inner = null)
+ : base(entityType, constraints, message ?? Resource.ExceptionEntityNotExist, inner)
{
- EntityName = entityName;
- Entity = entity;
- }
+ }
protected EntityAlreadyExistException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- public string? EntityName { get; }
-
- public object? Entity { get; }
}
}
diff --git a/BackEnd/Timeline/Services/EntityException.cs b/BackEnd/Timeline/Services/EntityException.cs
new file mode 100644
index 00000000..7a302e5a
--- /dev/null
+++ b/BackEnd/Timeline/Services/EntityException.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Timeline.Services
+{
+ [Serializable]
+ public class EntityException : Exception
+ {
+ public EntityException() { }
+ public EntityException(string? message) : base(message) { }
+ public EntityException(string? message, Exception? inner) : base(message, inner) { }
+ public EntityException(EntityType entityType, IDictionary<string, object> constraints, string? message = null, Exception? inner = null)
+ : base(message, inner)
+ {
+ EntityType = entityType;
+ Constraints = constraints;
+ }
+ protected EntityException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
+
+ public EntityType EntityType { get; } = EntityTypes.Default;
+ public IDictionary<string, object> Constraints { get; } = new Dictionary<string, object>();
+
+ public string GenerateConstraintString()
+ {
+ return string.Join(' ', Constraints.Select(c => $"[{c.Key} = {c.Value}]"));
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Services/EntityNames.cs b/BackEnd/Timeline/Services/EntityNames.cs
index 7dae6a4a..5df5e615 100644
--- a/BackEnd/Timeline/Services/EntityNames.cs
+++ b/BackEnd/Timeline/Services/EntityNames.cs
@@ -2,8 +2,10 @@
{
public static class EntityNames
{
+ public const string Default = "Default";
public const string User = "User";
public const string Timeline = "Timeline";
public const string TimelinePost = "TimelinePost";
+ public const string TimelinePostData = "TimelinePostData";
}
}
diff --git a/BackEnd/Timeline/Services/EntityNotExistException.cs b/BackEnd/Timeline/Services/EntityNotExistException.cs
index 39a4f545..0c836fc4 100644
--- a/BackEnd/Timeline/Services/EntityNotExistException.cs
+++ b/BackEnd/Timeline/Services/EntityNotExistException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
namespace Timeline.Services
{
@@ -9,19 +10,18 @@ namespace Timeline.Services
/// For example, you want to get a timeline with given name but it does not exist.
/// </example>
[Serializable]
- public class EntityNotExistException : Exception
+ public class EntityNotExistException : EntityException
{
- public EntityNotExistException() : this(null, null) { }
- public EntityNotExistException(string? entityName) : this(entityName, null) { }
- public EntityNotExistException(string? entityName, Exception? inner) : this(entityName, null, inner) { }
- public EntityNotExistException(string? entityName, string? message, Exception? inner) : base(message ?? Resource.ExceptionEntityNotExist, inner)
+ public EntityNotExistException() : base() { }
+ public EntityNotExistException(string? message) : base(message) { }
+ public EntityNotExistException(string? message, Exception? inner) : base(message, inner) { }
+ public EntityNotExistException(EntityType entityType, IDictionary<string, object> constraints, string? message = null, Exception? inner = null)
+ : base(entityType, constraints, message ?? Resource.ExceptionEntityNotExist, inner)
{
- EntityName = entityName;
+
}
protected EntityNotExistException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- public string? EntityName { get; }
}
}
diff --git a/BackEnd/Timeline/Services/EntityType.cs b/BackEnd/Timeline/Services/EntityType.cs
new file mode 100644
index 00000000..c379d211
--- /dev/null
+++ b/BackEnd/Timeline/Services/EntityType.cs
@@ -0,0 +1,34 @@
+using System.Reflection;
+
+namespace Timeline.Services
+{
+ public class EntityType
+ {
+ public EntityType(string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; }
+
+ public int NotExistErrorCode
+ {
+ get
+ {
+ var field = typeof(ErrorCodes.NotExist).GetField(Name, BindingFlags.Public | BindingFlags.Static);
+ if (field is not null) return (int)field.GetRawConstantValue()!;
+ return ErrorCodes.NotExist.Default;
+ }
+ }
+
+ public int ConflictErrorCode
+ {
+ get
+ {
+ var field = typeof(ErrorCodes.Conflict).GetField(Name, BindingFlags.Public | BindingFlags.Static);
+ if (field is not null) return (int)field.GetRawConstantValue()!;
+ return ErrorCodes.Conflict.Default;
+ }
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Services/EntityTypes.cs b/BackEnd/Timeline/Services/EntityTypes.cs
new file mode 100644
index 00000000..d4884fd6
--- /dev/null
+++ b/BackEnd/Timeline/Services/EntityTypes.cs
@@ -0,0 +1,11 @@
+namespace Timeline.Services
+{
+ public static class EntityTypes
+ {
+ public static EntityType Default { get; } = new EntityType(EntityNames.Default);
+ public static EntityType User { get; } = new EntityType(EntityNames.User);
+ public static EntityType Timeline { get; } = new EntityType(EntityNames.Timeline);
+ public static EntityType TimelinePost { get; } = new EntityType(EntityNames.TimelinePost);
+ public static EntityType TimelinePostData { get; } = new EntityType(EntityNames.TimelinePostData);
+ }
+}
diff --git a/BackEnd/Timeline/Services/Mapper/TimelineMapper.cs b/BackEnd/Timeline/Services/Mapper/TimelineMapper.cs
index 5ee90a8f..d3159423 100644
--- a/BackEnd/Timeline/Services/Mapper/TimelineMapper.cs
+++ b/BackEnd/Timeline/Services/Mapper/TimelineMapper.cs
@@ -85,8 +85,8 @@ namespace Timeline.Services.Mapper
color: entity.Color,
createTime: entity.CreateTime,
lastModified: entity.LastModified,
- isHighlight: await _highlightTimelineService.IsHighlightTimeline(entity.Id),
- isBookmark: userId is not null && await _bookmarkTimelineService.IsBookmark(userId.Value, entity.Id, false, false),
+ isHighlight: await _highlightTimelineService.IsHighlightTimelineAsync(entity.Id),
+ isBookmark: userId is not null && await _bookmarkTimelineService.IsBookmarkAsync(userId.Value, entity.Id, false, false),
manageable: manageable,
postable: postable,
links: new HttpTimelineLinks(
diff --git a/BackEnd/Timeline/Services/Timeline/BasicTimelineService.cs b/BackEnd/Timeline/Services/Timeline/BasicTimelineService.cs
index 7476a860..360f6c63 100644
--- a/BackEnd/Timeline/Services/Timeline/BasicTimelineService.cs
+++ b/BackEnd/Timeline/Services/Timeline/BasicTimelineService.cs
@@ -47,6 +47,22 @@ namespace Timeline.Services.Timeline
};
}
+ protected static EntityNotExistException CreateTimelineNotExistException(string name, Exception? inner = null)
+ {
+ return new EntityNotExistException(EntityTypes.Timeline, new Dictionary<string, object>
+ {
+ ["name"] = name
+ }, null, inner);
+ }
+
+ protected static EntityNotExistException CreateTimelineNotExistException(long id)
+ {
+ return new EntityNotExistException(EntityTypes.Timeline, new Dictionary<string, object>
+ {
+ ["id"] = id
+ });
+ }
+
protected void CheckGeneralTimelineName(string timelineName, string? paramName)
{
if (!_generalTimelineNameValidator.Validate(timelineName, out var message))
@@ -75,9 +91,9 @@ namespace Timeline.Services.Timeline
{
userId = await _basicUserService.GetUserIdByUsernameAsync(username);
}
- catch (UserNotExistException e)
+ catch (EntityNotExistException e)
{
- throw new TimelineNotExistException(timelineName, e);
+ throw CreateTimelineNotExistException(timelineName, e);
}
var timelineEntity = await _database.Timelines.Where(t => t.OwnerId == userId && t.Name == null).Select(t => new { t.Id }).SingleOrDefaultAsync();
@@ -103,7 +119,7 @@ namespace Timeline.Services.Timeline
if (timelineEntity == null)
{
- throw new TimelineNotExistException(timelineName);
+ throw CreateTimelineNotExistException(timelineName);
}
else
{
diff --git a/BackEnd/Timeline/Services/Timeline/BasicTimelineServiceExtensions.cs b/BackEnd/Timeline/Services/Timeline/BasicTimelineServiceExtensions.cs
new file mode 100644
index 00000000..4075c9c0
--- /dev/null
+++ b/BackEnd/Timeline/Services/Timeline/BasicTimelineServiceExtensions.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Timeline.Services.Timeline
+{
+ public static class BasicTimelineServiceExtensions
+ {
+ public static async Task ThrowIfTimelineNotExist(this IBasicTimelineService service, long timelineId)
+ {
+ if (!await service.CheckTimelineExistenceAsync(timelineId))
+ {
+ throw new EntityNotExistException(EntityTypes.Timeline,
+ new Dictionary<string, object> { ["id"] = timelineId });
+ }
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Services/Timeline/IBasicTimelineService.cs b/BackEnd/Timeline/Services/Timeline/IBasicTimelineService.cs
index b32fa3f7..b6f1e6de 100644
--- a/BackEnd/Timeline/Services/Timeline/IBasicTimelineService.cs
+++ b/BackEnd/Timeline/Services/Timeline/IBasicTimelineService.cs
@@ -1,6 +1,5 @@
using System;
using System.Threading.Tasks;
-using Timeline.Services.User;
namespace Timeline.Services.Timeline
{
@@ -23,14 +22,9 @@ namespace Timeline.Services.Timeline
/// <returns>Id of the timeline.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="timelineName"/> is null.</exception>
/// <exception cref="ArgumentException">Throw when <paramref name="timelineName"/> is of bad format.</exception>
- /// <exception cref="TimelineNotExistException">
+ /// <exception cref="EntityNotExistException">
/// Thrown when timeline with name <paramref name="timelineName"/> does not exist.
- /// If it is a personal timeline, then inner exception is <see cref="UserNotExistException"/>.
/// </exception>
- /// <remarks>
- /// If name is of personal timeline and the timeline does not exist, it will be created if user exists.
- /// If the user does not exist, <see cref="TimelineNotExistException"/> will be thrown with <see cref="UserNotExistException"/> as inner exception.
- ///</remarks>
Task<long> GetTimelineIdByNameAsync(string timelineName);
}
}
diff --git a/BackEnd/Timeline/Services/Timeline/ITimelinePostService.cs b/BackEnd/Timeline/Services/Timeline/ITimelinePostService.cs
index 50af9fc2..d746cf63 100644
--- a/BackEnd/Timeline/Services/Timeline/ITimelinePostService.cs
+++ b/BackEnd/Timeline/Services/Timeline/ITimelinePostService.cs
@@ -5,7 +5,6 @@ using Timeline.Entities;
using Timeline.Helpers.Cache;
using Timeline.Models;
using Timeline.Services.Imaging;
-using Timeline.Services.User;
namespace Timeline.Services.Timeline
{
@@ -18,7 +17,7 @@ namespace Timeline.Services.Timeline
/// <param name="modifiedSince">The time that posts have been modified since.</param>
/// <param name="includeDeleted">Whether include deleted posts.</param>
/// <returns>A list of all posts.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
Task<List<TimelinePostEntity>> GetPostsAsync(long timelineId, DateTime? modifiedSince = null, bool includeDeleted = false);
/// <summary>
@@ -28,8 +27,8 @@ namespace Timeline.Services.Timeline
/// <param name="postId">The id of the post.</param>
/// <param name="includeDeleted">If true, return the entity even if it is deleted.</param>
/// <returns>The post.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="TimelinePostNotExistException">Thrown when post of <paramref name="postId"/> does not exist or has been deleted.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when post of <paramref name="postId"/> does not exist or has been deleted.</exception>
Task<TimelinePostEntity> GetPostAsync(long timelineId, long postId, bool includeDeleted = false);
/// <summary>
@@ -39,9 +38,9 @@ namespace Timeline.Services.Timeline
/// <param name="postId">The post id.</param>
/// <param name="dataIndex">The index of the data.</param>
/// <returns>The data digest.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="TimelinePostNotExistException">Thrown when post of <paramref name="postId"/> does not exist or has been deleted.</exception>
- /// <exception cref="TimelinePostDataNotExistException">Thrown when data of that index does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when post of <paramref name="postId"/> does not exist or has been deleted.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when data of that index does not exist.</exception>
Task<ICacheableDataDigest> GetPostDataDigestAsync(long timelineId, long postId, long dataIndex);
/// <summary>
@@ -51,9 +50,9 @@ namespace Timeline.Services.Timeline
/// <param name="postId">The post id.</param>
/// <param name="dataIndex">The index of the data.</param>
/// <returns>The data.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="TimelinePostNotExistException">Thrown when post of <paramref name="postId"/> does not exist or has been deleted.</exception>
- /// <exception cref="TimelinePostDataNotExistException">Thrown when data of that index does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when post of <paramref name="postId"/> does not exist or has been deleted.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when data of that index does not exist.</exception>
Task<ByteData> GetPostDataAsync(long timelineId, long postId, long dataIndex);
/// <summary>
@@ -65,8 +64,8 @@ namespace Timeline.Services.Timeline
/// <returns>The entity of the created post.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="request"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="request"/> is of invalid format.</exception>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="UserNotExistException">Thrown if user of <paramref name="authorId"/> does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown if user of <paramref name="authorId"/> does not exist.</exception>
/// <exception cref="ImageException">Thrown if data is not a image. Validated by <see cref="ImageService"/>.</exception>
Task<TimelinePostEntity> CreatePostAsync(long timelineId, long authorId, TimelinePostCreateRequest request);
@@ -79,8 +78,8 @@ namespace Timeline.Services.Timeline
/// <returns>The entity of the patched post.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="request"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="request"/> is of invalid format.</exception>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="TimelinePostNotExistException">Thrown when post does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when post does not exist.</exception>
Task<TimelinePostEntity> PatchPostAsync(long timelineId, long postId, TimelinePostPatchRequest request);
/// <summary>
@@ -88,8 +87,8 @@ namespace Timeline.Services.Timeline
/// </summary>
/// <param name="timelineId">The id of the timeline to delete post against.</param>
/// <param name="postId">The id of the post to delete.</param>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="TimelinePostNotExistException">Thrown when the post with given id does not exist or is deleted already.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the post with given id does not exist or is deleted already.</exception>
/// <remarks>
/// First use <see cref="HasPostModifyPermissionAsync(long, long, long, bool)"/> to check the permission.
/// </remarks>
@@ -107,10 +106,10 @@ namespace Timeline.Services.Timeline
/// <param name="timelineId">The id of the timeline.</param>
/// <param name="postId">The id of the post.</param>
/// <param name="modifierId">The id of the user to check on.</param>
- /// <param name="throwOnPostNotExist">True if you want it to throw <see cref="TimelinePostNotExistException"/>. Default false.</param>
+ /// <param name="throwOnPostNotExist">True if you want it to throw <see cref="EntityNotExistException"/>. Default false.</param>
/// <returns>True if can modify, false if can't modify.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="TimelinePostNotExistException">Thrown when the post with given id does not exist or is deleted already and <paramref name="throwOnPostNotExist"/> is true.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the post with given id does not exist or is deleted already and <paramref name="throwOnPostNotExist"/> is true.</exception>
/// <remarks>
/// Unless <paramref name="throwOnPostNotExist"/> is true, this method should return true if the post does not exist.
/// If the post is deleted, its author info still exists, so it is checked as the post is not deleted unless <paramref name="throwOnPostNotExist"/> is true.
diff --git a/BackEnd/Timeline/Services/Timeline/ITimelineService.cs b/BackEnd/Timeline/Services/Timeline/ITimelineService.cs
index 9c313b0b..c5bd5abf 100644
--- a/BackEnd/Timeline/Services/Timeline/ITimelineService.cs
+++ b/BackEnd/Timeline/Services/Timeline/ITimelineService.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Entities;
using Timeline.Models;
-using Timeline.Services.User;
namespace Timeline.Services.Timeline
{
@@ -17,7 +16,7 @@ namespace Timeline.Services.Timeline
/// </summary>
/// <param name="id">Id of timeline.</param>
/// <returns>The timeline info.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
Task<TimelineEntity> GetTimelineAsync(long id);
/// <summary>
@@ -26,7 +25,7 @@ namespace Timeline.Services.Timeline
/// <param name="id">The id of the timeline.</param>
/// <param name="newProperties">The new properties. Null member means not to change.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="newProperties"/> is null.</exception>
- /// <exception cref="TimelineNotExistException">Thrown when timeline with given id does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline with given id does not exist.</exception>
/// <exception cref="EntityAlreadyExistException">Thrown when a timeline with new name already exists.</exception>
Task ChangePropertyAsync(long id, TimelineChangePropertyParams newProperties);
@@ -36,8 +35,8 @@ namespace Timeline.Services.Timeline
/// <param name="timelineId">Timeline id.</param>
/// <param name="userId">User id.</param>
/// <returns>True if the memeber was added. False if it is already a member.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="UserNotExistException">Thrown when the user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user does not exist.</exception>
Task<bool> AddMemberAsync(long timelineId, long userId);
/// <summary>
@@ -46,8 +45,8 @@ namespace Timeline.Services.Timeline
/// <param name="timelineId">Timeline id.</param>
/// <param name="userId">User id.</param>
/// <returns>True if the memeber was removed. False if it was not a member before.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="UserNotExistException">Thrown when the user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user does not exist.</exception>
Task<bool> RemoveMemberAsync(long timelineId, long userId);
/// <summary>
@@ -56,7 +55,7 @@ namespace Timeline.Services.Timeline
/// <param name="timelineId">The id of the timeline.</param>
/// <param name="userId">The id of the user to check on.</param>
/// <returns>True if the user can manage the timeline, otherwise false.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
/// <remarks>
/// This method does not check whether visitor is administrator.
/// Return false if user with user id does not exist.
@@ -69,7 +68,7 @@ namespace Timeline.Services.Timeline
/// <param name="timelineId">The id of the timeline.</param>
/// <param name="visitorId">The id of the user to check on. Null means visitor without account.</param>
/// <returns>True if can read, false if can't read.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
/// <remarks>
/// This method does not check whether visitor is administrator.
/// Return false if user with visitor id does not exist.
@@ -82,7 +81,7 @@ namespace Timeline.Services.Timeline
/// <param name="timelineId">The id of the timeline.</param>
/// <param name="userId">The id of user to check on.</param>
/// <returns>True if it is a member, false if not.</returns>
- /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
/// <remarks>
/// Timeline owner is also considered as a member.
/// Return false when user with user id does not exist.
@@ -109,14 +108,14 @@ namespace Timeline.Services.Timeline
/// <exception cref="ArgumentNullException">Thrown when <paramref name="timelineName"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when timeline name is invalid.</exception>
/// <exception cref="EntityAlreadyExistException">Thrown when the timeline already exists.</exception>
- /// <exception cref="UserNotExistException">Thrown when the owner user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the owner user does not exist.</exception>
Task<TimelineEntity> CreateTimelineAsync(string timelineName, long ownerId);
/// <summary>
/// Delete a timeline.
/// </summary>
/// <param name="id">The id of the timeline to delete.</param>
- /// <exception cref="TimelineNotExistException">Thrown when the timeline does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the timeline does not exist.</exception>
Task DeleteTimelineAsync(long id);
}
}
diff --git a/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs b/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs
index 6faea295..5ad03011 100644
--- a/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs
+++ b/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs
@@ -61,6 +61,42 @@ namespace Timeline.Services.Timeline {
}
/// <summary>
+ /// Looks up a localized string similar to Color is not valid. {0}.
+ /// </summary>
+ internal static string ExceptionColorInvalid {
+ get {
+ return ResourceManager.GetString("ExceptionColorInvalid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Data list can&apos;t be empty..
+ /// </summary>
+ internal static string ExceptionDataListEmpty {
+ get {
+ return ResourceManager.GetString("ExceptionDataListEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Data list can&apos;t be null..
+ /// </summary>
+ internal static string ExceptionDataListNull {
+ get {
+ return ResourceManager.GetString("ExceptionDataListNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Data list count can&apos;t be bigger than 100..
+ /// </summary>
+ internal static string ExceptionDataListTooLarge {
+ get {
+ return ResourceManager.GetString("ExceptionDataListTooLarge", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to This timeline name is neither a valid personal timeline name nor a valid ordinary timeline name. {0}.
/// </summary>
internal static string ExceptionGeneralTimelineNameBadFormat {
@@ -70,6 +106,33 @@ namespace Timeline.Services.Timeline {
}
/// <summary>
+ /// Looks up a localized string similar to Image validation failed..
+ /// </summary>
+ internal static string ExceptionPostDataImageInvalid {
+ get {
+ return ResourceManager.GetString("ExceptionPostDataImageInvalid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to It is not a valid utf-8 sequence..
+ /// </summary>
+ internal static string ExceptionPostDataNotValidUtf8 {
+ get {
+ return ResourceManager.GetString("ExceptionPostDataNotValidUtf8", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unsupported content type..
+ /// </summary>
+ internal static string ExceptionPostDataUnsupportedType {
+ get {
+ return ResourceManager.GetString("ExceptionPostDataUnsupportedType", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Timeline with given constraints already exist..
/// </summary>
internal static string ExceptionTimelineAlreadyExist {
@@ -131,5 +194,77 @@ namespace Timeline.Services.Timeline {
return ResourceManager.GetString("LogPersonalTimelineAutoCreate", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to A member(user id={0}) is added to timeline(id={1})..
+ /// </summary>
+ internal static string LogTimelineAddMember {
+ get {
+ return ResourceManager.GetString("LogTimelineAddMember", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline is created with name={0}, id={1}..
+ /// </summary>
+ internal static string LogTimelineCreate {
+ get {
+ return ResourceManager.GetString("LogTimelineCreate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) is deleted..
+ /// </summary>
+ internal static string LogTimelineDelete {
+ get {
+ return ResourceManager.GetString("LogTimelineDelete", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) post(id={1}) is created..
+ /// </summary>
+ internal static string LogTimelinePostCreated {
+ get {
+ return ResourceManager.GetString("LogTimelinePostCreated", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) post(id={1}) is deleted..
+ /// </summary>
+ internal static string LogTimelinePostDeleted {
+ get {
+ return ResourceManager.GetString("LogTimelinePostDeleted", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) post(id={1}) is updated..
+ /// </summary>
+ internal static string LogTimelinePostUpdated {
+ get {
+ return ResourceManager.GetString("LogTimelinePostUpdated", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A member(user id={0}) is removed from timeline(id={1})..
+ /// </summary>
+ internal static string LogTimelineRemoveMember {
+ get {
+ return ResourceManager.GetString("LogTimelineRemoveMember", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Timeline with id={0} is updated..
+ /// </summary>
+ internal static string LogTimelineUpdated {
+ get {
+ return ResourceManager.GetString("LogTimelineUpdated", resourceCulture);
+ }
+ }
}
}
diff --git a/BackEnd/Timeline/Services/Timeline/Resource.resx b/BackEnd/Timeline/Services/Timeline/Resource.resx
index 3a233e55..cc293d05 100644
--- a/BackEnd/Timeline/Services/Timeline/Resource.resx
+++ b/BackEnd/Timeline/Services/Timeline/Resource.resx
@@ -117,9 +117,30 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="ExceptionColorInvalid" xml:space="preserve">
+ <value>Color is not valid. {0}</value>
+ </data>
+ <data name="ExceptionDataListEmpty" xml:space="preserve">
+ <value>Data list can't be empty.</value>
+ </data>
+ <data name="ExceptionDataListNull" xml:space="preserve">
+ <value>Data list can't be null.</value>
+ </data>
+ <data name="ExceptionDataListTooLarge" xml:space="preserve">
+ <value>Data list count can't be bigger than 100.</value>
+ </data>
<data name="ExceptionGeneralTimelineNameBadFormat" xml:space="preserve">
<value>This timeline name is neither a valid personal timeline name nor a valid ordinary timeline name. {0}</value>
</data>
+ <data name="ExceptionPostDataImageInvalid" xml:space="preserve">
+ <value>Image validation failed.</value>
+ </data>
+ <data name="ExceptionPostDataNotValidUtf8" xml:space="preserve">
+ <value>It is not a valid utf-8 sequence.</value>
+ </data>
+ <data name="ExceptionPostDataUnsupportedType" xml:space="preserve">
+ <value>Unsupported content type.</value>
+ </data>
<data name="ExceptionTimelineAlreadyExist" xml:space="preserve">
<value>Timeline with given constraints already exist.</value>
</data>
@@ -141,4 +162,28 @@
<data name="LogPersonalTimelineAutoCreate" xml:space="preserve">
<value>A personal timeline for user with username={0} is created automatically.</value>
</data>
+ <data name="LogTimelineAddMember" xml:space="preserve">
+ <value>A member(user id={0}) is added to timeline(id={1}).</value>
+ </data>
+ <data name="LogTimelineCreate" xml:space="preserve">
+ <value>A timeline is created with name={0}, id={1}.</value>
+ </data>
+ <data name="LogTimelineDelete" xml:space="preserve">
+ <value>A timeline(id={0}) is deleted.</value>
+ </data>
+ <data name="LogTimelinePostCreated" xml:space="preserve">
+ <value>A timeline(id={0}) post(id={1}) is created.</value>
+ </data>
+ <data name="LogTimelinePostDeleted" xml:space="preserve">
+ <value>A timeline(id={0}) post(id={1}) is deleted.</value>
+ </data>
+ <data name="LogTimelinePostUpdated" xml:space="preserve">
+ <value>A timeline(id={0}) post(id={1}) is updated.</value>
+ </data>
+ <data name="LogTimelineRemoveMember" xml:space="preserve">
+ <value>A member(user id={0}) is removed from timeline(id={1}).</value>
+ </data>
+ <data name="LogTimelineUpdated" xml:space="preserve">
+ <value>Timeline with id={0} is updated.</value>
+ </data>
</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Services/Timeline/TimelineAlreadyExistException.cs b/BackEnd/Timeline/Services/Timeline/TimelineAlreadyExistException.cs
deleted file mode 100644
index 11fc4ef8..00000000
--- a/BackEnd/Timeline/Services/Timeline/TimelineAlreadyExistException.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-
-namespace Timeline.Services.Timeline
-{
- /// <summary>
- /// The user requested does not exist.
- /// </summary>
- [Serializable]
- public class TimelineAlreadyExistException : EntityAlreadyExistException
- {
- public TimelineAlreadyExistException() : this(null, null, null) { }
- public TimelineAlreadyExistException(object? entity) : this(entity, null, null) { }
- public TimelineAlreadyExistException(object? entity, Exception? inner) : this(entity, null, inner) { }
- public TimelineAlreadyExistException(object? entity, string? message, Exception? inner)
- : base(EntityNames.Timeline, entity, message ?? Resource.ExceptionTimelineAlreadyExist, inner)
- {
-
- }
-
- protected TimelineAlreadyExistException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-}
diff --git a/BackEnd/Timeline/Services/Timeline/TimelineNotExistException.cs b/BackEnd/Timeline/Services/Timeline/TimelineNotExistException.cs
deleted file mode 100644
index 2cfbdedf..00000000
--- a/BackEnd/Timeline/Services/Timeline/TimelineNotExistException.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-
-namespace Timeline.Services.Timeline
-{
- [Serializable]
- public class TimelineNotExistException : EntityNotExistException
- {
- public TimelineNotExistException() : this(null, null, null, null) { }
- public TimelineNotExistException(long? id) : this(null, id, null, null) { }
- public TimelineNotExistException(long? id, Exception? inner) : this(null, id, null, inner) { }
- public TimelineNotExistException(string? timelineName) : this(timelineName, null, null, null) { }
- public TimelineNotExistException(string? timelineName, Exception? inner) : this(timelineName, null, null, inner) { }
- public TimelineNotExistException(string? timelineName, long? timelineId, string? message, Exception? inner = null)
- : base(EntityNames.Timeline, message ?? Resource.ExceptionTimelineNotExist, inner)
- {
- TimelineId = timelineId;
- TimelineName = timelineName;
- }
-
- protected TimelineNotExistException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- public string? TimelineName { get; set; }
- public long? TimelineId { get; set; }
- }
-}
diff --git a/BackEnd/Timeline/Services/Timeline/TimelinePostDataNotExistException.cs b/BackEnd/Timeline/Services/Timeline/TimelinePostDataNotExistException.cs
deleted file mode 100644
index 177973a3..00000000
--- a/BackEnd/Timeline/Services/Timeline/TimelinePostDataNotExistException.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-
-namespace Timeline.Services.Timeline
-{
- [Serializable]
- public class TimelinePostDataNotExistException : Exception
- {
- public TimelinePostDataNotExistException() : this(null, null) { }
- public TimelinePostDataNotExistException(string? message) : this(message, null) { }
- public TimelinePostDataNotExistException(string? message, Exception? inner) : base(message, inner) { }
- public TimelinePostDataNotExistException(long timelineId, long postId, long dataIndex, string? message = null, Exception? inner = null) : base(message, inner)
- {
- TimelineId = timelineId;
- PostId = postId;
- DataIndex = dataIndex;
- }
- protected TimelinePostDataNotExistException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- public long TimelineId { get; set; }
- public long PostId { get; set; }
- public long DataIndex { get; set; }
- }
-}
diff --git a/BackEnd/Timeline/Services/Timeline/TimelinePostNotExistException.cs b/BackEnd/Timeline/Services/Timeline/TimelinePostNotExistException.cs
deleted file mode 100644
index 87c190ab..00000000
--- a/BackEnd/Timeline/Services/Timeline/TimelinePostNotExistException.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace Timeline.Services.Timeline
-{
- [Serializable]
- public class TimelinePostNotExistException : EntityNotExistException
- {
- public TimelinePostNotExistException() : this(null, null, false, null, null) { }
- public TimelinePostNotExistException(string? message) : this(message, null) { }
- public TimelinePostNotExistException(string? message, Exception? inner) : this(null, null, false, message, inner) { }
- protected TimelinePostNotExistException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public TimelinePostNotExistException(long? timelineId, long? postId, bool isDelete, string? message = null, Exception? inner = null)
- : base(EntityNames.TimelinePost, message ?? MakeMessage(isDelete), inner)
- {
- TimelineId = timelineId;
- PostId = postId;
- IsDelete = isDelete;
- }
-
- private static string MakeMessage(bool isDelete)
- {
- return string.Format(CultureInfo.CurrentCulture, Resource.ExceptionTimelinePostNoExist, isDelete ? Resource.ExceptionTimelinePostNoExistReasonDeleted : Resource.ExceptionTimelinePostNoExistReasonNotCreated);
- }
-
- public long? TimelineId { get; set; }
- public long? PostId { get; set; }
-
- /// <summary>
- /// True if the post is deleted. False if the post does not exist at all.
- /// </summary>
- public bool IsDelete { get; set; }
- }
-}
diff --git a/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs b/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs
index 65a01b37..a0961a8d 100644
--- a/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs
+++ b/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs
@@ -38,21 +38,35 @@ namespace Timeline.Services.Timeline
_clock = clock;
}
- private async Task CheckTimelineExistence(long timelineId)
+ private void CheckColor(string color, string paramName)
{
- if (!await _basicTimelineService.CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ if (!_colorValidator.Validate(color, out var message))
+ throw new ArgumentException(string.Format(Resource.ExceptionColorInvalid, message), paramName);
}
- private async Task CheckUserExistence(long userId)
+ private static EntityNotExistException CreatePostNotExistException(long timelineId, long postId, bool deleted)
{
- if (!await _basicUserService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
+ return new EntityNotExistException(EntityTypes.TimelinePost, new Dictionary<string, object>
+ {
+ ["timeline-id"] = timelineId,
+ ["post-id"] = postId,
+ ["deleted"] = deleted
+ });
+ }
+
+ private static EntityNotExistException CreatePostDataNotExistException(long timelineId, long postId, long dataIndex)
+ {
+ return new EntityNotExistException(EntityTypes.TimelinePost, new Dictionary<string, object>
+ {
+ ["timeline-id"] = timelineId,
+ ["post-id"] = postId,
+ ["data-index"] = dataIndex
+ });
}
public async Task<List<TimelinePostEntity>> GetPostsAsync(long timelineId, DateTime? modifiedSince = null, bool includeDeleted = false)
{
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
modifiedSince = modifiedSince?.MyToUtc();
@@ -75,18 +89,18 @@ namespace Timeline.Services.Timeline
public async Task<TimelinePostEntity> GetPostAsync(long timelineId, long postId, bool includeDeleted = false)
{
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
var post = await _database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).SingleOrDefaultAsync();
if (post is null)
{
- throw new TimelinePostNotExistException(timelineId, postId, false);
+ throw CreatePostNotExistException(timelineId, postId, false);
}
if (!includeDeleted && post.Deleted)
{
- throw new TimelinePostNotExistException(timelineId, postId, true);
+ throw CreatePostNotExistException(timelineId, postId, true);
}
return post;
@@ -94,40 +108,40 @@ namespace Timeline.Services.Timeline
public async Task<ICacheableDataDigest> GetPostDataDigestAsync(long timelineId, long postId, long dataIndex)
{
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
var postEntity = await _database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).Select(p => new { p.Id, p.Deleted }).SingleOrDefaultAsync();
if (postEntity is null)
- throw new TimelinePostNotExistException(timelineId, postId, false);
+ throw CreatePostNotExistException(timelineId, postId, false);
if (postEntity.Deleted)
- throw new TimelinePostNotExistException(timelineId, postId, true);
+ throw CreatePostNotExistException(timelineId, postId, true);
var dataEntity = await _database.TimelinePostData.Where(d => d.PostId == postEntity.Id && d.Index == dataIndex).SingleOrDefaultAsync();
if (dataEntity is null)
- throw new TimelinePostDataNotExistException(timelineId, postId, dataIndex);
+ throw CreatePostDataNotExistException(timelineId, postId, dataIndex);
return new CacheableDataDigest(dataEntity.DataTag, dataEntity.LastUpdated);
}
public async Task<ByteData> GetPostDataAsync(long timelineId, long postId, long dataIndex)
{
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
var postEntity = await _database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).Select(p => new { p.Id, p.Deleted }).SingleOrDefaultAsync();
if (postEntity is null)
- throw new TimelinePostNotExistException(timelineId, postId, false);
+ throw CreatePostNotExistException(timelineId, postId, false);
if (postEntity.Deleted)
- throw new TimelinePostNotExistException(timelineId, postId, true);
+ throw CreatePostNotExistException(timelineId, postId, true);
var dataEntity = await _database.TimelinePostData.Where(d => d.PostId == postEntity.Id && d.Index == dataIndex).SingleOrDefaultAsync();
if (dataEntity is null)
- throw new TimelinePostDataNotExistException(timelineId, postId, dataIndex);
+ throw CreatePostDataNotExistException(timelineId, postId, dataIndex);
var data = await _dataManager.GetEntryAndCheck(dataEntity.DataTag, $"Timeline {timelineId}, post {postId}, data {dataIndex} requires this data.");
@@ -139,19 +153,17 @@ namespace Timeline.Services.Timeline
if (request is null)
throw new ArgumentNullException(nameof(request));
- {
- if (!_colorValidator.Validate(request.Color, out var message))
- throw new ArgumentException("Color is not valid.", nameof(request));
- }
+ if (request.Color is not null)
+ CheckColor(request.Color, nameof(request));
if (request.DataList is null)
- throw new ArgumentException("Data list can't be null.", nameof(request));
+ throw new ArgumentException(Resource.ExceptionDataListNull, nameof(request));
if (request.DataList.Count == 0)
- throw new ArgumentException("Data list can't be empty.", nameof(request));
+ throw new ArgumentException(Resource.ExceptionDataListEmpty, nameof(request));
if (request.DataList.Count > 100)
- throw new ArgumentException("Data list count can't be bigger than 100.", nameof(request));
+ throw new ArgumentException(Resource.ExceptionDataListTooLarge, nameof(request));
for (int index = 0; index < request.DataList.Count; index++)
{
@@ -169,7 +181,7 @@ namespace Timeline.Services.Timeline
}
catch (ImageException e)
{
- throw new TimelinePostCreateDataException(index, "Image validation failed.", e);
+ throw new TimelinePostCreateDataException(index, Resource.ExceptionPostDataImageInvalid, e);
}
break;
case MimeTypes.TextPlain:
@@ -180,18 +192,18 @@ namespace Timeline.Services.Timeline
}
catch (DecoderFallbackException e)
{
- throw new TimelinePostCreateDataException(index, "Text is not a valid utf-8 sequence.", e);
+ throw new TimelinePostCreateDataException(index, Resource.ExceptionPostDataNotValidUtf8, e);
}
break;
default:
- throw new TimelinePostCreateDataException(index, "Unsupported content type.");
+ throw new TimelinePostCreateDataException(index, Resource.ExceptionPostDataUnsupportedType);
}
}
request.Time = request.Time?.MyToUtc();
- await CheckTimelineExistence(timelineId);
- await CheckUserExistence(authorId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
+ await _basicUserService.ThrowIfUserNotExist(authorId);
var currentTime = _clock.GetCurrentTime();
var finalTime = request.Time ?? currentTime;
@@ -234,6 +246,7 @@ namespace Timeline.Services.Timeline
await _database.SaveChangesAsync();
await transaction.CommitAsync();
+ _logger.LogInformation(Resource.LogTimelinePostCreated, timelineId, postEntity.Id);
return postEntity;
}
@@ -243,22 +256,20 @@ namespace Timeline.Services.Timeline
if (request is null)
throw new ArgumentNullException(nameof(request));
- {
- if (!_colorValidator.Validate(request.Color, out var message))
- throw new ArgumentException("Color is not valid.", nameof(request));
- }
+ if (request.Color is not null)
+ CheckColor(request.Color, nameof(request));
request.Time = request.Time?.MyToUtc();
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
var entity = await _database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelinePostNotExistException(timelineId, postId, false);
+ throw CreatePostNotExistException(timelineId, postId, false);
if (entity.Deleted)
- throw new TimelinePostNotExistException(timelineId, postId, true);
+ throw CreatePostNotExistException(timelineId, postId, true);
if (request.Time.HasValue)
entity.Time = request.Time.Value;
@@ -269,21 +280,22 @@ namespace Timeline.Services.Timeline
entity.LastUpdated = _clock.GetCurrentTime();
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelinePostUpdated, timelineId, postId);
return entity;
}
public async Task DeletePostAsync(long timelineId, long postId)
{
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
var entity = await _database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).SingleOrDefaultAsync();
if (entity == null)
- throw new TimelinePostNotExistException(timelineId, postId, false);
+ throw CreatePostNotExistException(timelineId, postId, false);
if (entity.Deleted)
- throw new TimelinePostNotExistException(timelineId, postId, true);
+ throw CreatePostNotExistException(timelineId, postId, true);
await using var transaction = await _database.Database.BeginTransactionAsync();
@@ -302,6 +314,7 @@ namespace Timeline.Services.Timeline
await _database.SaveChangesAsync();
await transaction.CommitAsync();
+ _logger.LogWarning(Resource.LogTimelinePostDeleted, timelineId, postId);
}
public async Task DeleteAllPostsOfUserAsync(long userId)
@@ -316,7 +329,7 @@ namespace Timeline.Services.Timeline
public async Task<bool> HasPostModifyPermissionAsync(long timelineId, long postId, long modifierId, bool throwOnPostNotExist = false)
{
- await CheckTimelineExistence(timelineId);
+ await _basicTimelineService.ThrowIfTimelineNotExist(timelineId);
var timelineEntity = await _database.Timelines.Where(t => t.Id == timelineId).Select(t => new { t.OwnerId }).SingleAsync();
@@ -325,14 +338,14 @@ namespace Timeline.Services.Timeline
if (postEntity is null)
{
if (throwOnPostNotExist)
- throw new TimelinePostNotExistException(timelineId, postId, false);
+ throw CreatePostNotExistException(timelineId, postId, false);
else
return true;
}
if (postEntity.Deleted && throwOnPostNotExist)
{
- throw new TimelinePostNotExistException(timelineId, postId, true);
+ throw CreatePostNotExistException(timelineId, postId, true);
}
return timelineEntity.OwnerId == modifierId || postEntity.AuthorId == modifierId;
diff --git a/BackEnd/Timeline/Services/Timeline/TimelineService.cs b/BackEnd/Timeline/Services/Timeline/TimelineService.cs
index cea93272..920fcc74 100644
--- a/BackEnd/Timeline/Services/Timeline/TimelineService.cs
+++ b/BackEnd/Timeline/Services/Timeline/TimelineService.cs
@@ -23,7 +23,6 @@ namespace Timeline.Services.Timeline
private readonly IClock _clock;
private readonly TimelineNameValidator _timelineNameValidator = new TimelineNameValidator();
-
private readonly ColorValidator _colorValidator = new ColorValidator();
public TimelineService(ILoggerFactory loggerFactory, DatabaseContext database, IBasicUserService userService, IClock clock)
@@ -35,8 +34,15 @@ namespace Timeline.Services.Timeline
_clock = clock;
}
+ private static EntityAlreadyExistException CreateTimelineConflictException(string name)
+ {
+ return new EntityAlreadyExistException(EntityTypes.Timeline, new Dictionary<string, object>
+ {
+ ["name"] = name
+ });
+ }
- private void ValidateTimelineName(string name, string paramName)
+ private void CheckTimelineName(string name, string paramName)
{
if (!_timelineNameValidator.Validate(name, out var message))
{
@@ -49,7 +55,7 @@ namespace Timeline.Services.Timeline
var entity = await _database.Timelines.Where(t => t.Id == id).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelineNotExistException(id);
+ throw CreateTimelineNotExistException(id);
return entity;
}
@@ -60,7 +66,7 @@ namespace Timeline.Services.Timeline
throw new ArgumentNullException(nameof(newProperties));
if (newProperties.Name is not null)
- ValidateTimelineName(newProperties.Name, nameof(newProperties));
+ CheckTimelineName(newProperties.Name, nameof(newProperties));
if (newProperties.Color is not null)
{
@@ -74,7 +80,7 @@ namespace Timeline.Services.Timeline
var entity = await _database.Timelines.Where(t => t.Id == id).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelineNotExistException(id);
+ throw CreateTimelineNotExistException(id);
var changed = false;
var nameChanged = false;
@@ -84,7 +90,7 @@ namespace Timeline.Services.Timeline
var conflict = await _database.Timelines.AnyAsync(t => t.Name == newProperties.Name);
if (conflict)
- throw new TimelineAlreadyExistException();
+ throw CreateTimelineConflictException(newProperties.Name);
entity.Name = newProperties.Name;
@@ -125,20 +131,19 @@ namespace Timeline.Services.Timeline
}
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineUpdated, id);
}
public async Task<bool> AddMemberAsync(long timelineId, long userId)
{
if (!await CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ throw CreateTimelineNotExistException(timelineId);
- if (!await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
+ await _userService.ThrowIfUserNotExist(userId);
if (await _database.TimelineMembers.AnyAsync(m => m.TimelineId == timelineId && m.UserId == userId))
return false;
-
var entity = new TimelineMemberEntity { UserId = userId, TimelineId = timelineId };
_database.TimelineMembers.Add(entity);
@@ -146,16 +151,17 @@ namespace Timeline.Services.Timeline
timelineEntity.LastModified = _clock.GetCurrentTime();
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineAddMember, userId, timelineId);
+
return true;
}
public async Task<bool> RemoveMemberAsync(long timelineId, long userId)
{
if (!await CheckTimelineExistenceAsync(timelineId))
- throw new TimelineNotExistException(timelineId);
+ throw CreateTimelineNotExistException(timelineId);
- if (!await _userService.CheckUserExistenceAsync(userId))
- throw new UserNotExistException(userId);
+ await _userService.ThrowIfUserNotExist(userId);
var entity = await _database.TimelineMembers.SingleOrDefaultAsync(m => m.TimelineId == timelineId && m.UserId == userId);
if (entity is null) return false;
@@ -166,6 +172,8 @@ namespace Timeline.Services.Timeline
timelineEntity.LastModified = _clock.GetCurrentTime();
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineRemoveMember, userId, timelineId);
+
return true;
}
@@ -174,7 +182,7 @@ namespace Timeline.Services.Timeline
var entity = await _database.Timelines.Where(t => t.Id == timelineId).Select(t => new { t.OwnerId }).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelineNotExistException(timelineId);
+ throw CreateTimelineNotExistException(timelineId);
return entity.OwnerId == userId;
}
@@ -184,7 +192,7 @@ namespace Timeline.Services.Timeline
var entity = await _database.Timelines.Where(t => t.Id == timelineId).Select(t => new { t.Visibility }).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelineNotExistException(timelineId);
+ throw CreateTimelineNotExistException(timelineId);
if (entity.Visibility == TimelineVisibility.Public)
return true;
@@ -208,7 +216,7 @@ namespace Timeline.Services.Timeline
var entity = await _database.Timelines.Where(t => t.Id == timelineId).Select(t => new { t.OwnerId }).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelineNotExistException(timelineId);
+ throw CreateTimelineNotExistException(timelineId);
if (userId == entity.OwnerId)
return true;
@@ -258,17 +266,18 @@ namespace Timeline.Services.Timeline
if (name == null)
throw new ArgumentNullException(nameof(name));
- ValidateTimelineName(name, nameof(name));
+ CheckTimelineName(name, nameof(name));
var conflict = await _database.Timelines.AnyAsync(t => t.Name == name);
if (conflict)
- throw new TimelineAlreadyExistException();
+ throw CreateTimelineConflictException(name);
var entity = CreateNewTimelineEntity(name, owner);
_database.Timelines.Add(entity);
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineCreate, name, entity.Id);
return entity;
}
@@ -278,10 +287,11 @@ namespace Timeline.Services.Timeline
var entity = await _database.Timelines.Where(t => t.Id == id).SingleOrDefaultAsync();
if (entity is null)
- throw new TimelineNotExistException(id);
+ throw CreateTimelineNotExistException(id);
_database.Timelines.Remove(entity);
await _database.SaveChangesAsync();
+ _logger.LogWarning(Resource.LogTimelineDelete, id);
}
}
}
diff --git a/BackEnd/Timeline/Services/Token/IUserTokenManager.cs b/BackEnd/Timeline/Services/Token/IUserTokenManager.cs
index bdc1add3..39009d69 100644
--- a/BackEnd/Timeline/Services/Token/IUserTokenManager.cs
+++ b/BackEnd/Timeline/Services/Token/IUserTokenManager.cs
@@ -16,7 +16,7 @@ namespace Timeline.Services.Token
/// <returns>The created token and the user info.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="username"/> or <paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="username"/> is of bad format.</exception>
- /// <exception cref="UserNotExistException">Thrown when the user with <paramref name="username"/> does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user with <paramref name="username"/> does not exist.</exception>
/// <exception cref="BadPasswordException">Thrown when <paramref name="password"/> is wrong.</exception>
public Task<UserTokenCreateResult> CreateTokenAsync(string username, string password, DateTime? expireAt = null);
diff --git a/BackEnd/Timeline/Services/Token/Resource.Designer.cs b/BackEnd/Timeline/Services/Token/Resource.Designer.cs
index 07b0057f..ac6f3707 100644
--- a/BackEnd/Timeline/Services/Token/Resource.Designer.cs
+++ b/BackEnd/Timeline/Services/Token/Resource.Designer.cs
@@ -61,6 +61,15 @@ namespace Timeline.Services.Token {
}
/// <summary>
+ /// Looks up a localized string similar to Jwt key is not found. Maybe you forget to do the migration..
+ /// </summary>
+ internal static string ExceptionJwtKeyNotExist {
+ get {
+ return ResourceManager.GetString("ExceptionJwtKeyNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The token didn&apos;t pass verification because {0}..
/// </summary>
internal static string ExceptionJwtUserTokenBadFormat {
diff --git a/BackEnd/Timeline/Services/Token/Resource.resx b/BackEnd/Timeline/Services/Token/Resource.resx
index 7abf2e75..06bf03f6 100644
--- a/BackEnd/Timeline/Services/Token/Resource.resx
+++ b/BackEnd/Timeline/Services/Token/Resource.resx
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="ExceptionJwtKeyNotExist" xml:space="preserve">
+ <value>Jwt key is not found. Maybe you forget to do the migration.</value>
+ </data>
<data name="ExceptionJwtUserTokenBadFormat" xml:space="preserve">
<value>The token didn't pass verification because {0}.</value>
</data>
diff --git a/BackEnd/Timeline/Services/Token/UserTokenHandler.cs b/BackEnd/Timeline/Services/Token/UserTokenHandler.cs
index 7b57a06c..c1633f4a 100644
--- a/BackEnd/Timeline/Services/Token/UserTokenHandler.cs
+++ b/BackEnd/Timeline/Services/Token/UserTokenHandler.cs
@@ -29,7 +29,7 @@ namespace Timeline.Services.Token
if (key == null)
{
- throw new InvalidOperationException(Resources.Services.UserTokenService.JwtKeyNotExist);
+ throw new InvalidOperationException(Resource.ExceptionJwtKeyNotExist);
}
_tokenSecurityKey = new SymmetricSecurityKey(key);
diff --git a/BackEnd/Timeline/Services/Token/UserTokenManager.cs b/BackEnd/Timeline/Services/Token/UserTokenManager.cs
index 5aa85a5e..7ccdfe0a 100644
--- a/BackEnd/Timeline/Services/Token/UserTokenManager.cs
+++ b/BackEnd/Timeline/Services/Token/UserTokenManager.cs
@@ -91,7 +91,7 @@ namespace Timeline.Services.Token
return user;
}
- catch (UserNotExistException e)
+ catch (EntityNotExistException e)
{
var exception = new UserTokenUserNotExistException(token, e);
_logger.LogInformation(exception, Resource.LogTokenVerifiedFail);
diff --git a/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs b/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs
index 7ec855aa..92f2429c 100644
--- a/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs
+++ b/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs
@@ -13,7 +13,7 @@ namespace Timeline.Services.User.Avatar
/// </summary>
/// <param name="userId">User id.</param>
/// <returns>The avatar digest.</returns>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
Task<ICacheableDataDigest> GetAvatarDigestAsync(long userId);
/// <summary>
@@ -21,7 +21,7 @@ namespace Timeline.Services.User.Avatar
/// </summary>
/// <param name="userId">User id.</param>
/// <returns>The avatar.</returns>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
Task<ByteData> GetAvatarAsync(long userId);
/// <summary>
@@ -31,7 +31,7 @@ namespace Timeline.Services.User.Avatar
/// <param name="avatar">The new avatar data.</param>
/// <returns>The digest of the avatar.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="avatar"/> is null.</exception>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
/// <exception cref="ImageException">Thrown if avatar is of bad format.</exception>
Task<ICacheableDataDigest> SetAvatarAsync(long userId, ByteData avatar);
@@ -39,7 +39,7 @@ namespace Timeline.Services.User.Avatar
/// Remove avatar of a user.
/// </summary>
/// <param name="userId">User id.</param>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
Task DeleteAvatarAsync(long userId);
}
}
diff --git a/BackEnd/Timeline/Services/User/BasicUserService.cs b/BackEnd/Timeline/Services/User/BasicUserService.cs
index 1f1b25f5..0ee8dabd 100644
--- a/BackEnd/Timeline/Services/User/BasicUserService.cs
+++ b/BackEnd/Timeline/Services/User/BasicUserService.cs
@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Timeline.Entities;
@@ -18,6 +19,18 @@ namespace Timeline.Services.User
_database = database;
}
+ protected static EntityNotExistException CreateUserNotExistException(string username)
+ {
+ return new EntityNotExistException(EntityTypes.User,
+ new Dictionary<string, object> { ["username"] = username });
+ }
+
+ protected static EntityNotExistException CreateUserNotExistException(long id)
+ {
+ return new EntityNotExistException(EntityTypes.User,
+ new Dictionary<string, object> { ["id"] = id });
+ }
+
public async Task<bool> CheckUserExistenceAsync(long id)
{
return await _database.Users.AnyAsync(u => u.Id == id);
@@ -34,7 +47,7 @@ namespace Timeline.Services.User
var entity = await _database.Users.Where(user => user.Username == username).Select(u => new { u.Id }).SingleOrDefaultAsync();
if (entity == null)
- throw new UserNotExistException(username);
+ throw CreateUserNotExistException(username);
return entity.Id;
}
@@ -44,20 +57,9 @@ namespace Timeline.Services.User
var entity = await _database.Users.Where(u => u.Id == userId).Select(u => new { u.UsernameChangeTime }).SingleOrDefaultAsync();
if (entity is null)
- throw new UserNotExistException(userId);
+ throw CreateUserNotExistException(userId);
return entity.UsernameChangeTime;
}
}
-
- public static class BasicUserServiceExtensions
- {
- public static async Task ThrowIfUserNotExist(this IBasicUserService service, long userId)
- {
- if (!await service.CheckUserExistenceAsync(userId))
- {
- throw new UserNotExistException(userId);
- }
- }
- }
}
diff --git a/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs b/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs
new file mode 100644
index 00000000..8a05f452
--- /dev/null
+++ b/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Timeline.Services.User
+{
+ public static class BasicUserServiceExtensions
+ {
+ public static async Task ThrowIfUserNotExist(this IBasicUserService service, long userId)
+ {
+ if (!await service.CheckUserExistenceAsync(userId))
+ {
+ throw new EntityNotExistException(EntityTypes.User,
+ new Dictionary<string, object> { ["id"] = userId });
+ }
+ }
+ }
+}
diff --git a/BackEnd/Timeline/Services/User/IBasicUserService.cs b/BackEnd/Timeline/Services/User/IBasicUserService.cs
index 0e30d733..0ae3fdff 100644
--- a/BackEnd/Timeline/Services/User/IBasicUserService.cs
+++ b/BackEnd/Timeline/Services/User/IBasicUserService.cs
@@ -22,7 +22,7 @@ namespace Timeline.Services.User
/// <returns>The id of the user.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="username"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="username"/> is of bad format.</exception>
- /// <exception cref="UserNotExistException">Thrown when the user with given username does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user with given username does not exist.</exception>
Task<long> GetUserIdByUsernameAsync(string username);
/// <summary>
@@ -30,7 +30,7 @@ namespace Timeline.Services.User
/// </summary>
/// <param name="userId">User id.</param>
/// <returns>The time.</returns>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
Task<DateTime> GetUsernameLastModifiedTimeAsync(long userId);
}
}
diff --git a/BackEnd/Timeline/Services/User/IUserPermissionService.cs b/BackEnd/Timeline/Services/User/IUserPermissionService.cs
index 7ff1275b..985a67f5 100644
--- a/BackEnd/Timeline/Services/User/IUserPermissionService.cs
+++ b/BackEnd/Timeline/Services/User/IUserPermissionService.cs
@@ -10,7 +10,7 @@ namespace Timeline.Services.User
/// <param name="userId">The id of the user.</param>
/// <param name="checkUserExistence">Whether check the user's existence.</param>
/// <returns>The permission list.</returns>
- /// <exception cref="UserNotExistException">Thrown when <paramref name="checkUserExistence"/> is true and user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when <paramref name="checkUserExistence"/> is true and user does not exist.</exception>
Task<UserPermissions> GetPermissionsOfUserAsync(long userId, bool checkUserExistence = true);
/// <summary>
@@ -18,7 +18,7 @@ namespace Timeline.Services.User
/// </summary>
/// <param name="userId">The id of the user.</param>
/// <param name="permission">The new permission.</param>
- /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
/// <exception cref="InvalidOperationOnRootUserException">Thrown when change root user's permission.</exception>
Task AddPermissionToUserAsync(long userId, UserPermission permission);
@@ -28,7 +28,7 @@ namespace Timeline.Services.User
/// <param name="userId">The id of the user.</param>
/// <param name="permission">The permission.</param>
/// <param name="checkUserExistence">Whether check the user's existence.</param>
- /// <exception cref="UserNotExistException">Thrown when <paramref name="checkUserExistence"/> is true and user does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when <paramref name="checkUserExistence"/> is true and user does not exist.</exception>
/// <exception cref="InvalidOperationOnRootUserException">Thrown when change root user's permission.</exception>
Task RemovePermissionFromUserAsync(long userId, UserPermission permission, bool checkUserExistence = true);
}
diff --git a/BackEnd/Timeline/Services/User/IUserService.cs b/BackEnd/Timeline/Services/User/IUserService.cs
index 06155c55..745bd524 100644
--- a/BackEnd/Timeline/Services/User/IUserService.cs
+++ b/BackEnd/Timeline/Services/User/IUserService.cs
@@ -12,7 +12,7 @@ namespace Timeline.Services.User
/// </summary>
/// <param name="id">The id of the user.</param>
/// <returns>The user info.</returns>
- /// <exception cref="UserNotExistException">Thrown when the user with given id does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user with given id does not exist.</exception>
Task<UserEntity> GetUserAsync(long id);
/// <summary>
@@ -38,7 +38,7 @@ namespace Timeline.Services.User
/// <param name="param">The new information.</param>
/// <returns>The new user info.</returns>
/// <exception cref="ArgumentException">Thrown when some fields in <paramref name="param"/> is bad.</exception>
- /// <exception cref="UserNotExistException">Thrown when user with given id does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when user with given id does not exist.</exception>
/// <remarks>
/// Version will increase if password is changed.
/// </remarks>
@@ -52,7 +52,7 @@ namespace Timeline.Services.User
/// <returns>User id.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="username"/> or <paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="username"/> is of bad format or <paramref name="password"/> is empty.</exception>
- /// <exception cref="UserNotExistException">Thrown when the user with given username does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user with given username does not exist.</exception>
/// <exception cref="BadPasswordException">Thrown when password is wrong.</exception>
Task<long> VerifyCredential(string username, string password);
@@ -64,7 +64,7 @@ namespace Timeline.Services.User
/// <param name="newPassword">New password.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="oldPassword"/> or <paramref name="newPassword"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown if <paramref name="oldPassword"/> or <paramref name="newPassword"/> is empty.</exception>
- /// <exception cref="UserNotExistException">Thrown if the user with given username does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown if the user with given username does not exist.</exception>
/// <exception cref="BadPasswordException">Thrown if the old password is wrong.</exception>
Task ChangePassword(long id, string oldPassword, string newPassword);
}
diff --git a/BackEnd/Timeline/Services/User/UserAlreadyExistException.cs b/BackEnd/Timeline/Services/User/UserAlreadyExistException.cs
deleted file mode 100644
index e257af74..00000000
--- a/BackEnd/Timeline/Services/User/UserAlreadyExistException.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-
-namespace Timeline.Services.User
-{
- /// <summary>
- /// The user requested does not exist.
- /// </summary>
- [Serializable]
- public class UserAlreadyExistException : EntityAlreadyExistException
- {
- public UserAlreadyExistException() : this(null, null, null) { }
- public UserAlreadyExistException(object? entity) : this(entity, null, null) { }
- public UserAlreadyExistException(object? entity, Exception? inner) : this(entity, null, inner) { }
- public UserAlreadyExistException(object? entity, string? message, Exception? inner)
- : base(EntityNames.User, entity, message ?? Resource.ExceptionUserAlreadyExist, inner)
- {
-
- }
-
- protected UserAlreadyExistException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-}
diff --git a/BackEnd/Timeline/Services/User/UserNotExistException.cs b/BackEnd/Timeline/Services/User/UserNotExistException.cs
deleted file mode 100644
index bc5d8d9e..00000000
--- a/BackEnd/Timeline/Services/User/UserNotExistException.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-
-namespace Timeline.Services.User
-{
- /// <summary>
- /// The user requested does not exist.
- /// </summary>
- [Serializable]
- public class UserNotExistException : EntityNotExistException
- {
- public UserNotExistException() : this(null, null, null, null) { }
- public UserNotExistException(string? username) : this(username, null, null, null) { }
- public UserNotExistException(string? username, Exception? inner) : this(username, null, null, inner) { }
- public UserNotExistException(long id) : this(null, id, null, null) { }
- public UserNotExistException(long id, Exception? inner) : this(null, id, null, inner) { }
- public UserNotExistException(string? username, long? id, string? message, Exception? inner)
- : base(EntityNames.User, message ?? Resource.ExceptionUserNotExist, inner)
- {
- Username = username;
- Id = id;
- }
-
- protected UserNotExistException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- /// <summary>
- /// The username of the user that does not exist.
- /// </summary>
- public string? Username { get; set; }
-
- /// <summary>
- /// The id of the user that does not exist.
- /// </summary>
- public long? Id { get; set; }
- }
-}
diff --git a/BackEnd/Timeline/Services/User/UserPermissionService.cs b/BackEnd/Timeline/Services/User/UserPermissionService.cs
index f9911c7f..f6f11c61 100644
--- a/BackEnd/Timeline/Services/User/UserPermissionService.cs
+++ b/BackEnd/Timeline/Services/User/UserPermissionService.cs
@@ -8,21 +8,19 @@ namespace Timeline.Services.User
public class UserPermissionService : IUserPermissionService
{
private readonly DatabaseContext _database;
+ private readonly IBasicUserService _basicUserService;
- public UserPermissionService(DatabaseContext database)
+ public UserPermissionService(DatabaseContext database, IBasicUserService basicUserService)
{
_database = database;
+ _basicUserService = basicUserService;
}
private async Task CheckUserExistence(long userId, bool checkUserExistence)
{
if (checkUserExistence)
{
- var existence = await _database.Users.AnyAsync(u => u.Id == userId);
- if (!existence)
- {
- throw new UserNotExistException(userId);
- }
+ await _basicUserService.ThrowIfUserNotExist(userId);
}
}
diff --git a/BackEnd/Timeline/Services/User/UserService.cs b/BackEnd/Timeline/Services/User/UserService.cs
index 443afb90..a47bc860 100644
--- a/BackEnd/Timeline/Services/User/UserService.cs
+++ b/BackEnd/Timeline/Services/User/UserService.cs
@@ -54,9 +54,10 @@ namespace Timeline.Services.User
}
}
- private static void ThrowUsernameConflict(object? user)
+ private static EntityAlreadyExistException CreateUsernameConflictException(string username)
{
- throw new UserAlreadyExistException(user);
+ throw new EntityAlreadyExistException(EntityTypes.User,
+ new Dictionary<string, object> { ["username"] = username });
}
public async Task<UserEntity> GetUserAsync(long id)
@@ -64,7 +65,7 @@ namespace Timeline.Services.User
var user = await _databaseContext.Users.Where(u => u.Id == id).SingleOrDefaultAsync();
if (user is null)
- throw new UserNotExistException(id);
+ throw CreateUserNotExistException(id);
return user;
}
@@ -89,7 +90,7 @@ namespace Timeline.Services.User
var conflict = await _databaseContext.Users.AnyAsync(u => u.Username == param.Username);
if (conflict)
- ThrowUsernameConflict(null);
+ throw CreateUsernameConflictException(param.Username);
var newEntity = new UserEntity
{
@@ -120,8 +121,8 @@ namespace Timeline.Services.User
}
var entity = await _databaseContext.Users.Where(u => u.Id == id).SingleOrDefaultAsync();
- if (entity == null)
- throw new UserNotExistException(id);
+ if (entity is null)
+ throw CreateUserNotExistException(id);
if (param is not null)
{
@@ -133,7 +134,7 @@ namespace Timeline.Services.User
{
var conflict = await _databaseContext.Users.AnyAsync(u => u.Username == username);
if (conflict)
- ThrowUsernameConflict(null);
+ throw CreateUsernameConflictException(username);
entity.Username = username;
entity.UsernameChangeTime = now;
@@ -180,7 +181,7 @@ namespace Timeline.Services.User
if (entity is null)
{
_logger.LogInformation(Resource.LogVerifyCredentialsUsernameBad, username);
- throw new UserNotExistException(username);
+ throw CreateUserNotExistException(username);
}
if (!_passwordService.VerifyPassword(entity.Password, password))
@@ -204,7 +205,7 @@ namespace Timeline.Services.User
var entity = await _databaseContext.Users.Where(u => u.Id == id).SingleOrDefaultAsync();
if (entity is null)
- throw new UserNotExistException(id);
+ throw CreateUserNotExistException(id);
if (!_passwordService.VerifyPassword(entity.Password, oldPassword))
throw new BadPasswordException(oldPassword);
diff --git a/BackEnd/Timeline/Startup.cs b/BackEnd/Timeline/Startup.cs
index 994dd7bf..774895fe 100644
--- a/BackEnd/Timeline/Startup.cs
+++ b/BackEnd/Timeline/Startup.cs
@@ -7,13 +7,14 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.ComponentModel;
-using System.Net.Mime;
using System.Text.Json.Serialization;
using Timeline.Auth;
using Timeline.Configs;
using Timeline.Entities;
+using Timeline.Filters;
using Timeline.Formatters;
using Timeline.Helpers;
+using Timeline.Models;
using Timeline.Models.Converters;
using Timeline.Routes;
using Timeline.Services;
@@ -66,8 +67,10 @@ namespace Timeline
{
setup.InputFormatters.Add(new StringInputFormatter());
setup.InputFormatters.Add(new ByteDataInputFormatter());
- setup.Filters.Add(new ConsumesAttribute(MediaTypeNames.Application.Json, "text/json"));
- setup.Filters.Add(new ProducesAttribute(MediaTypeNames.Application.Json, "text/json"));
+ setup.Filters.Add(new ConsumesAttribute(MimeTypes.ApplicationJson, MimeTypes.TextJson));
+ setup.Filters.Add(new ProducesAttribute(MimeTypes.ApplicationJson, MimeTypes.TextJson));
+ setup.Filters.Add<CatchEntityNotExistExceptionFilter>();
+ setup.Filters.Add<CatchEntityAlreadyExistExceptionFilter>();
setup.UseApiRoutePrefix("api");
})
.AddJsonOptions(options =>
diff --git a/BackEnd/Timeline/Swagger/DocumentDescriptionDocumentProcessor.cs b/BackEnd/Timeline/Swagger/DocumentDescriptionDocumentProcessor.cs
index a3452cea..fd2be64d 100644
--- a/BackEnd/Timeline/Swagger/DocumentDescriptionDocumentProcessor.cs
+++ b/BackEnd/Timeline/Swagger/DocumentDescriptionDocumentProcessor.cs
@@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
-using Timeline.Models.Http;
namespace Timeline.Swagger
{
diff --git a/BackEnd/Timeline/Timeline.csproj b/BackEnd/Timeline/Timeline.csproj
index 8cf1b31f..b9653b25 100644
--- a/BackEnd/Timeline/Timeline.csproj
+++ b/BackEnd/Timeline/Timeline.csproj
@@ -15,7 +15,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
- <NoWarn>1701;1702;1591</NoWarn>
+ <NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
@@ -58,85 +58,25 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
- <Compile Update="Resources\Controllers\ControllerAuthExtensions.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>ControllerAuthExtensions.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Controllers\TimelineController.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>TimelineController.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Controllers\TokenController.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>TokenController.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Controllers\UserAvatarController.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>UserAvatarController.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Controllers\UserController.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>UserController.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Entities.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Entities.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Filters.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Filters.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Helper\DataCacheHelper.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>DataCacheHelper.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Messages.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Messages.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Models\Http\Common.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Common.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Models\Http\Exception.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Exception.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Models\Validation\NicknameValidator.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>NicknameValidator.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Models\Validation\NameValidator.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>NameValidator.resx</DependentUpon>
+ <Compile Update="Filters\Resource.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resource.resx</DependentUpon>
</Compile>
- <Compile Update="Resources\Models\Validation\Validator.Designer.cs">
+ <Compile Update="Models\Http\Resource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
- <DependentUpon>Validator.resx</DependentUpon>
+ <DependentUpon>Resource.resx</DependentUpon>
</Compile>
- <Compile Update="Resources\Services\TimelineService.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>TimelineService.resx</DependentUpon>
+ <Compile Update="Models\Validation\Resource.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resource.resx</DependentUpon>
</Compile>
- <Compile Update="Resources\Services\UserTokenService.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>UserTokenService.resx</DependentUpon>
+ <Compile Update="Routes\Resource.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Update="Services\DatabaseManagement\Resource.Designer.cs">
<DesignTime>True</DesignTime>
@@ -194,70 +134,21 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Controllers\ControllerAuthExtensions.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>ControllerAuthExtensions.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Controllers\TimelineController.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>TimelineController.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Controllers\TokenController.resx">
- <SubType>Designer</SubType>
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>TokenController.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Controllers\UserAvatarController.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>UserAvatarController.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Controllers\UserController.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>UserController.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Entities.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Entities.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Filters.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Filters.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Helper\DataCacheHelper.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>DataCacheHelper.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Messages.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Messages.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Models\Http\Common.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Common.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Models\Http\Exception.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Exception.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Models\Validation\NicknameValidator.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>NicknameValidator.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Models\Validation\NameValidator.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>NameValidator.Designer.cs</LastGenOutput>
+ <EmbeddedResource Update="Filters\Resource.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Models\Validation\Validator.resx">
+ <EmbeddedResource Update="Models\Http\Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Validator.Designer.cs</LastGenOutput>
+ <LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Services\TimelineService.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>TimelineService.Designer.cs</LastGenOutput>
+ <EmbeddedResource Update="Models\Validation\Resource.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Services\UserTokenService.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>UserTokenService.Designer.cs</LastGenOutput>
+ <EmbeddedResource Update="Routes\Resource.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Services\DatabaseManagement\Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
diff --git a/FrontEnd/package.json b/FrontEnd/package.json
index 8caf2b21..96d845ba 100644
--- a/FrontEnd/package.json
+++ b/FrontEnd/package.json
@@ -54,13 +54,13 @@
]
},
"devDependencies": {
- "@babel/core": "^7.13.16",
+ "@babel/core": "^7.14.0",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-proposal-decorators": "^7.13.15",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
"@babel/plugin-proposal-optional-chaining": "^7.13.8",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
- "@babel/preset-env": "^7.13.15",
+ "@babel/preset-env": "^7.14.0",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",