aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-19 21:37:15 +0800
committer杨宇千 <crupest@outlook.com>2019-10-19 21:37:15 +0800
commit7bcf891d9d68ac0f12570b94938347ab8eec3247 (patch)
treee6168234660307247111ee369a0b2123823614eb /Timeline/Models
parenta268999b8c975588c01b345829edfc0099af6f93 (diff)
downloadtimeline-7bcf891d9d68ac0f12570b94938347ab8eec3247.tar.gz
timeline-7bcf891d9d68ac0f12570b94938347ab8eec3247.tar.bz2
timeline-7bcf891d9d68ac0f12570b94938347ab8eec3247.zip
...
Diffstat (limited to 'Timeline/Models')
-rw-r--r--Timeline/Models/Http/Common.cs4
-rw-r--r--Timeline/Models/Http/Token.cs12
-rw-r--r--Timeline/Models/Http/User.cs12
-rw-r--r--Timeline/Models/UserDetail.cs12
4 files changed, 20 insertions, 20 deletions
diff --git a/Timeline/Models/Http/Common.cs b/Timeline/Models/Http/Common.cs
index 83e6a072..6f6dbc1e 100644
--- a/Timeline/Models/Http/Common.cs
+++ b/Timeline/Models/Http/Common.cs
@@ -38,8 +38,8 @@ namespace Timeline.Models.Http
Message = message;
}
- public int? Code { get; set; }
- public string Message { get; set; }
+ public int Code { get; set; }
+ public string? Message { get; set; }
}
public class CommonDataResponse<T> : CommonResponse
diff --git a/Timeline/Models/Http/Token.cs b/Timeline/Models/Http/Token.cs
index 615b6d8a..ea8b59ed 100644
--- a/Timeline/Models/Http/Token.cs
+++ b/Timeline/Models/Http/Token.cs
@@ -5,9 +5,9 @@ namespace Timeline.Models.Http
public class CreateTokenRequest
{
[Required]
- public string Username { get; set; }
+ public string Username { get; set; } = default!;
[Required]
- public string Password { get; set; }
+ public string Password { get; set; } = default!;
// in days, optional
[Range(1, 365)]
public int? Expire { get; set; }
@@ -15,18 +15,18 @@ namespace Timeline.Models.Http
public class CreateTokenResponse
{
- public string Token { get; set; }
- public UserInfo User { get; set; }
+ public string Token { get; set; } = default!;
+ public UserInfo User { get; set; } = default!;
}
public class VerifyTokenRequest
{
[Required]
- public string Token { get; set; }
+ public string Token { get; set; } = default!;
}
public class VerifyTokenResponse
{
- public UserInfo User { get; set; }
+ public UserInfo User { get; set; } = default!;
}
}
diff --git a/Timeline/Models/Http/User.cs b/Timeline/Models/Http/User.cs
index 4308a19c..98406fec 100644
--- a/Timeline/Models/Http/User.cs
+++ b/Timeline/Models/Http/User.cs
@@ -6,31 +6,31 @@ namespace Timeline.Models.Http
public class UserPutRequest
{
[Required]
- public string Password { get; set; }
+ public string Password { get; set; } = default!;
[Required]
public bool? Administrator { get; set; }
}
public class UserPatchRequest
{
- public string Password { get; set; }
+ public string? Password { get; set; }
public bool? Administrator { get; set; }
}
public class ChangeUsernameRequest
{
[Required]
- public string OldUsername { get; set; }
+ public string OldUsername { get; set; } = default!;
[Required, ValidateWith(typeof(UsernameValidator))]
- public string NewUsername { get; set; }
+ public string NewUsername { get; set; } = default!;
}
public class ChangePasswordRequest
{
[Required]
- public string OldPassword { get; set; }
+ public string OldPassword { get; set; } = default!;
[Required]
- public string NewPassword { get; set; }
+ public string NewPassword { get; set; } = default!;
}
}
diff --git a/Timeline/Models/UserDetail.cs b/Timeline/Models/UserDetail.cs
index 1a6c0c6a..302e3bb1 100644
--- a/Timeline/Models/UserDetail.cs
+++ b/Timeline/Models/UserDetail.cs
@@ -8,21 +8,21 @@ namespace Timeline.Models
public class UserDetail
{
[MaxLength(10)]
- public string Nickname { get; set; }
+ public string? Nickname { get; set; }
[ValidateWith(typeof(UserDetailValidators.QQValidator))]
[JsonProperty(PropertyName = "qq")]
- public string QQ { get; set; }
+ public string? QQ { get; set; }
[ValidateWith(typeof(UserDetailValidators.EMailValidator))]
- public string Email { get; set; }
+ public string? Email { get; set; }
[ValidateWith(typeof(UserDetailValidators.PhoneNumberValidator))]
- public string PhoneNumber { get; set; }
+ public string? PhoneNumber { get; set; }
- public string Description { get; set; }
+ public string? Description { get; set; }
- private static string CoerceEmptyToNull(string value)
+ private static string? CoerceEmptyToNull(string? value)
{
if (string.IsNullOrEmpty(value))
return null;