aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Entities/UserEntity.cs
blob: 267d0ef2d0f62d50286f8cb74acbdac37622f3f4 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Timeline.Services.User;

namespace Timeline.Entities
{
    [Table("users")]
    public class UserEntity
    {
        [Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }

        [Column("unique_id"), Required]
        public string UniqueId { get; set; } = default!;

        [Column("username"), Required]
        public string Username { get; set; } = default!;

        [Column("username_change_time")]
        public DateTime UsernameChangeTime { get; set; }

        [Column("password"), Required]
        public string Password { get; set; } = default!;

        [Column("version"), Required]
        public long Version { get; set; }

        [Column("nickname")]
        public string? Nickname { get; set; }

        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        [Column("last_modified")]
        public DateTime LastModified { get; set; }

        [Column("register_code")]
        public string? RegisterCode { get; set; }

        public UserAvatarEntity? Avatar { get; set; }

#pragma warning disable CA2227 // Collection properties should be read only
        /// <summary>
        /// Do not use this directly. Get permissions with <see cref="IUserPermissionService"/>.
        /// </summary>
        [Obsolete("Use IUserPermissionService instead.")]
        public List<UserPermissionEntity> Permissions { get; set; } = default!;

        public List<TimelineEntity> Timelines { get; set; } = default!;

        public List<TimelinePostEntity> TimelinePosts { get; set; } = default!;

        public List<TimelineMemberEntity> TimelinesJoined { get; set; } = default!;

        internal object MapToHttp(IUrlHelper url)
        {
            throw new NotImplementedException();
        }
#pragma warning restore CA2227 // Collection properties should be read only
    }
}