aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Entities/UserEntity.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-21 01:11:17 +0800
committercrupest <crupest@outlook.com>2020-01-21 01:11:17 +0800
commit747bf829351c30069647a44f98ac19f1a214370f (patch)
treea45506852659b9d8e2bfe0b9e58a496060f7cd9b /Timeline/Entities/UserEntity.cs
parent40eea04e1ec9b71c5215e9dce5a6963ea60cafaa (diff)
downloadtimeline-747bf829351c30069647a44f98ac19f1a214370f.tar.gz
timeline-747bf829351c30069647a44f98ac19f1a214370f.tar.bz2
timeline-747bf829351c30069647a44f98ac19f1a214370f.zip
...
Diffstat (limited to 'Timeline/Entities/UserEntity.cs')
-rw-r--r--Timeline/Entities/UserEntity.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/Timeline/Entities/UserEntity.cs b/Timeline/Entities/UserEntity.cs
new file mode 100644
index 00000000..83ef5621
--- /dev/null
+++ b/Timeline/Entities/UserEntity.cs
@@ -0,0 +1,42 @@
+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("name"), MaxLength(26), Required]
+ public string Name { get; set; } = default!;
+
+ [Column("password"), Required]
+ public string EncryptedPassword { get; set; } = default!;
+
+ [Column("roles"), Required]
+ public string RoleString { get; set; } = default!;
+
+ [Column("version"), Required]
+ public long Version { get; set; }
+
+ public UserAvatarEntity? Avatar { get; set; }
+
+ public UserDetailEntity? Detail { get; set; }
+
+ public List<TimelineEntity> Timelines { get; set; } = default!;
+
+ public List<TimelinePostEntity> TimelinePosts { get; set; } = default!;
+
+ public List<TimelineMemberEntity> TimelinesJoined { get; set; } = default!;
+ }
+}