aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Entities/TimelineEntity.cs
blob: f5e22a544a5ce8b02ece7e25c88fc988b1a63384 (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
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Timeline.Entities
{
    public enum TimelineVisibility
    {
        /// <summary>
        /// All people including those without accounts.
        /// </summary>
        Public,
        /// <summary>
        /// Only people signed in.
        /// </summary>
        Register,
        /// <summary>
        /// Only member.
        /// </summary>
        Private
    }

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is entity object.")]
    [Table("timelines")]
    public class TimelineEntity
    {
        [Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }

        /// <summary>
        /// If null, then this timeline is a personal timeline.
        /// </summary>
        [Column("name")]
        public string? Name { get; set; }

        [Column("description")]
        public string? Description { get; set; }

        [Column("owner")]
        public long OwnerId { get; set; }

        [ForeignKey(nameof(OwnerId))]
        public User Owner { get; set; } = default!;

        [Column("visibility")]
        public TimelineVisibility Visibility { get; set; }

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

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

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