aboutsummaryrefslogtreecommitdiff
path: root/Timeline
diff options
context:
space:
mode:
Diffstat (limited to 'Timeline')
-rw-r--r--Timeline/Auth/Attribute.cs (renamed from Timeline/Authentication/Attribute.cs)2
-rw-r--r--Timeline/Auth/MyAuthenticationHandler.cs (renamed from Timeline/Authentication/AuthHandler.cs)18
-rw-r--r--Timeline/Auth/PrincipalExtensions.cs (renamed from Timeline/Authentication/PrincipalExtensions.cs)2
-rw-r--r--Timeline/Controllers/Testing/TestingAuthController.cs2
-rw-r--r--Timeline/Controllers/UserAvatarController.cs2
-rw-r--r--Timeline/Controllers/UserController.cs2
-rw-r--r--Timeline/Controllers/UserDetailController.cs49
-rw-r--r--Timeline/Entities/DatabaseContext.cs1
-rw-r--r--Timeline/Entities/User.cs2
-rw-r--r--Timeline/Entities/UserDetail.cs21
-rw-r--r--Timeline/ErrorCodes.cs19
-rw-r--r--Timeline/Filters/ContentHeaderAttributes.cs52
-rw-r--r--Timeline/Filters/Header.cs99
-rw-r--r--Timeline/Filters/User.cs88
-rw-r--r--Timeline/Formatters/StringInputFormatter.cs27
-rw-r--r--Timeline/Migrations/20190412102517_InitCreate.Designer.cs43
-rw-r--r--Timeline/Migrations/20190412102517_InitCreate.cs32
-rw-r--r--Timeline/Migrations/20190412144150_AddAdminUser.Designer.cs43
-rw-r--r--Timeline/Migrations/20190412144150_AddAdminUser.cs19
-rw-r--r--Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.Designer.cs46
-rw-r--r--Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.cs52
-rw-r--r--Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs49
-rw-r--r--Timeline/Migrations/20190719115321_Add-User-Version.cs23
-rw-r--r--Timeline/Migrations/20190817094408_Enhance1.Designer.cs52
-rw-r--r--Timeline/Migrations/20190817094408_Enhance1.cs41
-rw-r--r--Timeline/Migrations/20190817094602_RenameTableUserToUsers.Designer.cs52
-rw-r--r--Timeline/Migrations/20190817094602_RenameTableUserToUsers.cs39
-rw-r--r--Timeline/Migrations/20190818174505_AddUserAvatar.Designer.cs83
-rw-r--r--Timeline/Migrations/20190818174505_AddUserAvatar.cs62
-rw-r--r--Timeline/Migrations/20190819074906_AddAvatarLastModified.Designer.cs86
-rw-r--r--Timeline/Migrations/20190819074906_AddAvatarLastModified.cs114
-rw-r--r--Timeline/Migrations/20190819080823_AddIndexForUserName.Designer.cs88
-rw-r--r--Timeline/Migrations/20190819080823_AddIndexForUserName.cs22
-rw-r--r--Timeline/Migrations/20190820155221_AddAvatarETag.Designer.cs92
-rw-r--r--Timeline/Migrations/20190820155221_AddAvatarETag.cs23
-rw-r--r--Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.Designer.cs93
-rw-r--r--Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.cs32
-rw-r--r--Timeline/Migrations/20191031064541_Initialize.Designer.cs137
-rw-r--r--Timeline/Migrations/20191031064541_Initialize.cs104
-rw-r--r--Timeline/Migrations/DatabaseContextModelSnapshot.cs69
-rw-r--r--Timeline/Models/Http/Common.cs17
-rw-r--r--Timeline/Resources/Filters.Designer.cs135
-rw-r--r--Timeline/Resources/Filters.resx144
-rw-r--r--Timeline/Resources/Filters.zh.resx135
-rw-r--r--Timeline/Resources/Models/Http/Common.Designer.cs31
-rw-r--r--Timeline/Resources/Models/Http/Common.resx11
-rw-r--r--Timeline/Resources/Models/Http/Common.zh.resx13
-rw-r--r--Timeline/Resources/Services/UserDetailService.Designer.cs99
-rw-r--r--Timeline/Resources/Services/UserDetailService.resx132
-rw-r--r--Timeline/Services/DatabaseExtensions.cs6
-rw-r--r--Timeline/Services/UserAvatarService.cs9
-rw-r--r--Timeline/Services/UserDetailService.cs102
-rw-r--r--Timeline/Startup.cs18
-rw-r--r--Timeline/Timeline.csproj26
54 files changed, 1380 insertions, 1380 deletions
diff --git a/Timeline/Authentication/Attribute.cs b/Timeline/Auth/Attribute.cs
index 370b37e1..86d0109b 100644
--- a/Timeline/Authentication/Attribute.cs
+++ b/Timeline/Auth/Attribute.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Timeline.Entities;
-namespace Timeline.Authentication
+namespace Timeline.Auth
{
public class AdminAuthorizeAttribute : AuthorizeAttribute
{
diff --git a/Timeline/Authentication/AuthHandler.cs b/Timeline/Auth/MyAuthenticationHandler.cs
index 2b457eb1..f5dcd697 100644
--- a/Timeline/Authentication/AuthHandler.cs
+++ b/Timeline/Auth/MyAuthenticationHandler.cs
@@ -11,15 +11,15 @@ using Timeline.Models;
using Timeline.Services;
using static Timeline.Resources.Authentication.AuthHandler;
-namespace Timeline.Authentication
+namespace Timeline.Auth
{
- static class AuthConstants
+ public static class AuthenticationConstants
{
public const string Scheme = "Bearer";
public const string DisplayName = "My Jwt Auth Scheme";
}
- public class AuthOptions : AuthenticationSchemeOptions
+ public class MyAuthenticationOptions : AuthenticationSchemeOptions
{
/// <summary>
/// The query param key to search for token. If null then query params are not searched for token. Default to <c>"token"</c>.
@@ -27,15 +27,15 @@ namespace Timeline.Authentication
public string TokenQueryParamKey { get; set; } = "token";
}
- public class AuthHandler : AuthenticationHandler<AuthOptions>
+ public class MyAuthenticationHandler : AuthenticationHandler<MyAuthenticationOptions>
{
- private readonly ILogger<AuthHandler> _logger;
+ private readonly ILogger<MyAuthenticationHandler> _logger;
private readonly IUserService _userService;
- public AuthHandler(IOptionsMonitor<AuthOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IUserService userService)
+ public MyAuthenticationHandler(IOptionsMonitor<MyAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IUserService userService)
: base(options, logger, encoder, clock)
{
- _logger = logger.CreateLogger<AuthHandler>();
+ _logger = logger.CreateLogger<MyAuthenticationHandler>();
_userService = userService;
}
@@ -80,14 +80,14 @@ namespace Timeline.Authentication
{
var userInfo = await _userService.VerifyToken(token);
- var identity = new ClaimsIdentity(AuthConstants.Scheme);
+ var identity = new ClaimsIdentity(AuthenticationConstants.Scheme);
identity.AddClaim(new Claim(identity.NameClaimType, userInfo.Username, ClaimValueTypes.String));
identity.AddClaims(UserRoleConvert.ToArray(userInfo.Administrator).Select(role => new Claim(identity.RoleClaimType, role, ClaimValueTypes.String)));
var principal = new ClaimsPrincipal();
principal.AddIdentity(identity);
- return AuthenticateResult.Success(new AuthenticationTicket(principal, AuthConstants.Scheme));
+ return AuthenticateResult.Success(new AuthenticationTicket(principal, AuthenticationConstants.Scheme));
}
catch (Exception e) when (!(e is ArgumentException))
{
diff --git a/Timeline/Authentication/PrincipalExtensions.cs b/Timeline/Auth/PrincipalExtensions.cs
index 8d77ab62..ad7a887f 100644
--- a/Timeline/Authentication/PrincipalExtensions.cs
+++ b/Timeline/Auth/PrincipalExtensions.cs
@@ -1,7 +1,7 @@
using System.Security.Principal;
using Timeline.Entities;
-namespace Timeline.Authentication
+namespace Timeline.Auth
{
internal static class PrincipalExtensions
{
diff --git a/Timeline/Controllers/Testing/TestingAuthController.cs b/Timeline/Controllers/Testing/TestingAuthController.cs
index 67b5b2ef..4d3b3ec7 100644
--- a/Timeline/Controllers/Testing/TestingAuthController.cs
+++ b/Timeline/Controllers/Testing/TestingAuthController.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Timeline.Authentication;
+using Timeline.Auth;
namespace Timeline.Controllers.Testing
{
diff --git a/Timeline/Controllers/UserAvatarController.cs b/Timeline/Controllers/UserAvatarController.cs
index 7c77897d..7625f962 100644
--- a/Timeline/Controllers/UserAvatarController.cs
+++ b/Timeline/Controllers/UserAvatarController.cs
@@ -6,7 +6,7 @@ using Microsoft.Net.Http.Headers;
using System;
using System.Linq;
using System.Threading.Tasks;
-using Timeline.Authentication;
+using Timeline.Auth;
using Timeline.Filters;
using Timeline.Helpers;
using Timeline.Models.Http;
diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs
index 7b441c3a..0d950cd7 100644
--- a/Timeline/Controllers/UserController.cs
+++ b/Timeline/Controllers/UserController.cs
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Globalization;
using System.Threading.Tasks;
-using Timeline.Authentication;
+using Timeline.Auth;
using Timeline.Helpers;
using Timeline.Models;
using Timeline.Models.Http;
diff --git a/Timeline/Controllers/UserDetailController.cs b/Timeline/Controllers/UserDetailController.cs
new file mode 100644
index 00000000..9de9899e
--- /dev/null
+++ b/Timeline/Controllers/UserDetailController.cs
@@ -0,0 +1,49 @@
+using Microsoft.AspNetCore.Mvc;
+using System.Threading.Tasks;
+using Timeline.Filters;
+using Timeline.Models.Validation;
+using Timeline.Services;
+using System.ComponentModel.DataAnnotations;
+using Microsoft.AspNetCore.Authorization;
+
+namespace Timeline.Controllers
+{
+ [ApiController]
+ public class UserDetailController : Controller
+ {
+ private readonly IUserDetailService _service;
+
+ public UserDetailController(IUserDetailService service)
+ {
+ _service = service;
+ }
+
+ [HttpGet("users/{username}/nickname")]
+ [CatchUserNotExistException]
+ public async Task<ActionResult<string>> GetNickname([FromRoute][Username] string username)
+ {
+ return Ok(await _service.GetNickname(username));
+ }
+
+ [HttpPut("users/{username}/nickname")]
+ [Authorize]
+ [SelfOrAdmin]
+ [CatchUserNotExistException]
+ public async Task<ActionResult> PutNickname([FromRoute][Username] string username,
+ [FromBody][StringLength(10, MinimumLength = 1)] string body)
+ {
+ await _service.SetNickname(username, body);
+ return Ok();
+ }
+
+ [HttpDelete("users/{username}/nickname")]
+ [Authorize]
+ [SelfOrAdmin]
+ [CatchUserNotExistException]
+ public async Task<ActionResult> DeleteNickname([FromRoute][Username] string username)
+ {
+ await _service.SetNickname(username, null);
+ return Ok();
+ }
+ }
+}
diff --git a/Timeline/Entities/DatabaseContext.cs b/Timeline/Entities/DatabaseContext.cs
index e1b98e7d..6c005b30 100644
--- a/Timeline/Entities/DatabaseContext.cs
+++ b/Timeline/Entities/DatabaseContext.cs
@@ -19,5 +19,6 @@ namespace Timeline.Entities
public DbSet<User> Users { get; set; } = default!;
public DbSet<UserAvatar> UserAvatars { get; set; } = default!;
+ public DbSet<UserDetail> UserDetails { get; set; } = default!;
}
}
diff --git a/Timeline/Entities/User.cs b/Timeline/Entities/User.cs
index 6e8e4967..02352b03 100644
--- a/Timeline/Entities/User.cs
+++ b/Timeline/Entities/User.cs
@@ -28,5 +28,7 @@ namespace Timeline.Entities
public long Version { get; set; }
public UserAvatar? Avatar { get; set; }
+
+ public UserDetail? Detail { get; set; }
}
}
diff --git a/Timeline/Entities/UserDetail.cs b/Timeline/Entities/UserDetail.cs
new file mode 100644
index 00000000..45f87e2b
--- /dev/null
+++ b/Timeline/Entities/UserDetail.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Timeline.Entities
+{
+ [Table("user_details")]
+ public class UserDetail
+ {
+ [Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public long Id { get; set; }
+
+ [Column("nickname"), MaxLength(26)]
+ public string? Nickname { get; set; }
+
+ public long UserId { get; set; }
+ }
+}
diff --git a/Timeline/ErrorCodes.cs b/Timeline/ErrorCodes.cs
index 5e7f003a..c246953b 100644
--- a/Timeline/ErrorCodes.cs
+++ b/Timeline/ErrorCodes.cs
@@ -15,22 +15,21 @@
{
public const int InvalidModel = 10000000;
- public static class Header // cc = 01
+ public static class Header // cc = 0x
{
- public const int Missing_ContentType = 10000101; // dd = 01
- public const int Missing_ContentLength = 10000102; // dd = 02
- public const int Zero_ContentLength = 10000103; // dd = 03
- public const int BadFormat_IfNonMatch = 10000104; // dd = 04
+ public static class IfNonMatch // cc = 01
+ {
+ public const int BadFormat = 10000101;
+ }
}
- public static class Content // cc = 02
+ public static class Content // cc = 11
{
- public const int TooBig = 1000201;
- public const int UnmatchedLength_Smaller = 10030202;
- public const int UnmatchedLength_Bigger = 10030203;
+ public const int TooBig = 10001101;
+ public const int UnmatchedLength_Smaller = 10001102;
+ public const int UnmatchedLength_Bigger = 10001103;
}
}
}
-
}
}
diff --git a/Timeline/Filters/ContentHeaderAttributes.cs b/Timeline/Filters/ContentHeaderAttributes.cs
deleted file mode 100644
index 99bd1540..00000000
--- a/Timeline/Filters/ContentHeaderAttributes.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Localization;
-using Timeline.Models.Http;
-
-namespace Timeline.Filters
-{
- public class RequireContentTypeAttribute : ActionFilterAttribute
- {
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
- public override void OnActionExecuting(ActionExecutingContext context)
- {
- if (context.HttpContext.Request.ContentType == null)
- {
- context.Result = new BadRequestObjectResult(HeaderErrorResponse.MissingContentType());
- }
- }
- }
-
- public class RequireContentLengthAttribute : ActionFilterAttribute
- {
- public RequireContentLengthAttribute()
- : this(true)
- {
-
- }
-
- public RequireContentLengthAttribute(bool requireNonZero)
- {
- RequireNonZero = requireNonZero;
- }
-
- public bool RequireNonZero { get; set; }
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
- public override void OnActionExecuting(ActionExecutingContext context)
- {
- if (context.HttpContext.Request.ContentLength == null)
- {
- context.Result = new BadRequestObjectResult(HeaderErrorResponse.MissingContentLength());
- return;
- }
-
- if (RequireNonZero && context.HttpContext.Request.ContentLength.Value == 0)
- {
- context.Result = new BadRequestObjectResult(HeaderErrorResponse.ZeroContentLength());
- return;
- }
- }
- }
-}
diff --git a/Timeline/Filters/Header.cs b/Timeline/Filters/Header.cs
new file mode 100644
index 00000000..f5fb16aa
--- /dev/null
+++ b/Timeline/Filters/Header.cs
@@ -0,0 +1,99 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Timeline.Models.Http;
+using static Timeline.Resources.Filters;
+
+namespace Timeline
+{
+ public static partial class ErrorCodes
+ {
+ public static partial class Http
+ {
+ public static partial class Filter // bxx = 1xx
+ {
+ public static partial class Header // bbb = 100
+ {
+ public static class ContentType // cc = 01
+ {
+ public const int Missing = 11000101; // dd = 01
+ }
+
+ public static class ContentLength // cc = 02
+ {
+ public const int Missing = 11000201; // dd = 01
+ public const int Zero = 11000202; // dd = 02
+ }
+ }
+ }
+
+ }
+ }
+}
+
+namespace Timeline.Filters
+{
+ public class RequireContentTypeAttribute : ActionFilterAttribute
+ {
+ internal static CommonResponse CreateResponse()
+ {
+ return new CommonResponse(
+ ErrorCodes.Http.Filter.Header.ContentType.Missing,
+ MessageHeaderContentTypeMissing);
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
+ public override void OnActionExecuting(ActionExecutingContext context)
+ {
+ if (context.HttpContext.Request.ContentType == null)
+ {
+ context.Result = new BadRequestObjectResult(CreateResponse());
+ }
+ }
+ }
+
+ public class RequireContentLengthAttribute : ActionFilterAttribute
+ {
+ internal static CommonResponse CreateMissingResponse()
+ {
+ return new CommonResponse(
+ ErrorCodes.Http.Filter.Header.ContentLength.Missing,
+ MessageHeaderContentLengthMissing);
+ }
+
+ internal static CommonResponse CreateZeroResponse()
+ {
+ return new CommonResponse(
+ ErrorCodes.Http.Filter.Header.ContentLength.Zero,
+ MessageHeaderContentLengthZero);
+ }
+
+ public RequireContentLengthAttribute()
+ : this(true)
+ {
+
+ }
+
+ public RequireContentLengthAttribute(bool requireNonZero)
+ {
+ RequireNonZero = requireNonZero;
+ }
+
+ public bool RequireNonZero { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
+ public override void OnActionExecuting(ActionExecutingContext context)
+ {
+ if (context.HttpContext.Request.ContentLength == null)
+ {
+ context.Result = new BadRequestObjectResult(CreateMissingResponse());
+ return;
+ }
+
+ if (RequireNonZero && context.HttpContext.Request.ContentLength.Value == 0)
+ {
+ context.Result = new BadRequestObjectResult(CreateZeroResponse());
+ return;
+ }
+ }
+ }
+}
diff --git a/Timeline/Filters/User.cs b/Timeline/Filters/User.cs
new file mode 100644
index 00000000..16c76750
--- /dev/null
+++ b/Timeline/Filters/User.cs
@@ -0,0 +1,88 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using System;
+using Timeline.Auth;
+using Timeline.Models.Http;
+using Timeline.Services;
+using static Timeline.Resources.Filters;
+
+namespace Timeline
+{
+ public static partial class ErrorCodes
+ {
+ public static partial class Http
+ {
+ public static partial class Filter // bxx = 1xx
+ {
+ public static class User // bbb = 101
+ {
+ public const int NotExist = 11010101;
+
+ public const int NotSelfOrAdminForbid = 11010201;
+ }
+ }
+ }
+ }
+}
+
+namespace Timeline.Filters
+{
+ public class SelfOrAdminAttribute : ActionFilterAttribute
+ {
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
+ public override void OnActionExecuting(ActionExecutingContext context)
+ {
+ var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<SelfOrAdminAttribute>>();
+
+ var user = context.HttpContext.User;
+
+ if (user == null)
+ {
+ logger.LogError(LogSelfOrAdminNoUser);
+ return;
+ }
+
+ if (context.ModelState.TryGetValue("username", out var model))
+ {
+ if (model.RawValue is string username)
+ {
+ if (!user.IsAdministrator() && user.Identity.Name != username)
+ {
+ context.Result = new ObjectResult(
+ new CommonResponse(ErrorCodes.Http.Filter.User.NotSelfOrAdminForbid, MessageSelfOrAdminForbid))
+ { StatusCode = StatusCodes.Status403Forbidden };
+ }
+ }
+ else
+ {
+ logger.LogError(LogSelfOrAdminUsernameNotString);
+ }
+ }
+ else
+ {
+ logger.LogError(LogSelfOrAdminNoUsername);
+ }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
+ public class CatchUserNotExistExceptionAttribute : ExceptionFilterAttribute
+ {
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "ASP.Net already checked.")]
+ public override void OnException(ExceptionContext context)
+ {
+ if (context.Exception is UserNotExistException)
+ {
+ var body = new CommonResponse(ErrorCodes.Http.Filter.User.NotExist, MessageUserNotExist);
+
+ if (context.HttpContext.Request.Method == "GET")
+ context.Result = new NotFoundObjectResult(body);
+ else
+ context.Result = new BadRequestObjectResult(body);
+ }
+ }
+ }
+}
diff --git a/Timeline/Formatters/StringInputFormatter.cs b/Timeline/Formatters/StringInputFormatter.cs
new file mode 100644
index 00000000..90847e36
--- /dev/null
+++ b/Timeline/Formatters/StringInputFormatter.cs
@@ -0,0 +1,27 @@
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.Net.Http.Headers;
+using System.IO;
+using System.Net.Mime;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Timeline.Formatters
+{
+ public class StringInputFormatter : TextInputFormatter
+ {
+ public StringInputFormatter()
+ {
+ SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Text.Plain));
+ SupportedEncodings.Add(Encoding.UTF8);
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
+ public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context, Encoding effectiveEncoding)
+ {
+ var request = context.HttpContext.Request;
+ using var reader = new StreamReader(request.Body, effectiveEncoding);
+ var stringContent = await reader.ReadToEndAsync();
+ return await InputFormatterResult.SuccessAsync(stringContent);
+ }
+ }
+}
diff --git a/Timeline/Migrations/20190412102517_InitCreate.Designer.cs b/Timeline/Migrations/20190412102517_InitCreate.Designer.cs
deleted file mode 100644
index 86a46720..00000000
--- a/Timeline/Migrations/20190412102517_InitCreate.Designer.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// <auto-generated />
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190412102517_InitCreate")]
- partial class InitCreate
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Models.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .HasColumnName("name");
-
- b.Property<string>("RoleString")
- .HasColumnName("roles");
-
- b.HasKey("Id");
-
- b.ToTable("user");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190412102517_InitCreate.cs b/Timeline/Migrations/20190412102517_InitCreate.cs
deleted file mode 100644
index 55930f6d..00000000
--- a/Timeline/Migrations/20190412102517_InitCreate.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class InitCreate : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "user",
- columns: table => new
- {
- id = table.Column<long>(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- name = table.Column<string>(nullable: true),
- password = table.Column<string>(nullable: true),
- roles = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_user", x => x.id);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "user");
- }
- }
-}
diff --git a/Timeline/Migrations/20190412144150_AddAdminUser.Designer.cs b/Timeline/Migrations/20190412144150_AddAdminUser.Designer.cs
deleted file mode 100644
index 2e6b5f74..00000000
--- a/Timeline/Migrations/20190412144150_AddAdminUser.Designer.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// <auto-generated />
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190412144150_AddAdminUser")]
- partial class AddAdminUser
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Models.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .HasColumnName("name");
-
- b.Property<string>("RoleString")
- .HasColumnName("roles");
-
- b.HasKey("Id");
-
- b.ToTable("user");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190412144150_AddAdminUser.cs b/Timeline/Migrations/20190412144150_AddAdminUser.cs
deleted file mode 100644
index b6760f3e..00000000
--- a/Timeline/Migrations/20190412144150_AddAdminUser.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-using Timeline.Services;
-
-namespace Timeline.Migrations
-{
- public partial class AddAdminUser : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.InsertData("user", new string[] { "name", "password", "roles" },
- new string[] { "crupest", new PasswordService().HashPassword("yang0101"), "user,admin" });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DeleteData("user", "name", "crupest");
- }
- }
-}
diff --git a/Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.Designer.cs b/Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.Designer.cs
deleted file mode 100644
index 263efb8a..00000000
--- a/Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.Designer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// <auto-generated />
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190412153003_MakeColumnsInUserNotNull")]
- partial class MakeColumnsInUserNotNull
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Models.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name");
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.HasKey("Id");
-
- b.ToTable("user");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.cs b/Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.cs
deleted file mode 100644
index 12053906..00000000
--- a/Timeline/Migrations/20190412153003_MakeColumnsInUserNotNull.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class MakeColumnsInUserNotNull : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn<string>(
- name: "roles",
- table: "user",
- nullable: false,
- oldClrType: typeof(string),
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "name",
- table: "user",
- nullable: false,
- oldClrType: typeof(string),
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "password",
- table: "user",
- nullable: false,
- oldClrType: typeof(string),
- oldNullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn<string>(
- name: "roles",
- table: "user",
- nullable: true,
- oldClrType: typeof(string));
-
- migrationBuilder.AlterColumn<string>(
- name: "name",
- table: "user",
- nullable: true,
- oldClrType: typeof(string));
-
- migrationBuilder.AlterColumn<string>(
- name: "password",
- table: "user",
- nullable: true,
- oldClrType: typeof(string));
- }
- }
-}
diff --git a/Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs b/Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs
deleted file mode 100644
index d61259b5..00000000
--- a/Timeline/Migrations/20190719115321_Add-User-Version.Designer.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// <auto-generated />
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190719115321_Add-User-Version")]
- partial class AddUserVersion
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Models.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name");
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .HasColumnName("version");
-
- b.HasKey("Id");
-
- b.ToTable("user");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190719115321_Add-User-Version.cs b/Timeline/Migrations/20190719115321_Add-User-Version.cs
deleted file mode 100644
index 4d6bd60a..00000000
--- a/Timeline/Migrations/20190719115321_Add-User-Version.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class AddUserVersion : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<long>(
- name: "version",
- table: "user",
- nullable: false,
- defaultValue: 0L);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "version",
- table: "user");
- }
- }
-}
diff --git a/Timeline/Migrations/20190817094408_Enhance1.Designer.cs b/Timeline/Migrations/20190817094408_Enhance1.Designer.cs
deleted file mode 100644
index 89d159dd..00000000
--- a/Timeline/Migrations/20190817094408_Enhance1.Designer.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// <auto-generated />
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190817094408_Enhance1")]
- partial class Enhance1
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.ToTable("user");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190817094408_Enhance1.cs b/Timeline/Migrations/20190817094408_Enhance1.cs
deleted file mode 100644
index 0eae3ef9..00000000
--- a/Timeline/Migrations/20190817094408_Enhance1.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class Enhance1 : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn<long>(
- name: "version",
- table: "user",
- nullable: false,
- defaultValue: 0L,
- oldClrType: typeof(long));
-
- migrationBuilder.AlterColumn<string>(
- name: "name",
- table: "user",
- maxLength: 26,
- nullable: false,
- oldClrType: typeof(string));
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn<long>(
- name: "version",
- table: "user",
- nullable: false,
- oldClrType: typeof(long),
- oldDefaultValue: 0L);
-
- migrationBuilder.AlterColumn<string>(
- name: "name",
- table: "user",
- nullable: false,
- oldClrType: typeof(string),
- oldMaxLength: 26);
- }
- }
-}
diff --git a/Timeline/Migrations/20190817094602_RenameTableUserToUsers.Designer.cs b/Timeline/Migrations/20190817094602_RenameTableUserToUsers.Designer.cs
deleted file mode 100644
index 6ad4d475..00000000
--- a/Timeline/Migrations/20190817094602_RenameTableUserToUsers.Designer.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// <auto-generated />
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190817094602_RenameTableUserToUsers")]
- partial class RenameTableUserToUsers
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.ToTable("users");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190817094602_RenameTableUserToUsers.cs b/Timeline/Migrations/20190817094602_RenameTableUserToUsers.cs
deleted file mode 100644
index 042096eb..00000000
--- a/Timeline/Migrations/20190817094602_RenameTableUserToUsers.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class RenameTableUserToUsers : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropPrimaryKey(
- name: "PK_user",
- table: "user");
-
- migrationBuilder.RenameTable(
- name: "user",
- newName: "users");
-
- migrationBuilder.AddPrimaryKey(
- name: "PK_users",
- table: "users",
- column: "id");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropPrimaryKey(
- name: "PK_users",
- table: "users");
-
- migrationBuilder.RenameTable(
- name: "users",
- newName: "user");
-
- migrationBuilder.AddPrimaryKey(
- name: "PK_user",
- table: "user",
- column: "id");
- }
- }
-}
diff --git a/Timeline/Migrations/20190818174505_AddUserAvatar.Designer.cs b/Timeline/Migrations/20190818174505_AddUserAvatar.Designer.cs
deleted file mode 100644
index b0a105d0..00000000
--- a/Timeline/Migrations/20190818174505_AddUserAvatar.Designer.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-// <auto-generated />
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190818174505_AddUserAvatar")]
- partial class AddUserAvatar
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<long?>("AvatarId");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.HasIndex("AvatarId");
-
- b.ToTable("users");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<byte[]>("Data")
- .IsRequired()
- .HasColumnName("data");
-
- b.Property<string>("Type")
- .IsRequired()
- .HasColumnName("type");
-
- b.HasKey("Id");
-
- b.ToTable("user_avatars");
- });
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.HasOne("Timeline.Entities.UserAvatar", "Avatar")
- .WithMany()
- .HasForeignKey("AvatarId");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190818174505_AddUserAvatar.cs b/Timeline/Migrations/20190818174505_AddUserAvatar.cs
deleted file mode 100644
index 7e0843c4..00000000
--- a/Timeline/Migrations/20190818174505_AddUserAvatar.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class AddUserAvatar : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<long>(
- name: "AvatarId",
- table: "users",
- nullable: true);
-
- migrationBuilder.CreateTable(
- name: "user_avatars",
- columns: table => new
- {
- id = table.Column<long>(nullable: false)
- .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- data = table.Column<byte[]>(nullable: false),
- type = table.Column<string>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_user_avatars", x => x.id);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_users_AvatarId",
- table: "users",
- column: "AvatarId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_users_user_avatars_AvatarId",
- table: "users",
- column: "AvatarId",
- principalTable: "user_avatars",
- principalColumn: "id",
- onDelete: ReferentialAction.Restrict);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_users_user_avatars_AvatarId",
- table: "users");
-
- migrationBuilder.DropTable(
- name: "user_avatars");
-
- migrationBuilder.DropIndex(
- name: "IX_users_AvatarId",
- table: "users");
-
- migrationBuilder.DropColumn(
- name: "AvatarId",
- table: "users");
- }
- }
-}
diff --git a/Timeline/Migrations/20190819074906_AddAvatarLastModified.Designer.cs b/Timeline/Migrations/20190819074906_AddAvatarLastModified.Designer.cs
deleted file mode 100644
index a6fe7941..00000000
--- a/Timeline/Migrations/20190819074906_AddAvatarLastModified.Designer.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-// <auto-generated />
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190819074906_AddAvatarLastModified")]
- partial class AddAvatarLastModified
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.ToTable("users");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<byte[]>("Data")
- .HasColumnName("data");
-
- b.Property<DateTime>("LastModified")
- .HasColumnName("last_modified");
-
- b.Property<string>("Type")
- .HasColumnName("type");
-
- b.Property<long>("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("user_avatars");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.HasOne("Timeline.Entities.User")
- .WithOne("Avatar")
- .HasForeignKey("Timeline.Entities.UserAvatar", "UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190819074906_AddAvatarLastModified.cs b/Timeline/Migrations/20190819074906_AddAvatarLastModified.cs
deleted file mode 100644
index d9b5e8cf..00000000
--- a/Timeline/Migrations/20190819074906_AddAvatarLastModified.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class AddAvatarLastModified : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_users_user_avatars_AvatarId",
- table: "users");
-
- migrationBuilder.DropIndex(
- name: "IX_users_AvatarId",
- table: "users");
-
- migrationBuilder.DropColumn(
- name: "AvatarId",
- table: "users");
-
- migrationBuilder.AlterColumn<string>(
- name: "type",
- table: "user_avatars",
- nullable: true,
- oldClrType: typeof(string));
-
- migrationBuilder.AlterColumn<byte[]>(
- name: "data",
- table: "user_avatars",
- nullable: true,
- oldClrType: typeof(byte[]));
-
- migrationBuilder.AddColumn<DateTime>(
- name: "last_modified",
- table: "user_avatars",
- nullable: false,
- defaultValue: DateTime.Now);
-
- migrationBuilder.AddColumn<long>(
- name: "UserId",
- table: "user_avatars",
- nullable: false,
- defaultValue: 0L);
-
- migrationBuilder.CreateIndex(
- name: "IX_user_avatars_UserId",
- table: "user_avatars",
- column: "UserId",
- unique: true);
-
- migrationBuilder.AddForeignKey(
- name: "FK_user_avatars_users_UserId",
- table: "user_avatars",
- column: "UserId",
- principalTable: "users",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
-
- // Note! Remember to manually create avatar entities for all users.
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_user_avatars_users_UserId",
- table: "user_avatars");
-
- migrationBuilder.DropIndex(
- name: "IX_user_avatars_UserId",
- table: "user_avatars");
-
- migrationBuilder.DropColumn(
- name: "last_modified",
- table: "user_avatars");
-
- migrationBuilder.DropColumn(
- name: "UserId",
- table: "user_avatars");
-
- migrationBuilder.AddColumn<long>(
- name: "AvatarId",
- table: "users",
- nullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "type",
- table: "user_avatars",
- nullable: false,
- oldClrType: typeof(string),
- oldNullable: true);
-
- migrationBuilder.AlterColumn<byte[]>(
- name: "data",
- table: "user_avatars",
- nullable: false,
- oldClrType: typeof(byte[]),
- oldNullable: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_users_AvatarId",
- table: "users",
- column: "AvatarId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_users_user_avatars_AvatarId",
- table: "users",
- column: "AvatarId",
- principalTable: "user_avatars",
- principalColumn: "id",
- onDelete: ReferentialAction.Restrict);
- }
- }
-}
diff --git a/Timeline/Migrations/20190819080823_AddIndexForUserName.Designer.cs b/Timeline/Migrations/20190819080823_AddIndexForUserName.Designer.cs
deleted file mode 100644
index d45a057d..00000000
--- a/Timeline/Migrations/20190819080823_AddIndexForUserName.Designer.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-// <auto-generated />
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190819080823_AddIndexForUserName")]
- partial class AddIndexForUserName
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.HasIndex("Name");
-
- b.ToTable("users");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<byte[]>("Data")
- .HasColumnName("data");
-
- b.Property<DateTime>("LastModified")
- .HasColumnName("last_modified");
-
- b.Property<string>("Type")
- .HasColumnName("type");
-
- b.Property<long>("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("user_avatars");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.HasOne("Timeline.Entities.User")
- .WithOne("Avatar")
- .HasForeignKey("Timeline.Entities.UserAvatar", "UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190819080823_AddIndexForUserName.cs b/Timeline/Migrations/20190819080823_AddIndexForUserName.cs
deleted file mode 100644
index b910a174..00000000
--- a/Timeline/Migrations/20190819080823_AddIndexForUserName.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class AddIndexForUserName : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateIndex(
- name: "IX_users_name",
- table: "users",
- column: "name");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_users_name",
- table: "users");
- }
- }
-}
diff --git a/Timeline/Migrations/20190820155221_AddAvatarETag.Designer.cs b/Timeline/Migrations/20190820155221_AddAvatarETag.Designer.cs
deleted file mode 100644
index e7c7cb2f..00000000
--- a/Timeline/Migrations/20190820155221_AddAvatarETag.Designer.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// <auto-generated />
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190820155221_AddAvatarETag")]
- partial class AddAvatarETag
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.HasIndex("Name");
-
- b.ToTable("users");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<byte[]>("Data")
- .HasColumnName("data");
-
- b.Property<string>("ETag")
- .HasColumnName("etag")
- .HasMaxLength(30);
-
- b.Property<DateTime>("LastModified")
- .HasColumnName("last_modified");
-
- b.Property<string>("Type")
- .HasColumnName("type");
-
- b.Property<long>("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("user_avatars");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.HasOne("Timeline.Entities.User")
- .WithOne("Avatar")
- .HasForeignKey("Timeline.Entities.UserAvatar", "UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190820155221_AddAvatarETag.cs b/Timeline/Migrations/20190820155221_AddAvatarETag.cs
deleted file mode 100644
index db352b5d..00000000
--- a/Timeline/Migrations/20190820155221_AddAvatarETag.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class AddAvatarETag : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<string>(
- name: "etag",
- table: "user_avatars",
- maxLength: 30,
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "etag",
- table: "user_avatars");
- }
- }
-}
diff --git a/Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.Designer.cs b/Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.Designer.cs
deleted file mode 100644
index 420cd41c..00000000
--- a/Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.Designer.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-// <auto-generated />
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Timeline.Entities;
-
-namespace Timeline.Migrations
-{
- [DbContext(typeof(DatabaseContext))]
- [Migration("20190820155354_MakeUserNameIndexUnique")]
- partial class MakeUserNameIndexUnique
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
-
- modelBuilder.Entity("Timeline.Entities.User", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("EncryptedPassword")
- .IsRequired()
- .HasColumnName("password");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasColumnName("name")
- .HasMaxLength(26);
-
- b.Property<string>("RoleString")
- .IsRequired()
- .HasColumnName("roles");
-
- b.Property<long>("Version")
- .ValueGeneratedOnAdd()
- .HasColumnName("version")
- .HasDefaultValue(0L);
-
- b.HasKey("Id");
-
- b.HasIndex("Name")
- .IsUnique();
-
- b.ToTable("users");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.Property<long>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<byte[]>("Data")
- .HasColumnName("data");
-
- b.Property<string>("ETag")
- .HasColumnName("etag")
- .HasMaxLength(30);
-
- b.Property<DateTime>("LastModified")
- .HasColumnName("last_modified");
-
- b.Property<string>("Type")
- .HasColumnName("type");
-
- b.Property<long>("UserId");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique();
-
- b.ToTable("user_avatars");
- });
-
- modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
- {
- b.HasOne("Timeline.Entities.User")
- .WithOne("Avatar")
- .HasForeignKey("Timeline.Entities.UserAvatar", "UserId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.cs b/Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.cs
deleted file mode 100644
index 01d72450..00000000
--- a/Timeline/Migrations/20190820155354_MakeUserNameIndexUnique.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Timeline.Migrations
-{
- public partial class MakeUserNameIndexUnique : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_users_name",
- table: "users");
-
- migrationBuilder.CreateIndex(
- name: "IX_users_name",
- table: "users",
- column: "name",
- unique: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_users_name",
- table: "users");
-
- migrationBuilder.CreateIndex(
- name: "IX_users_name",
- table: "users",
- column: "name");
- }
- }
-}
diff --git a/Timeline/Migrations/20191031064541_Initialize.Designer.cs b/Timeline/Migrations/20191031064541_Initialize.Designer.cs
new file mode 100644
index 00000000..60cb4095
--- /dev/null
+++ b/Timeline/Migrations/20191031064541_Initialize.Designer.cs
@@ -0,0 +1,137 @@
+// <auto-generated />
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Timeline.Entities;
+
+namespace Timeline.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20191031064541_Initialize")]
+ partial class Initialize
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "3.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("Timeline.Entities.User", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("id")
+ .HasColumnType("bigint");
+
+ b.Property<string>("EncryptedPassword")
+ .IsRequired()
+ .HasColumnName("password")
+ .HasColumnType("longtext");
+
+ b.Property<string>("Name")
+ .IsRequired()
+ .HasColumnName("name")
+ .HasColumnType("varchar(26)")
+ .HasMaxLength(26);
+
+ b.Property<string>("RoleString")
+ .IsRequired()
+ .HasColumnName("roles")
+ .HasColumnType("longtext");
+
+ b.Property<long>("Version")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("version")
+ .HasColumnType("bigint")
+ .HasDefaultValue(0L);
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("users");
+ });
+
+ modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("id")
+ .HasColumnType("bigint");
+
+ b.Property<byte[]>("Data")
+ .HasColumnName("data")
+ .HasColumnType("longblob");
+
+ b.Property<string>("ETag")
+ .HasColumnName("etag")
+ .HasColumnType("varchar(30)")
+ .HasMaxLength(30);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnName("last_modified")
+ .HasColumnType("datetime(6)");
+
+ b.Property<string>("Type")
+ .HasColumnName("type")
+ .HasColumnType("longtext");
+
+ b.Property<long>("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId")
+ .IsUnique();
+
+ b.ToTable("user_avatars");
+ });
+
+ modelBuilder.Entity("Timeline.Entities.UserDetail", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnName("id")
+ .HasColumnType("bigint");
+
+ b.Property<string>("Nickname")
+ .HasColumnName("nickname")
+ .HasColumnType("varchar(26)")
+ .HasMaxLength(26);
+
+ b.Property<long>("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId")
+ .IsUnique();
+
+ b.ToTable("user_details");
+ });
+
+ modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
+ {
+ b.HasOne("Timeline.Entities.User", null)
+ .WithOne("Avatar")
+ .HasForeignKey("Timeline.Entities.UserAvatar", "UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Timeline.Entities.UserDetail", b =>
+ {
+ b.HasOne("Timeline.Entities.User", null)
+ .WithOne("Detail")
+ .HasForeignKey("Timeline.Entities.UserDetail", "UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Timeline/Migrations/20191031064541_Initialize.cs b/Timeline/Migrations/20191031064541_Initialize.cs
new file mode 100644
index 00000000..416f7c06
--- /dev/null
+++ b/Timeline/Migrations/20191031064541_Initialize.cs
@@ -0,0 +1,104 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Timeline.Migrations
+{
+ public partial class Initialize : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "users",
+ columns: table => new
+ {
+ id = table.Column<long>(nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ name = table.Column<string>(maxLength: 26, nullable: false),
+ password = table.Column<string>(nullable: false),
+ roles = table.Column<string>(nullable: false),
+ version = table.Column<long>(nullable: false, defaultValue: 0L)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_users", x => x.id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "user_avatars",
+ columns: table => new
+ {
+ id = table.Column<long>(nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ data = table.Column<byte[]>(nullable: true),
+ type = table.Column<string>(nullable: true),
+ etag = table.Column<string>(maxLength: 30, nullable: true),
+ last_modified = table.Column<DateTime>(nullable: false),
+ UserId = table.Column<long>(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_user_avatars", x => x.id);
+ table.ForeignKey(
+ name: "FK_user_avatars_users_UserId",
+ column: x => x.UserId,
+ principalTable: "users",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "user_details",
+ columns: table => new
+ {
+ id = table.Column<long>(nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ nickname = table.Column<string>(maxLength: 26, nullable: true),
+ UserId = table.Column<long>(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_user_details", x => x.id);
+ table.ForeignKey(
+ name: "FK_user_details_users_UserId",
+ column: x => x.UserId,
+ principalTable: "users",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_user_avatars_UserId",
+ table: "user_avatars",
+ column: "UserId",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_user_details_UserId",
+ table: "user_details",
+ column: "UserId",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_users_name",
+ table: "users",
+ column: "name",
+ unique: true);
+
+ migrationBuilder.InsertData("users", new string[] { "name", "password", "roles" },
+ new object[] { "administrator", "AQAAAAEAACcQAAAAENsspZrk8Wo+UuMyg6QuWJsNvRg6gVu4K/TumVod3h9GVLX9zDVuQQds3o7V8QWJ2w==", "user,admin" });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "user_avatars");
+
+ migrationBuilder.DropTable(
+ name: "user_details");
+
+ migrationBuilder.DropTable(
+ name: "users");
+ }
+ }
+}
diff --git a/Timeline/Migrations/DatabaseContextModelSnapshot.cs b/Timeline/Migrations/DatabaseContextModelSnapshot.cs
index 1328b855..697fbbec 100644
--- a/Timeline/Migrations/DatabaseContextModelSnapshot.cs
+++ b/Timeline/Migrations/DatabaseContextModelSnapshot.cs
@@ -14,31 +14,36 @@ namespace Timeline.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
+ .HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Timeline.Entities.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("bigint");
b.Property<string>("EncryptedPassword")
.IsRequired()
- .HasColumnName("password");
+ .HasColumnName("password")
+ .HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("name")
+ .HasColumnType("varchar(26)")
.HasMaxLength(26);
b.Property<string>("RoleString")
.IsRequired()
- .HasColumnName("roles");
+ .HasColumnName("roles")
+ .HasColumnType("longtext");
b.Property<long>("Version")
.ValueGeneratedOnAdd()
.HasColumnName("version")
+ .HasColumnType("bigint")
.HasDefaultValue(0L);
b.HasKey("Id");
@@ -53,22 +58,28 @@ namespace Timeline.Migrations
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
+ .HasColumnName("id")
+ .HasColumnType("bigint");
b.Property<byte[]>("Data")
- .HasColumnName("data");
+ .HasColumnName("data")
+ .HasColumnType("longblob");
b.Property<string>("ETag")
.HasColumnName("etag")
+ .HasColumnType("varchar(30)")
.HasMaxLength(30);
b.Property<DateTime>("LastModified")
- .HasColumnName("last_modified");
+ .HasColumnName("last_modified")
+ .HasColumnType("datetime(6)");
b.Property<string>("Type")
- .HasColumnName("type");
+ .HasColumnName("type")
+ .HasColumnType("longtext");
- b.Property<long>("UserId");
+ b.Property<long>("UserId")
+ .HasColumnType("bigint");
b.HasKey("Id");
@@ -78,32 +89,20 @@ namespace Timeline.Migrations
b.ToTable("user_avatars");
});
- modelBuilder.Entity("Timeline.Entities.UserDetailEntity", b =>
+ modelBuilder.Entity("Timeline.Entities.UserDetail", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
- .HasColumnName("id");
-
- b.Property<string>("Description")
- .HasColumnName("description");
-
- b.Property<string>("EMail")
- .HasColumnName("email")
- .HasMaxLength(50);
+ .HasColumnName("id")
+ .HasColumnType("bigint");
b.Property<string>("Nickname")
.HasColumnName("nickname")
- .HasMaxLength(15);
-
- b.Property<string>("PhoneNumber")
- .HasColumnName("phone_number")
- .HasMaxLength(15);
-
- b.Property<string>("QQ")
- .HasColumnName("qq")
- .HasMaxLength(15);
+ .HasColumnType("varchar(26)")
+ .HasMaxLength(26);
- b.Property<long>("UserId");
+ b.Property<long>("UserId")
+ .HasColumnType("bigint");
b.HasKey("Id");
@@ -115,18 +114,20 @@ namespace Timeline.Migrations
modelBuilder.Entity("Timeline.Entities.UserAvatar", b =>
{
- b.HasOne("Timeline.Entities.User")
+ b.HasOne("Timeline.Entities.User", null)
.WithOne("Avatar")
.HasForeignKey("Timeline.Entities.UserAvatar", "UserId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
- modelBuilder.Entity("Timeline.Entities.UserDetailEntity", b =>
+ modelBuilder.Entity("Timeline.Entities.UserDetail", b =>
{
- b.HasOne("Timeline.Entities.User")
+ b.HasOne("Timeline.Entities.User", null)
.WithOne("Detail")
- .HasForeignKey("Timeline.Entities.UserDetailEntity", "UserId")
- .OnDelete(DeleteBehavior.Cascade);
+ .HasForeignKey("Timeline.Entities.UserDetail", "UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
#pragma warning restore 612, 618
}
diff --git a/Timeline/Models/Http/Common.cs b/Timeline/Models/Http/Common.cs
index 2c9ee9e7..2a88b3a3 100644
--- a/Timeline/Models/Http/Common.cs
+++ b/Timeline/Models/Http/Common.cs
@@ -27,24 +27,9 @@ namespace Timeline.Models.Http
internal static class HeaderErrorResponse
{
- internal static CommonResponse MissingContentType()
- {
- return new CommonResponse(ErrorCodes.Http.Common.Header.Missing_ContentType, MessageHeaderMissingContentType);
- }
-
- internal static CommonResponse MissingContentLength()
- {
- return new CommonResponse(ErrorCodes.Http.Common.Header.Missing_ContentLength, MessageHeaderMissingContentLength);
- }
-
- internal static CommonResponse ZeroContentLength()
- {
- return new CommonResponse(ErrorCodes.Http.Common.Header.Zero_ContentLength, MessageHeaderZeroContentLength);
- }
-
internal static CommonResponse BadIfNonMatch()
{
- return new CommonResponse(ErrorCodes.Http.Common.Header.BadFormat_IfNonMatch, MessageHeaderBadIfNonMatch);
+ return new CommonResponse(ErrorCodes.Http.Common.Header.IfNonMatch.BadFormat, MessageHeaderIfNonMatchBad);
}
}
diff --git a/Timeline/Resources/Filters.Designer.cs b/Timeline/Resources/Filters.Designer.cs
new file mode 100644
index 00000000..3481e4ae
--- /dev/null
+++ b/Timeline/Resources/Filters.Designer.cs
@@ -0,0 +1,135 @@
+//------------------------------------------------------------------------------
+// <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);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header Content-Length is missing or of bad format..
+ /// </summary>
+ internal static string MessageHeaderContentLengthMissing {
+ get {
+ return ResourceManager.GetString("MessageHeaderContentLengthMissing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header Content-Length must not be 0..
+ /// </summary>
+ internal static string MessageHeaderContentLengthZero {
+ get {
+ return ResourceManager.GetString("MessageHeaderContentLengthZero", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header Content-Type is required..
+ /// </summary>
+ internal static string MessageHeaderContentTypeMissing {
+ get {
+ return ResourceManager.GetString("MessageHeaderContentTypeMissing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You can&apos;t access the resource unless you are the owner or administrator..
+ /// </summary>
+ internal static string MessageSelfOrAdminForbid {
+ get {
+ return ResourceManager.GetString("MessageSelfOrAdminForbid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The user does not exist..
+ /// </summary>
+ internal static string MessageUserNotExist {
+ get {
+ return ResourceManager.GetString("MessageUserNotExist", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/Timeline/Resources/Filters.resx b/Timeline/Resources/Filters.resx
new file mode 100644
index 00000000..b91d4612
--- /dev/null
+++ b/Timeline/Resources/Filters.resx
@@ -0,0 +1,144 @@
+<?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>
+ <data name="MessageHeaderContentLengthMissing" xml:space="preserve">
+ <value>Header Content-Length is missing or of bad format.</value>
+ </data>
+ <data name="MessageHeaderContentLengthZero" xml:space="preserve">
+ <value>Header Content-Length must not be 0.</value>
+ </data>
+ <data name="MessageHeaderContentTypeMissing" xml:space="preserve">
+ <value>Header Content-Type is required.</value>
+ </data>
+ <data name="MessageSelfOrAdminForbid" xml:space="preserve">
+ <value>You can't access the resource unless you are the owner or administrator.</value>
+ </data>
+ <data name="MessageUserNotExist" xml:space="preserve">
+ <value>The user does not exist.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/Timeline/Resources/Filters.zh.resx b/Timeline/Resources/Filters.zh.resx
new file mode 100644
index 00000000..159ac04a
--- /dev/null
+++ b/Timeline/Resources/Filters.zh.resx
@@ -0,0 +1,135 @@
+<?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="MessageHeaderContentLengthMissing" xml:space="preserve">
+ <value>请求头Content-Length缺失或者格式不对。</value>
+ </data>
+ <data name="MessageHeaderContentLengthZero" xml:space="preserve">
+ <value>请求头Content-Length不能为0。</value>
+ </data>
+ <data name="MessageHeaderContentTypeMissing" xml:space="preserve">
+ <value>缺少必需的请求头Content-Type。</value>
+ </data>
+ <data name="MessageSelfOrAdminForbid" xml:space="preserve">
+ <value>你无权访问该资源除非你是资源的拥有者或者管理员。</value>
+ </data>
+ <data name="MessageUserNotExist" xml:space="preserve">
+ <value>用户不存在。</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/Timeline/Resources/Models/Http/Common.Designer.cs b/Timeline/Resources/Models/Http/Common.Designer.cs
index 2df1e447..4eebd2bc 100644
--- a/Timeline/Resources/Models/Http/Common.Designer.cs
+++ b/Timeline/Resources/Models/Http/Common.Designer.cs
@@ -108,36 +108,9 @@ namespace Timeline.Resources.Models.Http {
/// <summary>
/// Looks up a localized string similar to Header If-Non-Match is of bad format..
/// </summary>
- internal static string MessageHeaderBadIfNonMatch {
+ internal static string MessageHeaderIfNonMatchBad {
get {
- return ResourceManager.GetString("MessageHeaderBadIfNonMatch", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Length is missing or of bad format..
- /// </summary>
- internal static string MessageHeaderMissingContentLength {
- get {
- return ResourceManager.GetString("MessageHeaderMissingContentLength", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Type is required..
- /// </summary>
- internal static string MessageHeaderMissingContentType {
- get {
- return ResourceManager.GetString("MessageHeaderMissingContentType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Length must not be 0..
- /// </summary>
- internal static string MessageHeaderZeroContentLength {
- get {
- return ResourceManager.GetString("MessageHeaderZeroContentLength", resourceCulture);
+ return ResourceManager.GetString("MessageHeaderIfNonMatchBad", resourceCulture);
}
}
diff --git a/Timeline/Resources/Models/Http/Common.resx b/Timeline/Resources/Models/Http/Common.resx
index 433c341c..540c6c58 100644
--- a/Timeline/Resources/Models/Http/Common.resx
+++ b/Timeline/Resources/Models/Http/Common.resx
@@ -132,18 +132,9 @@
<data name="MessageDeleteNotExist" xml:space="preserve">
<value>The item does not exist, so nothing is changed.</value>
</data>
- <data name="MessageHeaderBadIfNonMatch" xml:space="preserve">
+ <data name="MessageHeaderIfNonMatchBad" xml:space="preserve">
<value>Header If-Non-Match is of bad format.</value>
</data>
- <data name="MessageHeaderMissingContentLength" xml:space="preserve">
- <value>Header Content-Length is missing or of bad format.</value>
- </data>
- <data name="MessageHeaderMissingContentType" xml:space="preserve">
- <value>Header Content-Type is required.</value>
- </data>
- <data name="MessageHeaderZeroContentLength" xml:space="preserve">
- <value>Header Content-Length must not be 0.</value>
- </data>
<data name="MessagePutCreate" xml:space="preserve">
<value>A new item is created.</value>
</data>
diff --git a/Timeline/Resources/Models/Http/Common.zh.resx b/Timeline/Resources/Models/Http/Common.zh.resx
index cbdd6fb9..467916a2 100644
--- a/Timeline/Resources/Models/Http/Common.zh.resx
+++ b/Timeline/Resources/Models/Http/Common.zh.resx
@@ -132,17 +132,8 @@
<data name="MessageDeleteNotExist" xml:space="preserve">
<value>要删除的项目不存在,什么都没有修改。</value>
</data>
- <data name="MessageHeaderBadIfNonMatch" xml:space="preserve">
- <value>头If-Non-Match格式不对。</value>
- </data>
- <data name="MessageHeaderMissingContentLength" xml:space="preserve">
- <value>头Content-Length缺失或者格式不对。</value>
- </data>
- <data name="MessageHeaderMissingContentType" xml:space="preserve">
- <value>缺少必需的头Content-Type。</value>
- </data>
- <data name="MessageHeaderZeroContentLength" xml:space="preserve">
- <value>头Content-Length不能为0。</value>
+ <data name="MessageHeaderIfNonMatchBad" xml:space="preserve">
+ <value>请求头If-Non-Match格式不对。</value>
</data>
<data name="MessagePutCreate" xml:space="preserve">
<value>创建了一个新项目。</value>
diff --git a/Timeline/Resources/Services/UserDetailService.Designer.cs b/Timeline/Resources/Services/UserDetailService.Designer.cs
new file mode 100644
index 00000000..2f586b36
--- /dev/null
+++ b/Timeline/Resources/Services/UserDetailService.Designer.cs
@@ -0,0 +1,99 @@
+//------------------------------------------------------------------------------
+// <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 UserDetailService {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal UserDetailService() {
+ }
+
+ /// <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.UserDetailService", typeof(UserDetailService).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 Length of nickname can&apos;t be bigger than 10..
+ /// </summary>
+ internal static string ExceptionNicknameTooLong {
+ get {
+ return ResourceManager.GetString("ExceptionNicknameTooLong", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A user_details entity has been created. User id is {0}. Nickname is {1}..
+ /// </summary>
+ internal static string LogEntityNicknameCreate {
+ get {
+ return ResourceManager.GetString("LogEntityNicknameCreate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Nickname of a user_details entity has been updated to a new value. User id is {0}. New value is {1}..
+ /// </summary>
+ internal static string LogEntityNicknameSetNotNull {
+ get {
+ return ResourceManager.GetString("LogEntityNicknameSetNotNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Nickname of a user_details entity has been updated to null. User id is {0}..
+ /// </summary>
+ internal static string LogEntityNicknameSetToNull {
+ get {
+ return ResourceManager.GetString("LogEntityNicknameSetToNull", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/Timeline/Resources/Services/UserDetailService.resx b/Timeline/Resources/Services/UserDetailService.resx
new file mode 100644
index 00000000..ea32aeda
--- /dev/null
+++ b/Timeline/Resources/Services/UserDetailService.resx
@@ -0,0 +1,132 @@
+<?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="ExceptionNicknameTooLong" xml:space="preserve">
+ <value>Length of nickname can't be bigger than 10.</value>
+ </data>
+ <data name="LogEntityNicknameCreate" xml:space="preserve">
+ <value>A user_details entity has been created. User id is {0}. Nickname is {1}.</value>
+ </data>
+ <data name="LogEntityNicknameSetNotNull" xml:space="preserve">
+ <value>Nickname of a user_details entity has been updated to a new value. User id is {0}. New value is {1}.</value>
+ </data>
+ <data name="LogEntityNicknameSetToNull" xml:space="preserve">
+ <value>Nickname of a user_details entity has been updated to null. User id is {0}.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/Timeline/Services/DatabaseExtensions.cs b/Timeline/Services/DatabaseExtensions.cs
index 8cbc8fef..140c3146 100644
--- a/Timeline/Services/DatabaseExtensions.cs
+++ b/Timeline/Services/DatabaseExtensions.cs
@@ -9,6 +9,8 @@ namespace Timeline.Services
{
internal static class DatabaseExtensions
{
+ private static readonly UsernameValidator usernameValidator = new UsernameValidator();
+
/// <summary>
/// Check the existence and get the id of the user.
/// </summary>
@@ -17,11 +19,11 @@ namespace Timeline.Services
/// <exception cref="ArgumentNullException">Thrown if <paramref name="username"/> is null.</exception>
/// <exception cref="UsernameBadFormatException">Thrown if <paramref name="username"/> is of bad format.</exception>
/// <exception cref="UserNotExistException">Thrown if user does not exist.</exception>
- internal static async Task<long> CheckAndGetUser(DbSet<User> userDbSet, UsernameValidator validator, string username)
+ internal static async Task<long> CheckAndGetUser(DbSet<User> userDbSet, string? username)
{
if (username == null)
throw new ArgumentNullException(nameof(username));
- var (result, message) = validator.Validate(username);
+ var (result, message) = usernameValidator.Validate(username);
if (!result)
throw new UsernameBadFormatException(username, message);
diff --git a/Timeline/Services/UserAvatarService.cs b/Timeline/Services/UserAvatarService.cs
index 2afe9093..01201864 100644
--- a/Timeline/Services/UserAvatarService.cs
+++ b/Timeline/Services/UserAvatarService.cs
@@ -177,8 +177,6 @@ namespace Timeline.Services
private readonly IETagGenerator _eTagGenerator;
- private readonly UsernameValidator _usernameValidator;
-
private readonly IClock _clock;
public UserAvatarService(
@@ -194,13 +192,12 @@ namespace Timeline.Services
_defaultUserAvatarProvider = defaultUserAvatarProvider;
_avatarValidator = avatarValidator;
_eTagGenerator = eTagGenerator;
- _usernameValidator = new UsernameValidator();
_clock = clock;
}
public async Task<string> GetAvatarETag(string username)
{
- var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, _usernameValidator, username);
+ var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, username);
var eTag = (await _database.UserAvatars.Where(a => a.UserId == userId).Select(a => new { a.ETag }).SingleOrDefaultAsync())?.ETag;
if (eTag == null)
@@ -211,7 +208,7 @@ namespace Timeline.Services
public async Task<AvatarInfo> GetAvatar(string username)
{
- var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, _usernameValidator, username);
+ var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, username);
var avatarEntity = await _database.UserAvatars.Where(a => a.UserId == userId).Select(a => new { a.Type, a.Data, a.LastModified }).SingleOrDefaultAsync();
@@ -253,7 +250,7 @@ namespace Timeline.Services
throw new ArgumentException(Resources.Services.UserAvatarService.ExceptionAvatarTypeNullOrEmpty, nameof(avatar));
}
- var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, _usernameValidator, username);
+ var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, username);
var avatarEntity = await _database.UserAvatars.Where(a => a.UserId == userId).SingleOrDefaultAsync();
if (avatar == null)
diff --git a/Timeline/Services/UserDetailService.cs b/Timeline/Services/UserDetailService.cs
new file mode 100644
index 00000000..0b24e4e2
--- /dev/null
+++ b/Timeline/Services/UserDetailService.cs
@@ -0,0 +1,102 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Timeline.Entities;
+using static Timeline.Resources.Services.UserDetailService;
+
+namespace Timeline.Services
+{
+ public interface IUserDetailService
+ {
+ /// <summary>
+ /// Get the nickname of the user with given username.
+ /// If the user does not set a nickname, the username is returned as the nickname.
+ /// </summary>
+ /// <param name="username">The username of the user to get nickname of.</param>
+ /// <returns>The nickname of the user.</returns>
+ /// <exception cref="ArgumentNullException">Thrown when <paramref name="username"/> is null.</exception>
+ /// <exception cref="UsernameBadFormatException">Thrown when <paramref name="username"/> is of bad format.</exception>
+ /// <exception cref="UserNotExistException">Thrown when the user does not exist.</exception>
+ Task<string> GetNickname(string username);
+
+ /// <summary>
+ /// Set the nickname of the user with given username.
+ /// </summary>
+ /// <param name="username">The username of the user to set nickname of.</param>
+ /// <param name="nickname">The nickname. Pass null to unset.</param>
+ /// <exception cref="ArgumentNullException">Thrown when <paramref name="username"/> is null.</exception>
+ /// <exception cref="ArgumentException">Thrown when <paramref name="nickname"/> is not null but its length is bigger than 10.</exception>
+ /// <exception cref="UsernameBadFormatException">Thrown when <paramref name="username"/> is of bad format.</exception>
+ /// <exception cref="UserNotExistException">Thrown when the user does not exist.</exception>
+ Task SetNickname(string username, string? nickname);
+ }
+
+ public class UserDetailService : IUserDetailService
+ {
+ private readonly DatabaseContext _database;
+
+ private readonly ILogger<UserDetailService> _logger;
+
+ public UserDetailService(DatabaseContext database, ILogger<UserDetailService> logger)
+ {
+ _database = database;
+ _logger = logger;
+ }
+
+ public async Task<string> GetNickname(string username)
+ {
+ var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, username);
+ var nickname = _database.UserDetails.Where(d => d.UserId == userId).Select(d => new { d.Nickname }).SingleOrDefault()?.Nickname;
+ return nickname ?? username;
+ }
+
+ public async Task SetNickname(string username, string? nickname)
+ {
+ if (nickname != null && nickname.Length > 10)
+ {
+ throw new ArgumentException(ExceptionNicknameTooLong, nameof(nickname));
+ }
+ var userId = await DatabaseExtensions.CheckAndGetUser(_database.Users, username);
+ var userDetail = _database.UserDetails.Where(d => d.UserId == userId).SingleOrDefault();
+ if (nickname == null)
+ {
+ if (userDetail == null || userDetail.Nickname == null)
+ {
+ return;
+ }
+ else
+ {
+ userDetail.Nickname = null;
+ await _database.SaveChangesAsync();
+ _logger.LogInformation(LogEntityNicknameSetToNull, userId);
+ }
+ }
+ else
+ {
+ var create = userDetail == null;
+ if (create)
+ {
+ userDetail = new UserDetail
+ {
+ UserId = userId
+ };
+ }
+ userDetail!.Nickname = nickname;
+ if (create)
+ {
+ _database.UserDetails.Add(userDetail);
+ }
+ await _database.SaveChangesAsync();
+ if (create)
+ {
+ _logger.LogInformation(LogEntityNicknameCreate, userId, nickname);
+ }
+ else
+ {
+ _logger.LogInformation(LogEntityNicknameSetNotNull, userId, nickname);
+ }
+ }
+ }
+ }
+}
diff --git a/Timeline/Startup.cs b/Timeline/Startup.cs
index b44add6f..f6abf36d 100644
--- a/Timeline/Startup.cs
+++ b/Timeline/Startup.cs
@@ -8,9 +8,10 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Globalization;
-using Timeline.Authentication;
+using Timeline.Auth;
using Timeline.Configs;
using Timeline.Entities;
+using Timeline.Formatters;
using Timeline.Helpers;
using Timeline.Services;
@@ -31,17 +32,22 @@ namespace Timeline
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- services.AddControllers()
+ services.AddControllers(setup =>
+ {
+ setup.InputFormatters.Add(new StringInputFormatter());
+ })
.ConfigureApiBehaviorOptions(options =>
{
options.InvalidModelStateResponseFactory = InvalidModelResponseFactory.Factory;
})
- .AddNewtonsoftJson();
+ .AddNewtonsoftJson(); // TODO: Remove this.
services.Configure<JwtConfig>(Configuration.GetSection(nameof(JwtConfig)));
var jwtConfig = Configuration.GetSection(nameof(JwtConfig)).Get<JwtConfig>();
- services.AddAuthentication(AuthConstants.Scheme)
- .AddScheme<AuthOptions, AuthHandler>(AuthConstants.Scheme, AuthConstants.DisplayName, o => { });
+ services.AddAuthentication(AuthenticationConstants.Scheme)
+ .AddScheme<MyAuthenticationOptions, MyAuthenticationHandler>(AuthenticationConstants.Scheme, AuthenticationConstants.DisplayName, o => { });
+ services.AddAuthorization();
+
var corsConfig = Configuration.GetSection("Cors").Get<string[]>();
services.AddCors(setup =>
@@ -62,8 +68,8 @@ namespace Timeline
services.AddScoped<IJwtService, JwtService>();
services.AddTransient<IPasswordService, PasswordService>();
services.AddTransient<IClock, Clock>();
-
services.AddUserAvatarService();
+ services.AddScoped<IUserDetailService, UserDetailService>();
var databaseConfig = Configuration.GetSection(nameof(DatabaseConfig)).Get<DatabaseConfig>();
diff --git a/Timeline/Timeline.csproj b/Timeline/Timeline.csproj
index b989cd3b..bd195475 100644
--- a/Timeline/Timeline.csproj
+++ b/Timeline/Timeline.csproj
@@ -64,6 +64,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>UserController.resx</DependentUpon>
</Compile>
+ <Compile Update="Resources\Filters.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Filters.resx</DependentUpon>
+ </Compile>
<Compile Update="Resources\Models\Http\Common.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -89,6 +94,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>UserAvatarService.resx</DependentUpon>
</Compile>
+ <Compile Update="Resources\Services\UserDetailService.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>UserDetailService.resx</DependentUpon>
+ </Compile>
<Compile Update="Resources\Services\UserService.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -114,10 +124,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TokenController.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Controllers\TokenController.zh.resx">
- <SubType>Designer</SubType>
- <Generator></Generator>
- </EmbeddedResource>
<EmbeddedResource Update="Resources\Controllers\UserAvatarController.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UserAvatarController.Designer.cs</LastGenOutput>
@@ -126,6 +132,10 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UserController.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <EmbeddedResource Update="Resources\Filters.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Filters.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
<EmbeddedResource Update="Resources\Models\Http\Common.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Common.Designer.cs</LastGenOutput>
@@ -146,9 +156,17 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UserAvatarService.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <EmbeddedResource Update="Resources\Services\UserDetailService.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>UserDetailService.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
<EmbeddedResource Update="Resources\Services\UserService.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>UserService.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
+
+ <ItemGroup>
+ <Folder Include="Resources\Filters\" />
+ </ItemGroup>
</Project>