aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Entities/UserEntity.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2020-02-01 00:26:35 +0800
committerGitHub <noreply@github.com>2020-02-01 00:26:35 +0800
commit7b962cd876719fb871569ba3c97fb5545721a3f8 (patch)
treef02f8d57440c777d4732bc4439f82e8b25c6732c /Timeline/Entities/UserEntity.cs
parent289c7e1fada1f4dae6ce5e421e997ebddd55c2df (diff)
parentbcb0a2361467614531a337282da1fd23996924f1 (diff)
downloadtimeline-7b962cd876719fb871569ba3c97fb5545721a3f8.tar.gz
timeline-7b962cd876719fb871569ba3c97fb5545721a3f8.tar.bz2
timeline-7b962cd876719fb871569ba3c97fb5545721a3f8.zip
Merge pull request #56 from crupest/dev
Refactor API to be RESTful.
Diffstat (limited to 'Timeline/Entities/UserEntity.cs')
-rw-r--r--Timeline/Entities/UserEntity.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Timeline/Entities/UserEntity.cs b/Timeline/Entities/UserEntity.cs
new file mode 100644
index 00000000..946c3fa2
--- /dev/null
+++ b/Timeline/Entities/UserEntity.cs
@@ -0,0 +1,43 @@
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Timeline.Entities
+{
+ public static class UserRoles
+ {
+ public const string Admin = "admin";
+ public const string User = "user";
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is an entity class.")]
+ [Table("users")]
+ public class UserEntity
+ {
+ [Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public long Id { get; set; }
+
+ [Column("username"), MaxLength(26), Required]
+ public string Username { get; set; } = default!;
+
+ [Column("password"), Required]
+ public string Password { get; set; } = default!;
+
+ [Column("roles"), Required]
+ public string Roles { get; set; } = default!;
+
+ [Column("version"), Required]
+ public long Version { get; set; }
+
+ [Column("nickname"), MaxLength(100)]
+ public string? Nickname { get; set; }
+
+ public UserAvatarEntity? Avatar { get; set; }
+
+ public List<TimelineEntity> Timelines { get; set; } = default!;
+
+ public List<TimelinePostEntity> TimelinePosts { get; set; } = default!;
+
+ public List<TimelineMemberEntity> TimelinesJoined { get; set; } = default!;
+ }
+}