| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- using Domain.Entities.Forum.Boards;
- using Domain.Entities.Forum.Comments;
- using Domain.Entities.Members;
- using Microsoft.EntityFrameworkCore;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- namespace Domain.Entities.Forum.Posts
- {
- [Table(nameof(Post))]
- [Index(nameof(BoardID))]
- [Index(nameof(BoardPrefixID))]
- [Index(nameof(MemberID))]
- [Index(nameof(ID), nameof(BoardID))]
- [Index(nameof(ID), nameof(BoardID), nameof(IsDeleted))]
- [Index(nameof(ID), nameof(BoardID), nameof(BoardPrefixID), nameof(IsDeleted), nameof(CreatedAt))]
- [Index(nameof(ID), nameof(BoardID), nameof(BoardPrefixID), nameof(IsDeleted), nameof(Views))]
- [Index(nameof(ID), nameof(BoardID), nameof(BoardPrefixID), nameof(IsDeleted), nameof(Comments))]
- [Index(nameof(ID), nameof(BoardID), nameof(BoardPrefixID), nameof(IsDeleted), nameof(Likes))]
- public class Post
- {
- [ForeignKey(nameof(BoardID))]
- public virtual Board Board { get; set; } = null!;
- [ForeignKey(nameof(BoardPrefixID))]
- public virtual BoardPrefix? BoardPrefix { get; set; }
- [ForeignKey(nameof(MemberID))]
- public virtual Member Member { get; set; } = null!;
- // 게시글 댓글
- public virtual List<Comment> Comment { get; set; } = [];
- // 게시글 이미지
- public virtual List<PostImage> PostImage { get; set; } = [];
- // 게시글 미디어
- public virtual List<PostMedia> PostMedia { get; set; } = [];
- // 게시글 파일
- public virtual List<PostFile> PostFile { get; set; } = [];
- // 게시글 링크
- public virtual List<PostLink> PostLink { get; set; } = [];
- // 게시글 태그
- public virtual List<PostTag> PostTag { get; set; } = [];
- // 게시글 반응
- public virtual List<PostReaction> PostReaction { get; set; } = [];
- // 게시글 즐겨찾기
- public virtual List<PostBookmark> PostBookmark { get; set; } = [];
- // 게시글 신고
- public virtual List<PostReport> PostReport { get; set; } = [];
- // 게시글 파일 다운로드 기록
- public virtual List<PostFileDownLog> PostFileDownLog { get; set; } = [];
- // 게시글 링크 클릭 기록
- public virtual List<PostLinkClickLog> PostLinkClickLog { get; set; } = [];
- // 게시글 변경 기록
- public virtual List<PostUpdateLog> PostUpdateLog { get; set; } = [];
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- [Comment("PK")]
- public int ID { get; set; }
- [Comment("게시판 ID")]
- public int BoardID { get; set; }
- [Comment("게시글 말머리 ID")]
- public int? BoardPrefixID { get; set; } = null;
- [Comment("회원 ID")]
- public int MemberID { get; set; }
- [Comment("제목")]
- [StringLength(255)]
- public string Subject { get; set; } = default!;
- [Comment("내용")]
- [StringLength(8000)]
- public string Content { get; set; } = default!;
- [Comment("회원 SID")]
- [StringLength(20)]
- public string? SID { get; set; }
- [Comment("회원 이메일")]
- [StringLength(60)]
- public string? Email { get; set; }
- [Comment("회원 이름")]
- [StringLength(20)]
- public string? Name { get; set; }
- [Comment("대표 이미지")]
- [StringLength(255)]
- public string? Thumbnail { get; set; }
- [Comment("답변 여부")]
- public bool IsReply { get; set; } = false;
- [Comment("익명 글 여부")]
- public bool IsAnonymous { get; set; } = false;
- [Comment("비밀글 여부")]
- public bool IsSecret { get; set; } = false;
- [Comment("일반 공지 여부")]
- public bool IsNotice { get; set; } = false;
- [Comment("전체 공지 여부")]
- public bool IsSpeaker { get; set; } = false;
- [Comment("삭제 여부")]
- public bool IsDeleted { get; set; } = false;
- [Comment("조회 수")]
- public int Views { get; set; } = 0;
- [Comment("좋아요")]
- public int Likes { get; set; } = 0;
- [Comment("싫어요")]
- public int Dislikes { get; set; } = 0;
- [Comment("댓글 수")]
- public int Comments { get; set; } = 0;
- [Comment("즐겨찾기 수")]
- public int Bookmarks { get; set; } = 0;
- [Comment("신고 수")]
- public int Reports { get; set; } = 0;
- [Comment("이미지 수")]
- public byte Images { get; set; } = 0;
- [Comment("미디어 수")]
- public byte Medias { get; set; } = 0;
- [Comment("파일 수")]
- public byte Files { get; set; } = 0;
- [Comment("Tag 수")]
- public byte Tags { get; set; } = 0;
- [Comment("IP")]
- [StringLength(50)]
- public string? IpAddress { get; set; }
- [Comment("User-Agent")]
- [StringLength(255)]
- public string? UserAgent { get; set; }
- [Comment("마지막 답변 일시")]
- [DataType(DataType.DateTime)]
- public DateTime? LastReplyUpdatedAt { get; set; }
- [Comment("마지막 댓글 일시")]
- [DataType(DataType.DateTime)]
- public DateTime? LastCommentUpdatedAt { get; set; }
- [Comment("삭제 일시")]
- [DataType(DataType.DateTime)]
- public DateTime? DeletedAt { get; set; }
- [Comment("수정 일시")]
- [DataType(DataType.DateTime)]
- public DateTime? UpdatedAt { get; set; }
- [Comment("등록 일시")]
- [DataType(DataType.DateTime)]
- public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
- }
- }
|