aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Entities/UserEntity.cs
blob: 6c193da849b7805e911de6fb83b7bb42276ff35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace TimelineApp.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"), 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")]
        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!;
    }
}