diff --git a/VNH.Application/Common/Contants/SystemConstants.cs b/VNH.Application/Common/Contants/SystemConstants.cs index 4a843ce..5e1fac6 100644 --- a/VNH.Application/Common/Contants/SystemConstants.cs +++ b/VNH.Application/Common/Contants/SystemConstants.cs @@ -4,9 +4,11 @@ public static class SystemConstants { public const string Token = "Token"; public const string BaseAddress = "BaseAddress"; - // public const string UrlWeb = "https://vuanhpham25-001-site1.gtempurl.com/"; - public const string UrlWeb = "https://localhost:7138/"; - // public const string ConnectString = "Data Source=SQL5111.site4now.net;Initial Catalog=db_aa121e_vuanhpham25;UserShort Id=db_aa121e_vuanhpham25_admin;Password=30102002Mai"; - public const string ConnectString = "Data Source=.;Initial Catalog=VietNamHistory_2;Integrated Security=True;Encrypt=true;TrustServerCertificate=true;"; + + public const string UrlWeb = "https://vuanhpham25-001-site1.gtempurl.com/"; + public const string ConnectString = "Data Source=SQL5106.site4now.net;Initial Catalog=db_aa121e_vuanhpham25;User Id=db_aa121e_vuanhpham25_admin;Password=30102002Mai"; + + //public const string UrlWeb = "https://localhost:7138/"; + //public const string ConnectString = "Data Source=.;Initial Catalog=VietNamHistory;Integrated Security=True;Encrypt=true;TrustServerCertificate=true;"; } } diff --git a/VNH.Application/DTOs/Catalog/Document/DocumentReponseDto.cs b/VNH.Application/DTOs/Catalog/Document/DocumentReponseDto.cs index ffc2b99..09e7ead 100644 --- a/VNH.Application/DTOs/Catalog/Document/DocumentReponseDto.cs +++ b/VNH.Application/DTOs/Catalog/Document/DocumentReponseDto.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using VNH.Application.DTOs.Catalog.Users; +using VNH.Application.DTOs.Catalog.Users; namespace VNH.Application.DTOs.Catalog.Document { diff --git a/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerFpkDto.cs b/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerFpkDto.cs index f42fc12..edf3826 100644 --- a/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerFpkDto.cs +++ b/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerFpkDto.cs @@ -8,7 +8,10 @@ namespace VNH.Application.DTOs.Catalog.Forum.Answer { public class AnswerFpkDto { + public string QuestionId { get; set; } = string.Empty; public string AnswerId { get; set; } = string.Empty; public string UserId { get; set; } = string.Empty; + public string QuestionUserId { get; set; } = string.Empty; + } } diff --git a/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerQuestionDto.cs b/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerQuestionDto.cs index 55e2af0..147ceb2 100644 --- a/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerQuestionDto.cs +++ b/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerQuestionDto.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations.Schema; using VNH.Application.DTOs.Catalog.Users; namespace VNH.Application.DTOs.Catalog.Forum.Answer @@ -11,30 +6,30 @@ namespace VNH.Application.DTOs.Catalog.Forum.Answer public class AnswerQuestionDto { - public Guid Id { get; set; } = Guid.NewGuid(); + public Guid? Id { get; set; } = Guid.NewGuid(); public Guid? AuthorId { get; set; } - public string QuestionId { get; set; } = string.Empty; public UserShortDto? UserShort { get; set; } public string Content { get; set; } = String.Empty; - public DateTime PubDate { get; set; } - public DateTime? UpdateAt { get; set; } + public DateTime? CreatedAt { get; set; } + public DateTime? UpdatedAt { get; set; } public bool Confirm { get; set; } = false; public bool MostConfirm { get; set; } = false; - public List? SubAnswer { get; set; } + public int VoteNumber { get; set; } = 0; + public List? SubAnswer { get; set; } = new(); } public class SubAnswerQuestionDto { - public Guid Id { get; set; } = Guid.NewGuid(); + public Guid? Id { get; set; } = Guid.NewGuid(); public Guid PreAnswerId { get; set; } public Guid AuthorId { get; set; } public string Content { get; set; } = string.Empty; [Column(TypeName = "datetime")] - public DateTime? PubDate { get; set; } + public DateTime? CreatedAt { get; set; } [Column(TypeName = "datetime")] - public DateTime? UpdateAt { get; set; } + public DateTime? UpdatedAt { get; set; } public UserShortDto? UserShort { get; set; } diff --git a/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerResponseDto.cs b/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerResponseDto.cs index d1e05b7..e0a4918 100644 --- a/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerResponseDto.cs +++ b/VNH.Application/DTOs/Catalog/Forum/Answer/AnswerResponseDto.cs @@ -17,7 +17,8 @@ public class AnswerResponseDto public string QuestionId { get; set; } = string.Empty; [Column(TypeName = "datetime")] - public DateTime? PubDate { get; set; } + public DateTime? CreatedAt { get; set; } + public DateTime? UpdatedAt { get; set; } public UserShortDto UserShort { get; set; } = new UserShortDto(); public bool Confirm { get; set; } public bool MostConfirm { get; set; } diff --git a/VNH.Application/DTOs/Catalog/Forum/Question/CreateQuestionDto.cs b/VNH.Application/DTOs/Catalog/Forum/Question/CreateQuestionDto.cs index dd8ed45..6db4f8e 100644 --- a/VNH.Application/DTOs/Catalog/Forum/Question/CreateQuestionDto.cs +++ b/VNH.Application/DTOs/Catalog/Forum/Question/CreateQuestionDto.cs @@ -9,7 +9,7 @@ namespace VNH.Application.DTOs.Catalog.Forum.Question public class CreateQuestionDto { public Guid? Id { get; set; } = Guid.NewGuid(); - + public string? SubId { get; set; } = string.Empty; public string? Title { get; set; } = string.Empty; public string? Content { get; set; } = string.Empty; public List? Tag { get; set; } diff --git a/VNH.Application/DTOs/Catalog/Forum/Question/QuestionFpkDto.cs b/VNH.Application/DTOs/Catalog/Forum/Question/QuestionFpkDto.cs index 8c28c79..a5d5b50 100644 --- a/VNH.Application/DTOs/Catalog/Forum/Question/QuestionFpkDto.cs +++ b/VNH.Application/DTOs/Catalog/Forum/Question/QuestionFpkDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VNH.Application.DTOs.Catalog.Forum.Question +namespace VNH.Application.DTOs.Catalog.Forum.Question { public class QuestionFpkDto { diff --git a/VNH.Application/DTOs/Catalog/Forum/Question/QuestionResponseDto.cs b/VNH.Application/DTOs/Catalog/Forum/Question/QuestionResponseDto.cs index f64f0a4..cb5c20d 100644 --- a/VNH.Application/DTOs/Catalog/Forum/Question/QuestionResponseDto.cs +++ b/VNH.Application/DTOs/Catalog/Forum/Question/QuestionResponseDto.cs @@ -6,16 +6,19 @@ namespace VNH.Application.DTOs.Catalog.Forum.Question { public class QuestionResponseDto { - public string Id { get; set; } =string.Empty; + public string Id { get; set; } = string.Empty; + public string? SubId { get; set; } public string Title { get; set; } = string.Empty; public string Content { get; set; } = string.Empty; - public DateTime? CreateAt { get; set; } - public DateTime? UpdateAt { get; set; } + public DateTime? CreatedAt { get; set; } + public DateTime? UpdatedAt { get; set; } public List Tags { get; set; } = new List(); public UserShortDto UserShort { get; set; } = new UserShortDto(); + public int ViewNumber { get; set; } = 0; public int CommentNumber { get; set; } = 0; public int SaveNumber { get; set; } = 0; + public int LikeNumber { get; set; } = 0; } } diff --git a/VNH.Application/DTOs/Catalog/Forum/Question/ReportQuestionDto.cs b/VNH.Application/DTOs/Catalog/Forum/Question/ReportQuestionDto.cs new file mode 100644 index 0000000..9a01c63 --- /dev/null +++ b/VNH.Application/DTOs/Catalog/Forum/Question/ReportQuestionDto.cs @@ -0,0 +1,12 @@ +namespace VNH.Application.DTOs.Catalog.Forum.Question +{ + public class ReportQuestionDto + { + public string QuestionId { get; set; } = string.Empty; + public Guid UserId { get; set; } + public Guid ReportId { get; set; } + public string? Description { get; set; } = string.Empty; + public DateTime ReportDate { get; set; } = DateTime.Now; + public bool Checked { get; set; } = false; + } +} diff --git a/VNH.Application/DTOs/Catalog/Posts/CommentPostDto.cs b/VNH.Application/DTOs/Catalog/Posts/CommentPostDto.cs index 855fb45..943edca 100644 --- a/VNH.Application/DTOs/Catalog/Posts/CommentPostDto.cs +++ b/VNH.Application/DTOs/Catalog/Posts/CommentPostDto.cs @@ -11,7 +11,7 @@ public class CommentPostDto public string PostId { get; set; } = String.Empty; public UserShortDto? UserShort { get; set; } public string Content { get; set; } = String.Empty; - public DateTime CreatedAt { get; set; } + public DateTime? CreatedAt { get; set; } = DateTime.Now; public DateTime? UpdatedAt { get; set; } public List? SubComment { get; set; } } diff --git a/VNH.Application/DTOs/Catalog/Posts/CreatePostDto.cs b/VNH.Application/DTOs/Catalog/Posts/CreatePostDto.cs index 5e42b54..617b238 100644 --- a/VNH.Application/DTOs/Catalog/Posts/CreatePostDto.cs +++ b/VNH.Application/DTOs/Catalog/Posts/CreatePostDto.cs @@ -8,7 +8,7 @@ public class CreatePostDto public string? Id { get; set; } = Guid.NewGuid().ToString(); public string Title { get; set; } = string.Empty; public string Content { get; set; } = string.Empty; - public IFormFile Image { get; set; } + public IFormFile? Image { get; set; } public Guid TopicId { get; set; } public List? Tag { get; set; } = new List(); } diff --git a/VNH.Application/DTOs/Catalog/Posts/PostResponseDto.cs b/VNH.Application/DTOs/Catalog/Posts/PostResponseDto.cs index fa493f8..c1a12e1 100644 --- a/VNH.Application/DTOs/Catalog/Posts/PostResponseDto.cs +++ b/VNH.Application/DTOs/Catalog/Posts/PostResponseDto.cs @@ -1,9 +1,5 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.EntityFrameworkCore.Metadata.Internal; -using System.ComponentModel.DataAnnotations.Schema; -using VNH.Application.DTOs.Catalog.HashTags; +using VNH.Application.DTOs.Catalog.HashTags; using VNH.Application.DTOs.Catalog.Users; -using VNH.Domain; namespace VNH.Application.DTOs.Catalog.Posts { @@ -16,7 +12,7 @@ public class PostResponseDto public string Image { get; set; } = string.Empty; public DateTime? CreatedAt { get; set; } public DateTime? UpdatedAt { get; set; } - public string TopicName { get; set; } = string.Empty; + public string? TopicName { get; set; } = string.Empty; public List Tags { get; set; } = new List(); public UserShortDto UserShort { get; set; } = new UserShortDto(); public int ViewNumber { get; set; } = 0; diff --git a/VNH.Application/DTOs/Common/NumberReponse.cs b/VNH.Application/DTOs/Common/NumberReponse.cs new file mode 100644 index 0000000..8eb4662 --- /dev/null +++ b/VNH.Application/DTOs/Common/NumberReponse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VNH.Application.DTOs.Common +{ + public class NumberReponse + { + public bool Check { get; set; } + public int Quantity { get; set; } + } +} diff --git a/VNH.Application/Interfaces/Catalog/Documents/IDocumentService.cs b/VNH.Application/Interfaces/Catalog/Documents/IDocumentService.cs index 45a09d8..a6cc6c8 100644 --- a/VNH.Application/Interfaces/Catalog/Documents/IDocumentService.cs +++ b/VNH.Application/Interfaces/Catalog/Documents/IDocumentService.cs @@ -15,6 +15,6 @@ public interface IDocumentService Task> GetSave(DocumentFpkDto docsFpk); Task> AddOrRemoveSaveDocs(DocumentFpkDto docsFpk); - + Task>> Search(string keyWord); } } diff --git a/VNH.Application/Interfaces/Catalog/Forum/IAnswerService.cs b/VNH.Application/Interfaces/Catalog/Forum/IAnswerService.cs index ebc64f9..1480c56 100644 --- a/VNH.Application/Interfaces/Catalog/Forum/IAnswerService.cs +++ b/VNH.Application/Interfaces/Catalog/Forum/IAnswerService.cs @@ -1,4 +1,5 @@ using VNH.Application.DTOs.Catalog.Forum.Answer; +using VNH.Application.DTOs.Common; using VNH.Application.DTOs.Common.ResponseNotification; using VNH.Domain; @@ -15,11 +16,11 @@ public interface IAnswerService Task> CreateSubAnswer(SubAnswerQuestionDto subAnswer); - Task> UpdateSubAnswer(SubAnswerQuestionDto answer); + Task> UpdateSubAnswer(SubAnswerQuestionDto answer); Task> DeteleSubAnswer(string id); - Task> ConfirmOrNoConfirm(AnswerFpkDto answerFpk); - - + Task> ConfirmedByQuestioner(string answerId); + Task> VoteConfirmByUser(AnswerFpkDto answer); + Task> GetMyVote(string answerId, string userId); } } diff --git a/VNH.Application/Interfaces/Catalog/Forum/IQuestionService.cs b/VNH.Application/Interfaces/Catalog/Forum/IQuestionService.cs index 4c79bfb..b6c8e12 100644 --- a/VNH.Application/Interfaces/Catalog/Forum/IQuestionService.cs +++ b/VNH.Application/Interfaces/Catalog/Forum/IQuestionService.cs @@ -3,25 +3,33 @@ using VNH.Application.DTOs.Catalog.Forum.Question; using VNH.Application.DTOs.Catalog.HashTags; using VNH.Application.DTOs.Catalog.Posts; +using VNH.Application.DTOs.Common; using VNH.Application.DTOs.Common.ResponseNotification; namespace VNH.Application.Interfaces.Catalog.Forum { public interface IQuestionService { + Task> Create(CreateQuestionDto requestDto, string name); Task> Update(CreateQuestionDto requestDto, string name); Task> Detail(string Id); Task>> GetAll(); Task> Delete(string id, string email); - Task> AddOrRemoveSaveQuestion(QuestionFpkDto questionFpk); + Task> AddOrRemoveSaveQuestion(QuestionFpkDto questionFpk); - Task> GetSave(QuestionFpkDto questionFpk); + Task> GetSave(QuestionFpkDto questionFpk); Task>> GetAllTag(int numberTag); Task>> GetQuestionByTag(string tag); - - + Task> SubDetail(string subId); + Task> GetLike(QuestionFpkDto questionFpk); + Task> AddOrUnLikeQuestion(QuestionFpkDto questionFpk); + Task>> GetMyQuestion(string id); + Task> ReportQuestion(ReportQuestionDto reportquestionDto); + Task>> GetReport(); + Task>> SearchQuestions(string keyWord); + Task>> GetMyQuestionSaved(string id); } } diff --git a/VNH.Application/Interfaces/Catalog/NewsHistory/INewsService.cs b/VNH.Application/Interfaces/Catalog/NewsHistory/INewsService.cs new file mode 100644 index 0000000..cc46789 --- /dev/null +++ b/VNH.Application/Interfaces/Catalog/NewsHistory/INewsService.cs @@ -0,0 +1,11 @@ +using VNH.Application.DTOs.Common.ResponseNotification; +using VNH.Domain; + +namespace VNH.Application.Interfaces.Catalog.NewsHistory +{ + public interface INewsService + { + Task> CrawlNews(string url); + Task>> GetNews(); + } +} diff --git a/VNH.Application/Interfaces/Catalog/Posts/IPostService.cs b/VNH.Application/Interfaces/Catalog/Posts/IPostService.cs index 33deb32..b671a43 100644 --- a/VNH.Application/Interfaces/Catalog/Posts/IPostService.cs +++ b/VNH.Application/Interfaces/Catalog/Posts/IPostService.cs @@ -1,5 +1,6 @@ using VNH.Application.DTOs.Catalog.HashTags; using VNH.Application.DTOs.Catalog.Posts; +using VNH.Application.DTOs.Common; using VNH.Application.DTOs.Common.ResponseNotification; namespace VNH.Application.Interfaces.Posts @@ -14,18 +15,22 @@ public interface IPostService Task> DeleteAdmin(string id); - Task> AddOrUnLikePost(PostFpkDto postFpk); - Task> AddOrRemoveSavePost(PostFpkDto postFpk); + Task> AddOrUnLikePost(PostFpkDto postFpk); + Task> AddOrRemoveSavePost(PostFpkDto postFpk); Task> ReportPost(ReportPostDto reportPostDto); - Task> GetReport(); - Task> GetLike(PostFpkDto postFpk); - Task> GetSave(PostFpkDto postFpk); + Task>> GetReport(); + Task> GetLike(PostFpkDto postFpk); + Task> GetSave(PostFpkDto postFpk); Task>> GetPostByTag(string tag); Task>> GetComment(string postId); Task>> CreateComment(CommentPostDto comment); Task>> UpdateComment(CommentPostDto comment); - Task> DeteleComment(string id); + Task>> DeteleComment(string id); Task>> GetMyPostSaved(string id); Task>> GetMyPost(string id); + Task>> SearchPosts(string keyWord); + Task>> GetAllMobile(); + Task>> GetRandomPost(int quantity); + Task>> FindByTopic(string topicName); } } \ No newline at end of file diff --git a/VNH.Application/Interfaces/Catalog/Topics/ITopicService.cs b/VNH.Application/Interfaces/Catalog/Topics/ITopicService.cs index 31d3be1..f0fb2d8 100644 --- a/VNH.Application/Interfaces/Catalog/Topics/ITopicService.cs +++ b/VNH.Application/Interfaces/Catalog/Topics/ITopicService.cs @@ -14,5 +14,6 @@ public interface ITopicService Task> DeleteTopic(Guid topicId); Task>> CreateTopic(string topic, string userEmail); Task> UpdateTopic(Guid topicId, string topic); + Task> GetById(string idTopic); } } diff --git a/VNH.Application/Mappers/PostMapper.cs b/VNH.Application/Mappers/PostMapper.cs index 138a7df..2281976 100644 --- a/VNH.Application/Mappers/PostMapper.cs +++ b/VNH.Application/Mappers/PostMapper.cs @@ -11,8 +11,7 @@ public PostMapper() CreateMap() .ForMember(dest => dest.Image, opt => opt.Ignore()); - CreateMap() - .ForMember(dest => dest.Image, opt => opt.Ignore()); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); diff --git a/VNH.Application/Mappers/QuestionMapper.cs b/VNH.Application/Mappers/QuestionMapper.cs index ede9432..5cac09d 100644 --- a/VNH.Application/Mappers/QuestionMapper.cs +++ b/VNH.Application/Mappers/QuestionMapper.cs @@ -12,9 +12,8 @@ public QuestionMapper() { CreateMap().ReverseMap(); - - CreateMap().ReverseMap(); - + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/VNH.Application/Mappers/ReportMapper.cs b/VNH.Application/Mappers/ReportMapper.cs index 48eab63..74da723 100644 --- a/VNH.Application/Mappers/ReportMapper.cs +++ b/VNH.Application/Mappers/ReportMapper.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using VNH.Application.DTOs.Catalog.Forum.Question; using VNH.Application.DTOs.Catalog.Posts; using VNH.Application.DTOs.Catalog.Reports; using VNH.Domain; @@ -14,6 +15,9 @@ public class ReportMapper : Profile { public ReportMapper() { CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + } } } diff --git a/VNH.Domain/Entities/Answer.cs b/VNH.Domain/Entities/Answer.cs index 5d01931..5a37a8b 100644 --- a/VNH.Domain/Entities/Answer.cs +++ b/VNH.Domain/Entities/Answer.cs @@ -16,19 +16,20 @@ public Answer() AnswerVotes = new HashSet(); SubAnswers = new HashSet(); } - + [Key] public Guid Id { get; set; } public Guid QuestionId { get; set; } public string Content { get; set; } public Guid? AuthorId { get; set; } [Column(TypeName = "datetime")] - public DateTime? PubDate { get; set; } + public DateTime? CreatedAt { get; set; } [Column(TypeName = "datetime")] - public DateTime? UpdateAt { get; set; } + public DateTime? UpdatedAt { get; set; } public bool? Confirm { get; set; } public bool? MostConfirm { get; set; } + public bool IsDeleted { get; set; } = false; [ForeignKey("AuthorId")] [InverseProperty("Answers")] diff --git a/VNH.Domain/Entities/AnswerVote.cs b/VNH.Domain/Entities/AnswerVote.cs index 56805e8..29fe7e0 100644 --- a/VNH.Domain/Entities/AnswerVote.cs +++ b/VNH.Domain/Entities/AnswerVote.cs @@ -15,6 +15,7 @@ public partial class AnswerVote public Guid Id { get; set; } public Guid? AnswerId { get; set; } public Guid? UserId { get; set; } + public Guid? QuestionId { get; set; } [ForeignKey("AnswerId")] [InverseProperty("AnswerVotes")] diff --git a/VNH.Domain/Entities/Course.cs b/VNH.Domain/Entities/Course.cs index 16a5dfb..985ba20 100644 --- a/VNH.Domain/Entities/Course.cs +++ b/VNH.Domain/Entities/Course.cs @@ -31,6 +31,7 @@ public Course() [Column(TypeName = "datetime")] public DateTime? UpdatedAt { get; set; } public string Image { get; set; } = string.Empty; + public bool IsDeleted { get; set; } = false; [ForeignKey("UserId")] [InverseProperty("Courses")] public virtual User User { get; set; } diff --git a/VNH.Domain/Entities/Document.cs b/VNH.Domain/Entities/Document.cs index 75bc8d8..08fc8ca 100644 --- a/VNH.Domain/Entities/Document.cs +++ b/VNH.Domain/Entities/Document.cs @@ -24,7 +24,7 @@ public Document() [StringLength(500)] public string Description { get; set; } public string SubId { get; set; } - + public bool IsDeleted { get; set; } = false; public string FileName { get; set; } [StringLength(255)] [Unicode(false)] diff --git a/VNH.Domain/Entities/Lesson.cs b/VNH.Domain/Entities/Lesson.cs index ced11a2..48d0a26 100644 --- a/VNH.Domain/Entities/Lesson.cs +++ b/VNH.Domain/Entities/Lesson.cs @@ -22,11 +22,13 @@ public partial class Lesson public string Description { get; set; } public Guid? CourseId { get; set; } public Guid? ExerciseId { get; set; } + public bool IsDeleted { get; set; } = false; [ForeignKey("CourseId")] [InverseProperty("Lessons")] public virtual Course Course { get; set; } [InverseProperty("IdNavigation")] public virtual Exercise Exercise { get; set; } + } } \ No newline at end of file diff --git a/VNH.Domain/Entities/News.cs b/VNH.Domain/Entities/News.cs index 33bdae0..0aa7f5e 100644 --- a/VNH.Domain/Entities/News.cs +++ b/VNH.Domain/Entities/News.cs @@ -13,16 +13,11 @@ public partial class News [Key] public Guid Id { get; set; } [Required] - [StringLength(255)] public string Title { get; set; } - [Column(TypeName = "text")] public string Description { get; set; } = string.Empty; - [Column(TypeName = "text")] + public DateTime CreatedAt { get; set; } public string Image { get; set; } = string.Empty; - [Column(TypeName = "datetime")] - public DateTime? PubDate { get; set; } [Required] - [StringLength(255)] [Unicode(false)] public string Url { get; set; } } diff --git a/VNH.Domain/Entities/Post.cs b/VNH.Domain/Entities/Post.cs index 7269414..55eac0e 100644 --- a/VNH.Domain/Entities/Post.cs +++ b/VNH.Domain/Entities/Post.cs @@ -33,6 +33,7 @@ public Post() public Guid UserId { get; set; } public string Image { get; set; } = string.Empty; public int ViewNumber { get; set; } + public bool IsDeleted { get; set; } = false; [ForeignKey("TopicId")] [InverseProperty("Posts")] diff --git a/VNH.Domain/Entities/Question.cs b/VNH.Domain/Entities/Question.cs index 20e24c6..795e5b1 100644 --- a/VNH.Domain/Entities/Question.cs +++ b/VNH.Domain/Entities/Question.cs @@ -1,10 +1,7 @@ // This file has been auto generated by EF Core Power Tools. #nullable disable -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; namespace VNH.Domain { @@ -22,15 +19,18 @@ public Question() public Guid Id { get; set; } [StringLength(500)] public string Title { get; set; } + public string SubId { get; set; } public string Content { get; set; } - public int? ViewNumber { get; set; } + public int ViewNumber { get; set; } public Guid? AuthorId { get; set; } [Column(TypeName = "datetime")] - public DateTime? UpdateAt { get; set; } + public DateTime? UpdatedAt { get; set; } [Column(TypeName = "datetime")] - public DateTime CreateAt { get; set; } - + public DateTime CreatedAt { get; set; } + public bool IsDeleted { get; set; } = false; + + [ForeignKey("AuthorId")] [InverseProperty("Questions")] diff --git a/VNH.Domain/Entities/SubAnswer.cs b/VNH.Domain/Entities/SubAnswer.cs index 8ee6eb8..b40b3bc 100644 --- a/VNH.Domain/Entities/SubAnswer.cs +++ b/VNH.Domain/Entities/SubAnswer.cs @@ -1,32 +1,28 @@ // This file has been auto generated by EF Core Power Tools. #nullable disable -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; -namespace VNH.Domain +namespace VNH.Domain; + +[Table("SubAnswer")] +public partial class SubAnswer { - [Table("SubAnswer")] - public partial class SubAnswer - { - [Key] - public Guid Id { get; set; } - public Guid? PreAnswerId { get; set; } - public string Content { get; set; } - public Guid? AuthorId { get; set; } - [Column(TypeName = "datetime")] - public DateTime? PubDate { get; set; } + [Key] + public Guid Id { get; set; } + public Guid? PreAnswerId { get; set; } + public string Content { get; set; } + public Guid? AuthorId { get; set; } + [Column(TypeName = "datetime")] + public DateTime? CreatedAt { get; set; } - [Column(TypeName = "datetime")] - public DateTime? UpdateAt { get; set; } + [Column(TypeName = "datetime")] + public DateTime? UpdatedAt { get; set; } - [ForeignKey("AuthorId")] - [InverseProperty("SubAnswers")] - public virtual User Author { get; set; } - [ForeignKey("PreAnswerId")] - [InverseProperty("SubAnswers")] - public virtual Answer PreAnswer { get; set; } - } + [ForeignKey("AuthorId")] + [InverseProperty("SubAnswers")] + public virtual User Author { get; set; } + [ForeignKey("PreAnswerId")] + [InverseProperty("SubAnswers")] + public virtual Answer PreAnswer { get; set; } } \ No newline at end of file diff --git a/VNH.Domain/Entities/User.cs b/VNH.Domain/Entities/User.cs index f0a859c..d143349 100644 --- a/VNH.Domain/Entities/User.cs +++ b/VNH.Domain/Entities/User.cs @@ -49,6 +49,7 @@ public User() public Gender Gender { get; set; } public string Image { get; set; } = string.Empty; public string NumberConfirm { get; set; } // Confirm Email + public bool IsDeleted { get; set; } = false; [InverseProperty("User")] public virtual ICollection AnswerVotes { get; set; } [InverseProperty("Author")] diff --git a/VNH.Infrastructure/DependencyInjectionInfrastructure.cs b/VNH.Infrastructure/DependencyInjectionInfrastructure.cs index c5b15c2..b4c28cf 100644 --- a/VNH.Infrastructure/DependencyInjectionInfrastructure.cs +++ b/VNH.Infrastructure/DependencyInjectionInfrastructure.cs @@ -32,6 +32,8 @@ using VNH.Infrastructure.Implement.Catalog.Documents; using VNH.Application.Interfaces.Catalog.Forum; using VNH.Infrastructure.Implement.Catalog.Forum; +using VNH.Application.Interfaces.Catalog.NewsHistory; +using VNH.Infrastructure.Implement.Catalog.NewsHistory; namespace VNH.Infrastructure { @@ -50,10 +52,6 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi .CreateLogger(); services.AddScoped(); - services.AddDbContext(options => - { - options.UseSqlServer(configuration.GetConnectionString("DataConnect")); - }); services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); @@ -108,13 +106,10 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi { options.AddPolicy("AllowAngularDev", builder => { - builder.WithOrigins("http://localhost:4200") + builder.WithOrigins("http://localhost:4200", "https://luongxuannhat.github.io", "https://toiyeulichsu.com") .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); - //builder.AllowAnyOrigin() - // .AllowAnyHeader() - // .AllowAnyMethod(); }); }); services.AddOptions(); @@ -135,6 +130,7 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddSignalR(); diff --git a/VNH.Infrastructure/Implement/Catalog/Account/AccountService.cs b/VNH.Infrastructure/Implement/Catalog/Account/AccountService.cs index b339c76..f8fb6a9 100644 --- a/VNH.Infrastructure/Implement/Catalog/Account/AccountService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Account/AccountService.cs @@ -50,6 +50,10 @@ public AccountService(VietNamHistoryContext context, public async Task> Authenticate(LoginRequest request) { var user = await _userManager.FindByEmailAsync(request.Email); + if(user != null && user.IsDeleted) + { + user = null; + } var errorMessages = new Dictionary, string> { @@ -88,7 +92,8 @@ public async Task GetToken(User user) new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new Claim(ClaimTypes.Email,user.Email), new Claim(ClaimTypes.Role, string.Join(";",roles)), - new Claim(ClaimTypes.Name, user.UserName), + new Claim(ClaimTypes.Name, user.Email), + new Claim(ClaimTypes.Surname, user.Fullname), }; var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Tokens:Key"])); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); @@ -377,6 +382,7 @@ public async Task> ChangeEmail(string currentEmail, string ema user.NormalizedEmail = email; user.NormalizedUserName = email; var changeEmailResult = await _userManager.ChangeEmailAsync(user, email, token); + await SendConfirmCodeToEmail(email, GetConfirmCode()); if (changeEmailResult.Succeeded) { return new ApiSuccessResult( await GetToken(user)); diff --git a/VNH.Infrastructure/Implement/Catalog/Documents/DocumentService.cs b/VNH.Infrastructure/Implement/Catalog/Documents/DocumentService.cs index e0b76d8..f693aa7 100644 --- a/VNH.Infrastructure/Implement/Catalog/Documents/DocumentService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Documents/DocumentService.cs @@ -11,8 +11,8 @@ using VNH.Domain; using VNH.Infrastructure.Presenters.Migrations; using Microsoft.EntityFrameworkCore; -using VNH.Application.DTOs.Catalog.Posts; -using Microsoft.Extensions.Hosting; +using VNH.Infrastructure.Implement.Common; +using VNH.Application.DTOs.Catalog.Forum.Question; namespace VNH.Infrastructure.Implement.Catalog.Documents { @@ -43,8 +43,8 @@ public async Task> Create(CreateDocumentDto reques document.FileName = await _document.SaveFile(requestDto.FileName); document.CreatedAt = DateTime.Now; document.UserId = user.Id; - string formattedDateTime = document.CreatedAt.ToString("HH:mm:ss.fff-dd-MM-yyyy"); - document.SubId = SanitizeString(document.Title) + "-" + formattedDateTime; + string formattedDateTime = document.CreatedAt.ToString("HHmmss.fff") + HandleCommon.GenerateRandomNumber().ToString(); + document.SubId = HandleCommon.SanitizeString(document.Title) + "-" + formattedDateTime; try { _dataContext.Documents.Add(document); @@ -71,29 +71,6 @@ public async Task> Create(CreateDocumentDto reques } - private static string RemoveDiacritics(string input) - { - string normalizedString = input.Normalize(NormalizationForm.FormD); - StringBuilder stringBuilder = new StringBuilder(); - - foreach (char c in normalizedString) - { - if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark) - { - stringBuilder.Append(c); - } - } - - return stringBuilder.ToString().Normalize(NormalizationForm.FormC); - } - private static string SanitizeString(string input) - { - string withoutDiacritics = RemoveDiacritics(input).Trim().Replace(" ", "-"); - string sanitizedString = Regex.Replace(withoutDiacritics, "[^a-zA-Z0-9-]", ""); - - return sanitizedString; - } - public async Task> Update(CreateDocumentDto requestDto, string name) { var user = await _userManager.FindByEmailAsync(name); @@ -112,8 +89,8 @@ public async Task> Update(CreateDocumentDto reques updateDocument.UpdatedAt = DateTime.Now; updateDocument.Description = requestDto.Description; updateDocument.Title = requestDto.Title; - string formattedDateTime = DateTime.Now.ToString("HH:mm:ss.fff-dd-MM-yyyy"); - var Id = SanitizeString(updateDocument.Title); + string formattedDateTime = DateTime.Now.ToString("HHmmss.fff") + HandleCommon.GenerateRandomNumber().ToString(); + var Id = HandleCommon.SanitizeString(updateDocument.Title); updateDocument.SubId = Id.Trim().Replace(" ", "-") + "-" + formattedDateTime; try { @@ -168,7 +145,7 @@ public async Task>> GetAll() - public async Task> Detail(string Id) + public async Task> Detail(string Id) { var document = await _dataContext.Documents.FirstOrDefaultAsync(x=>x.SubId.Equals(Id)); if (document is null) @@ -251,6 +228,41 @@ public async Task> AddOrRemoveSaveDocs(DocumentFpkDto docsFpk) } - + public async Task>> Search(string keyWord) + { + var users = await _dataContext.User.ToListAsync(); + var documents = new List(); + string[] searchKeywords = keyWord.ToLower().Split(' '); + var result = from document in _dataContext.Documents as IEnumerable + let titleWords = document.Title.ToLower().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) + let searchPhrases = HandleCommon.GenerateSearchPhrases(searchKeywords) + let matchingPhrases = searchPhrases + .Where(phrase => titleWords.Contains(phrase)) + where matchingPhrases.Any() + let matchCount = matchingPhrases.Count() + orderby matchCount descending + select new Document() + { + Id = document.Id, + SubId = document.SubId, + Title = document.Title, + CreatedAt = document.CreatedAt, + UpdatedAt = document.UpdatedAt, + }; + + foreach (var document in result) + { + var item = _mapper.Map(document); + var userShort = users.FirstOrDefault(x => x.Id == document.UserId); + if (userShort is not null) + { + item.UserShort.FullName = userShort.Fullname; + item.UserShort.Id = userShort.Id; + item.UserShort.Image = userShort.Image; + } + documents.Add(item); + } + return new ApiSuccessResult>(documents); + } } } diff --git a/VNH.Infrastructure/Implement/Catalog/Forum/AnswerService.cs b/VNH.Infrastructure/Implement/Catalog/Forum/AnswerService.cs index a47899f..ca5f0c7 100644 --- a/VNH.Infrastructure/Implement/Catalog/Forum/AnswerService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Forum/AnswerService.cs @@ -2,16 +2,9 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using VNH.Application.DTOs.Catalog.Forum.Answer; -using VNH.Application.DTOs.Catalog.Forum.Question; -using VNH.Application.DTOs.Catalog.HashTags; -using VNH.Application.DTOs.Catalog.Posts; using VNH.Application.DTOs.Catalog.Users; +using VNH.Application.DTOs.Common; using VNH.Application.DTOs.Common.ResponseNotification; using VNH.Application.Interfaces.Catalog.Forum; using VNH.Domain; @@ -41,7 +34,7 @@ public AnswerService(UserManager userManager, IHubContext ans private UserShortDto? GetUserShort(List users, Guid? IdUser) { return users - .Where(x => x.Id.Equals(IdUser)) + .Where(x => x.Id.Equals(IdUser) && !x.IsDeleted) .Select(x => new UserShortDto { Id = x.Id, @@ -60,25 +53,48 @@ public AnswerService(UserManager userManager, IHubContext ans answer.UserShort = GetUserShort(users, item.AuthorId); result.Add(answer); } - return result; + return result.OrderBy(x=>x.CreatedAt).ToList(); } public async Task>> GetAnswer(string questionId) { - var question = await _dataContext.Questions.FirstAsync(x => x.Id.Equals(Guid.Parse(questionId))); + var question = await _dataContext.Questions.FirstAsync(x => x.Id.Equals(Guid.Parse(questionId)) && !x.IsDeleted); if (question == null) { return new ApiSuccessResult>(); } - var users = await _dataContext.User.ToListAsync(); - var answerQuestion = await _dataContext.Answers.Where(x => x.QuestionId.Equals(question.Id)).ToListAsync(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); + var answerQuestion = await _dataContext.Answers.Where(x => x.QuestionId.Equals(question.Id) && !x.IsDeleted).OrderByDescending(x => x.CreatedAt).ToListAsync(); var subAnswerQuestion = await _dataContext.SubAnswers.ToListAsync(); var result = new List(); - foreach(var item in answerQuestion) + var viewVotes = await _dataContext.AnswerVotes + .Where(x => x.QuestionId.ToString() == questionId) + .GroupBy(x => x.AnswerId) + .Select(group => new { AnswerId = group.Key, VoteCount = group.Count()}) + .ToListAsync(); + + // mostConfirm required > 10 selected + var mostview = viewVotes.Where(x=>x.VoteCount > 10).OrderByDescending(x=>x.VoteCount).Take(1).FirstOrDefault(); + foreach (var item in answerQuestion) { - var subAnswer = subAnswerQuestion.Where(x => x.PreAnswerId.Equals(item.Id)).ToList(); + var subAnswer = subAnswerQuestion.Where(x => x.PreAnswerId.Equals(item.Id)).OrderByDescending(x => x.CreatedAt).ToList(); var answ = _mapper.Map(item); + var voteNumber = viewVotes.FirstOrDefault(x => x.AnswerId == item.Id); + answ.VoteNumber = voteNumber != null ? voteNumber.VoteCount : 0; + if(mostview != null) + { + if (mostview.AnswerId == item.Id && item.MostConfirm != true) + { + item.MostConfirm = true; + _dataContext.Answers.Update(item); + } + if (mostview.AnswerId != item.Id && item.MostConfirm == true) + { + item.MostConfirm = false; + _dataContext.Answers.Update(item); + } + } answ.UserShort = GetUserShort(users, item.AuthorId); if(subAnswer.Count > 0) { @@ -86,6 +102,9 @@ public async Task>> GetAnswer(string questionI } result.Add(answ); } + await _dataContext.SaveChangesAsync(); + result = result.OrderByDescending(x=>x.VoteNumber).ToList(); + return new ApiSuccessResult>(result); } @@ -94,7 +113,7 @@ public async Task>> GetAnswer(string questionI public async Task>> CreateAnswer(AnswerQuestionDto answer) { - var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(answer.QuestionId))); + var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(answer.QuestionId)) && !x.IsDeleted); if (question == null) { return new ApiErrorResult>("Không tìm câu hỏi mà bạn trả lời, có thể nó đã bị xóa"); @@ -102,6 +121,7 @@ public async Task>> CreateAnswer(AnswerQuestio Answer answerQuestion = _mapper.Map(answer); answerQuestion.QuestionId = question.Id; + answerQuestion.CreatedAt = DateTime.Now; _dataContext.Answers.Add(answerQuestion); await _dataContext.SaveChangesAsync(); @@ -115,13 +135,13 @@ public async Task>> CreateAnswer(AnswerQuestio public async Task>> UpdateAnswer(AnswerQuestionDto answer) { - var questionAnswer = await _dataContext.Answers.FirstOrDefaultAsync(x => x.Id == answer.Id); + var questionAnswer = await _dataContext.Answers.FirstOrDefaultAsync(x => x.Id == answer.Id && !x.IsDeleted); if (questionAnswer == null) { return new ApiErrorResult>("Không tìm thấy câu hỏi bạn trả lời!"); } questionAnswer.Content = answer.Content; - questionAnswer.UpdateAt = DateTime.Now; + questionAnswer.UpdatedAt = DateTime.Now; _dataContext.Answers.Update(questionAnswer); await _dataContext.SaveChangesAsync(); @@ -135,61 +155,75 @@ public async Task>> UpdateAnswer(AnswerQuestio public async Task> DeteleAnswer(string id) { - var answer = await _dataContext.Answers.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(id))); + var answer = await _dataContext.Answers.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(id)) && !x.IsDeleted); if (answer == null) { return new ApiErrorResult("Không tìm thấy câu hỏi"); } - _dataContext.Answers.Remove(answer); + answer.IsDeleted = true; + _dataContext.Answers.Update(answer); await _dataContext.SaveChangesAsync(); + + var answers = await GetAnswer(answer.QuestionId.ToString()); + await _answerHubContext.Clients.All.SendAsync("ReceiveAnswer", answers); + return new ApiSuccessResult(); } - + private async Task>> GetSubAnswer(string? answerId) + { + List result = new(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); + var listSubAnswer = await _dataContext.SubAnswers.Where(x => x.PreAnswerId.ToString() == answerId).OrderBy(x => x.CreatedAt).ToListAsync(); + foreach (var item in listSubAnswer) + { + var answer = _mapper.Map(item); + answer.UserShort = GetUserShort(users, item.AuthorId); + result.Add(answer); + } + return new ApiSuccessResult>(result); + } public async Task> CreateSubAnswer(SubAnswerQuestionDto subAnswer) { - var answer = await _dataContext.Answers.FirstOrDefaultAsync(x => x.Id.Equals(subAnswer.PreAnswerId)); + var answer = await _dataContext.Answers.FirstOrDefaultAsync(x => x.Id.Equals(subAnswer.PreAnswerId) && !x.IsDeleted); if (answer == null) { return new ApiErrorResult("Không tìm được câu trả lời"); } SubAnswer sub = _mapper.Map(subAnswer); sub.PreAnswerId = answer.Id; + sub.CreatedAt = DateTime.Now; + _dataContext.SubAnswers.Add(sub); await _dataContext.SaveChangesAsync(); + var answers = await GetAnswer(answer.QuestionId.ToString()); + await _answerHubContext.Clients.All.SendAsync("ReceiveAnswer", answers); return new ApiSuccessResult("Trả lời thành công"); } - - public async Task> UpdateSubAnswer(SubAnswerQuestionDto subAnswer) + public async Task> UpdateSubAnswer(SubAnswerQuestionDto subAnswer) { var user = await _userManager.FindByIdAsync(subAnswer.AuthorId.ToString()); var subAns = await _dataContext.SubAnswers.FirstOrDefaultAsync(x => x.Id == subAnswer.Id); if (subAns == null) { - return new ApiErrorResult("Không tìm thấy câu trả lời!"); + return new ApiErrorResult("Không tìm thấy câu trả lời!"); } subAns.Content = subAnswer.Content; - subAns.UpdateAt = DateTime.Now; + subAns.UpdatedAt = DateTime.Now; _dataContext.SubAnswers.Update(subAns); await _dataContext.SaveChangesAsync(); + var subAnswers = await GetSubAnswer(subAns.PreAnswerId.ToString()); + await _answerHubContext.Clients.All.SendAsync("ReceiveSubAnswer", subAnswers); - var subAnsResponse = _mapper.Map(subAns); - var useDto = new UserShortDto() - { - FullName = user.Fullname, - Id = user.Id, - Image = user.Image - }; - subAnsResponse.UserShort = useDto; - - return new ApiSuccessResult(subAnsResponse); + return new ApiSuccessResult("Đã cập nhập bình luận"); } + public async Task> DeteleSubAnswer(string id) { var subAnswer = await _dataContext.SubAnswers.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(id))); @@ -199,39 +233,84 @@ public async Task> DeteleSubAnswer(string id) } _dataContext.SubAnswers.Remove(subAnswer); await _dataContext.SaveChangesAsync(); + + var subAnswers = await GetSubAnswer(subAnswer.PreAnswerId.ToString()); + await _answerHubContext.Clients.All.SendAsync("ReceiveSubAnswer", subAnswers); + return new ApiSuccessResult(); } - public async Task> ConfirmOrNoConfirm(AnswerFpkDto answerFpk) + public async Task> ConfirmedByQuestioner(string answerId) { - var answer = await _dataContext.Answers.FirstOrDefaultAsync(x=> x.Id.Equals(Guid.Parse(answerFpk.AnswerId))); - if(answer == null) + var answer = await _dataContext.Answers.FirstOrDefaultAsync(x=> x.Id.Equals(Guid.Parse(answerId)) && !x.IsDeleted); + if (answer == null) { - return new ApiErrorResult("Không tìm thấy câu trả lời"); + return new ApiErrorResult("Không tìm thấy câu trả lời"); } - var check = _dataContext.AnswerVotes.Where(x => x.AnswerId == answer.Id && x.UserId == Guid.Parse(answerFpk.UserId)).FirstOrDefault(); - var mess = ""; - var voteNumber = await _dataContext.AnswerVotes.Where(x=>x.AnswerId == answer.Id).CountAsync(); - if(check is null) + if (answer.Confirm == true) { - var vote = new AnswerVote() + answer.Confirm = false; + _dataContext.Answers.Update(answer); + await _dataContext.SaveChangesAsync(); + return new ApiSuccessResult(new() { Check = false, Quantity = 1 }); + } else + { + var item = await _dataContext.Answers.FirstOrDefaultAsync(x => x.QuestionId.Equals(answer.QuestionId) && x.Confirm == true); + if(item != null) + { + item.Confirm = false; + answer.Confirm = true; + _dataContext.Answers.Update(item); + _dataContext.Answers.Update(answer); + } else + { + answer.Confirm = true; + _dataContext.Answers.Update(answer); + } + await _dataContext.SaveChangesAsync(); + return new ApiSuccessResult(new() { Check = true, Quantity = 1 }); + } + + + } + + public async Task> VoteConfirmByUser(AnswerFpkDto answer) + { + var userVote = await _dataContext.AnswerVotes.FirstOrDefaultAsync(x => x.UserId.ToString().Equals(answer.UserId) && x.AnswerId.ToString().Equals(answer.AnswerId)); + if (userVote == null) + { + var answerVote = new AnswerVote() { Id = Guid.NewGuid(), - AnswerId = answer.Id, - UserId = Guid.Parse(answerFpk.UserId), + QuestionId = Guid.Parse(answer.QuestionId), + AnswerId = Guid.Parse(answer.AnswerId), + UserId = Guid.Parse(answer.UserId) }; - _dataContext.AnswerVotes.Add(vote); + _dataContext.AnswerVotes.Add(answerVote); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(voteNumber + 1); + var numberVote = await _dataContext.AnswerVotes.Where(x => x.AnswerId == Guid.Parse(answer.AnswerId)).CountAsync(); + return new ApiSuccessResult(new() { Check = true, Quantity = numberVote }); + } else { - _dataContext.AnswerVotes.Remove(check); + _dataContext.AnswerVotes.Remove(userVote); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(voteNumber - 1); + var numberVote = await _dataContext.AnswerVotes.Where(x => x.AnswerId == Guid.Parse(answer.AnswerId)).CountAsync(); + return new ApiSuccessResult(new() { Check = false, Quantity = numberVote }); + } } + + public async Task> GetMyVote(string answerId, string userId) + { + var myVotes = await _dataContext.AnswerVotes.Where(x => x.AnswerId.ToString().Equals(answerId) && x.UserId.ToString().Equals(userId)).FirstOrDefaultAsync(); + if(myVotes != null) + { + return new ApiSuccessResult(new() { Check = false, Quantity = 0 }) ; + } return new ApiSuccessResult(new() { Check = true, Quantity = 0 }); + } } } diff --git a/VNH.Infrastructure/Implement/Catalog/Forum/QuestionService.cs b/VNH.Infrastructure/Implement/Catalog/Forum/QuestionService.cs index 6e644fc..df1cdf7 100644 --- a/VNH.Infrastructure/Implement/Catalog/Forum/QuestionService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Forum/QuestionService.cs @@ -1,22 +1,13 @@ using AutoMapper; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Tokens; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection.Metadata; -using System.Text; using VNH.Application.DTOs.Catalog.Forum.Question; -using VNH.Application.DTOs.Catalog.HashTags; using VNH.Application.DTOs.Catalog.Posts; -using VNH.Application.DTOs.Catalog.Users; +using VNH.Application.DTOs.Common; using VNH.Application.DTOs.Common.ResponseNotification; using VNH.Application.Interfaces.Catalog.Forum; -using VNH.Application.Interfaces.Common; using VNH.Domain; -using VNH.Domain.Entities; using VNH.Infrastructure.Implement.Common; using VNH.Infrastructure.Presenters.Migrations; @@ -44,9 +35,13 @@ public async Task> Create(CreateQuestionDto reque var user = await _userManager.FindByEmailAsync(name); var question = _mapper.Map(requestDto); question.Id = Guid.NewGuid(); - question.CreateAt = DateTime.Now; + question.CreatedAt = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("SE Asia Standard Time")); ; question.AuthorId = user.Id; + question.ViewNumber = 0; + string formattedDateTime = question.CreatedAt.ToString("HHmmss.fff") + HandleCommon.GenerateRandomNumber().ToString(); + var Id = HandleCommon.SanitizeString(requestDto.Title); + question.SubId = Id + "-" + formattedDateTime; try { _dataContext.Questions.Add(question); @@ -72,30 +67,8 @@ public async Task> Create(CreateQuestionDto reque await _dataContext.SaveChangesAsync(); } - - var questionResponse = _mapper.Map(question); - - var userDto = new UserShortDto() - { - FullName = user.Fullname, - Id = user.Id, - Image = user.Image, - }; - questionResponse.UserShort = userDto; - var listRequestTag = await _dataContext.QuestionTags.Where(x => x.QuestionId.Equals(Guid.Parse(questionResponse.Id))).Select(x => x.TagId).ToListAsync(); - - var tags = await _dataContext.Tags - .Where(x => listRequestTag.Any(TagId => TagId == x.Id)) - .ToListAsync(); - foreach (var tag in tags) - { - questionResponse.Tags.Add(new TagDto() - { - Name = tag.Name, - Id = tag.Id, - }); - } - return new ApiSuccessResult(questionResponse); + var result = await Detail(question.Id.ToString()); + return result; } catch (Exception ex) @@ -110,15 +83,19 @@ public async Task> Update(CreateQuestionDto reque { var user = await _userManager.FindByEmailAsync(name); - var updateQuestion = _dataContext.Questions.First(x => x.Id.Equals(requestDto.Id)); + var updateQuestion = _dataContext.Questions.First(x => x.Id.Equals(requestDto.Id) && !x.IsDeleted); if (updateQuestion is null) { return new ApiErrorResult("Lỗi :Câu hỏi không được cập nhập (không tìm thấy bài viết)"); } - updateQuestion.UpdateAt = DateTime.Now; + updateQuestion.UpdatedAt = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("SE Asia Standard Time")); ; updateQuestion.Content = requestDto.Content; updateQuestion.Title = requestDto.Title; + + string formattedDateTime = updateQuestion.CreatedAt.ToString("HHmmss.fff") + HandleCommon.GenerateRandomNumber().ToString(); + var Id = HandleCommon.SanitizeString(requestDto.Title); + updateQuestion.SubId = Id + "-" + formattedDateTime; try { _dataContext.Questions.Update(updateQuestion); @@ -127,48 +104,31 @@ public async Task> Update(CreateQuestionDto reque var tagOfQuestion = await _dataContext.QuestionTags.Where(x => x.QuestionId.Equals(updateQuestion.Id)).ToListAsync(); _dataContext.QuestionTags.RemoveRange(tagOfQuestion); - foreach (var item in requestDto.Tag) + if (requestDto.Tag != null) { - var tag = new Tag() - { - Id = Guid.NewGuid(), - Name = item - }; - var questionTag = new QuestionTag() + foreach (var item in requestDto.Tag) { - QuestionId = requestDto.Id, - TagId = tag.Id - }; - _dataContext.QuestionTags.Add(questionTag); - _dataContext.Tags.Add(tag); + var tag = new Tag() + { + Id = Guid.NewGuid(), + Name = item + }; + var questionTag = new QuestionTag() + { + Id = Guid.NewGuid(), + QuestionId = requestDto.Id, + TagId = tag.Id + }; + _dataContext.QuestionTags.Add(questionTag); + _dataContext.Tags.Add(tag); + } + await _dataContext.SaveChangesAsync(); } - await _dataContext.SaveChangesAsync(); - - var questionResponse = _mapper.Map(updateQuestion); - - var useDto = new UserShortDto() - { - FullName = user.Fullname, - Id = user.Id, - Image = user.Image - }; - questionResponse.UserShort = useDto; - var listQuestionTag = await _dataContext.QuestionTags.Where(x => x.QuestionId.Equals(questionResponse.Id)).Select(x => x.TagId).ToListAsync(); - var tags = await _dataContext.Tags - .Where(x => listQuestionTag.Any(TagId => TagId == x.Id)) - .ToListAsync(); - foreach (var tag in tags) - { - questionResponse.Tags.Add(new TagDto() - { - Name = tag.Name, - Id = tag.Id, - }); - } + var question = await Detail(updateQuestion.Id.ToString()); - return new ApiSuccessResult(questionResponse); + return question; } catch (Exception ex) { @@ -176,9 +136,9 @@ public async Task> Update(CreateQuestionDto reque } } - public async Task> Detail(string Id) + public async Task> Detail(string Id) { - var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(Id))); + var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(Id)) && !x.IsDeleted); if (question is null) { return new ApiErrorResult("Không tìm thấy câu hỏi"); @@ -205,8 +165,10 @@ public async Task> Detail(string Id) Image = user.Image }; question.ViewNumber += 1; + questionResponse.ViewNumber += 1; questionResponse.SaveNumber = await _dataContext.QuestionSaves.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); questionResponse.CommentNumber = await _dataContext.Answers.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + questionResponse.LikeNumber = await _dataContext.QuestionLikes.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); _dataContext.Questions.Update(question); await _dataContext.SaveChangesAsync(); @@ -215,13 +177,17 @@ public async Task> Detail(string Id) public async Task>> GetAll() { - var questions = await _dataContext.Questions.ToListAsync(); + var questions = await _dataContext.Questions.Where(x=> !x.IsDeleted).OrderByDescending(x => x.CreatedAt).ToListAsync(); var users = await _dataContext.User.ToListAsync(); var result = new List(); foreach (var item in questions) { var question = _mapper.Map(item); + question.CommentNumber = await _dataContext.Answers.Where(x => x.QuestionId.ToString() == question.Id).CountAsync(); + question.SaveNumber = await _dataContext.QuestionSaves.Where(x => x.QuestionId.ToString() == question.Id).CountAsync(); + question.LikeNumber = await _dataContext.QuestionLikes.Where(x => x.QuestionId.ToString() == question.Id).CountAsync(); + var userShort = users.First(x => x.Id == item.AuthorId); if (userShort is not null) { @@ -242,20 +208,21 @@ public async Task> Delete(string id, string userId) { return new ApiErrorResult("Không tìm thấy câu hỏi"); } - - _dataContext.Questions.Remove(question); + + question.IsDeleted = true; + _dataContext.Questions.Update(question); await _dataContext.SaveChangesAsync(); return new ApiSuccessResult("Đã xóa câu hỏi"); } - public async Task> AddOrRemoveSaveQuestion(QuestionFpkDto questionFpk) + public async Task> AddOrRemoveSaveQuestion(QuestionFpkDto questionFpk) { - var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(questionFpk.QuestionId))); + var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(questionFpk.QuestionId)) && !x.IsDeleted); if (question is null) { - return new ApiErrorResult("Không tìm thấy câu hỏi"); + return new ApiErrorResult("Không tìm thấy câu hỏi"); } var check = _dataContext.QuestionSaves.Where(x => x.QuestionId == question.Id && x.UserId == Guid.Parse(questionFpk.UserId)).FirstOrDefault(); var mess = ""; @@ -270,23 +237,23 @@ public async Task> AddOrRemoveSaveQuestion(QuestionFpkDto questio }; _dataContext.QuestionSaves.Add(save); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(saveNumber + 1); + return new ApiSuccessResult(new() { Check = true, Quantity = saveNumber + 1 }); } else { _dataContext.QuestionSaves.Remove(check); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(saveNumber - 1); + return new ApiSuccessResult(new() { Check = true, Quantity = saveNumber - 1 }); } } - public async Task> GetSave(QuestionFpkDto questionFpk) + public async Task> GetSave(QuestionFpkDto questionFpk) { - var question = _dataContext.Questions.First(x => x.Id.Equals(Guid.Parse(questionFpk.QuestionId))); + var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.Id.Equals(Guid.Parse(questionFpk.QuestionId)) && !x.IsDeleted); + var number = await _dataContext.QuestionSaves.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); var check = await _dataContext.QuestionSaves.Where(x => x.QuestionId.Equals(question.Id) && x.UserId == Guid.Parse(questionFpk.UserId)).FirstOrDefaultAsync(); - var reuslt = check != null; - return new ApiSuccessResult(reuslt); + return new ApiSuccessResult(new() { Check = check != null, Quantity = number }) ; } public async Task>> GetAllTag(int numberTag) { @@ -307,7 +274,7 @@ public async Task>> GetQuestionByTag(string .Where(question => _dataContext.QuestionTags .Any(questionTag => _dataContext.Tags .Any(tagEntity => tagEntity.Name.ToLower().Contains(tag.ToLower()) && tagEntity.Id == questionTag.TagId) - && questionTag.QuestionId == question.Id)) + && questionTag.QuestionId == question.Id) && !question.IsDeleted) .ToListAsync(); if (questions.IsNullOrEmpty()) { @@ -331,7 +298,202 @@ public async Task>> GetQuestionByTag(string return new ApiSuccessResult>(result); } + public async Task> SubDetail(string subId) + { + var question = await _dataContext.Questions.Where(x=> !x.IsDeleted).FirstOrDefaultAsync(x => x.SubId.Equals(subId)); + if (question is null) + { + return new ApiErrorResult("Không tìm thấy câu hỏi"); + } + var user = await _userManager.FindByIdAsync(question.AuthorId.ToString()); + var questionResponse = _mapper.Map(question); + + var listQuestionTag = await _dataContext.QuestionTags.Where(x => x.QuestionId.Equals(Guid.Parse(questionResponse.Id))).Select(x => x.TagId).ToListAsync(); + var tags = await _dataContext.Tags + .Where(x => listQuestionTag.Any(TagId => TagId == x.Id)) + .ToListAsync(); + foreach (var tag in tags) + { + questionResponse.Tags.Add(new() + { + Name = tag.Name, + Id = tag.Id, + }); + } + questionResponse.UserShort = new() + { + FullName = user.Fullname, + Id = user.Id, + Image = user.Image + }; + question.ViewNumber += 1; + questionResponse.ViewNumber += 1; + questionResponse.SaveNumber = await _dataContext.QuestionSaves.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + questionResponse.CommentNumber = await _dataContext.Answers.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + + _dataContext.Questions.Update(question); + await _dataContext.SaveChangesAsync(); + return new ApiSuccessResult(questionResponse); + } + + public async Task> GetLike(QuestionFpkDto questionFpk) + { + var question = _dataContext.Questions.First(x => x.SubId.Equals(questionFpk.QuestionId) && !x.IsDeleted); + var check = await _dataContext.QuestionLikes.Where(x => x.QuestionId.Equals(question.Id) && x.UserId == Guid.Parse(questionFpk.UserId)).FirstOrDefaultAsync(); + var number = await _dataContext.QuestionLikes.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + return new ApiSuccessResult(new() { Check = (check != null), Quantity = number }); + } + public async Task> AddOrUnLikeQuestion(QuestionFpkDto questionFpk) + { + var question = await _dataContext.Questions.FirstOrDefaultAsync(x => x.SubId.Equals(questionFpk.QuestionId) && !x.IsDeleted); + if (question is null) + { + return new ApiErrorResult("Không tìm thấy câu hỏi"); + } + var check = _dataContext.QuestionLikes.Where(x => x.QuestionId == question.Id && x.UserId == Guid.Parse(questionFpk.UserId)).FirstOrDefault(); + var likeNumber = await _dataContext.QuestionLikes.Where(x => x.QuestionId == question.Id).CountAsync(); + if (check is null) + { + var like = new QuestionLike() + { + Id = Guid.NewGuid(), + QuestionId = question.Id, + UserId = Guid.Parse(questionFpk.UserId) + }; + _dataContext.QuestionLikes.Add(like); + await _dataContext.SaveChangesAsync(); + return new ApiSuccessResult(new() { Check = true, Quantity = likeNumber + 1 }); + } + else + { + _dataContext.QuestionLikes.Remove(check); + await _dataContext.SaveChangesAsync(); + return new ApiSuccessResult(new() { Check = false, Quantity = likeNumber - 1 }); + + } + } + + public async Task>> GetMyQuestion(string id) + { + var questions = await _dataContext.Questions.Where(x => x.AuthorId.Equals(Guid.Parse(id)) && !x.IsDeleted).ToListAsync(); + var result = new List(); + foreach (var item in questions) + { + var question = _mapper.Map(item); + question.SaveNumber = await _dataContext.QuestionSaves.Where(x => x.QuestionId.Equals(item.Id)).CountAsync(); + question.CommentNumber = await _dataContext.Answers.Where(x => x.QuestionId.Equals(item.Id)).CountAsync(); + question.LikeNumber = await _dataContext.QuestionLikes.Where(x => x.QuestionId.Equals(item.Id)).CountAsync(); + result.Add(question); + } + + return new ApiSuccessResult>(result); + } + + public async Task> ReportQuestion(ReportQuestionDto reportquestionDto) + { + var question = _dataContext.Questions.FirstOrDefault(x => x.SubId.Equals(reportquestionDto.QuestionId) && !x.IsDeleted); + if (question == null) + { + return new ApiErrorResult("Bài viết không tồn tại"); + } + var reportQuestion = _mapper.Map(reportquestionDto); + reportQuestion.Id = Guid.NewGuid(); + reportQuestion.QuestionId = question.Id; + _dataContext.QuestionReportDetails.Add(reportQuestion); + await _dataContext.SaveChangesAsync(); + + return new ApiSuccessResult("Đã gửi báo cáo đến kiểm duyệt viên! Chúng tôi sẽ phản hồi bạn sớm nhất có thể! Xin cảm ơn."); + } + + public async Task>> GetReport() + { + var reportPost = await _dataContext.QuestionReportDetails + .OrderByDescending(x => x.ReportDate) + .ToListAsync(); + var results = new List(); + foreach (var item in reportPost) + { + results.Add(_mapper.Map(item)); + } + return new ApiSuccessResult>(results); + } + + public async Task>> SearchQuestions(string keyWord) + { + if (keyWord.StartsWith("#")) + { + keyWord = keyWord.TrimStart('#'); + return await GetQuestionByTag(keyWord); + } + var users = await _dataContext.User.ToListAsync(); + var questions = new List(); + string[] searchKeywords = keyWord.ToLower().Split(' '); + var result = from question in _dataContext.Questions as IEnumerable + let titleWords = question.Title.ToLower().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) + let searchPhrases = HandleCommon.GenerateSearchPhrases(searchKeywords) + let matchingPhrases = searchPhrases + .Where(phrase => titleWords.Contains(phrase)) + where matchingPhrases.Any() + let matchCount = matchingPhrases.Count() + orderby matchCount descending + select new Question() + { + Id = question.Id, + SubId = question.SubId, + Title = question.Title, + CreatedAt = question.CreatedAt, + UpdatedAt = question.UpdatedAt, + AuthorId = question.AuthorId, + ViewNumber = question.ViewNumber, + }; + + foreach (var question in result) + { + var item = _mapper.Map(question); + var userShort = users.First(x => x.Id == question.AuthorId); + if (userShort is not null) + { + item.UserShort.FullName = userShort.Fullname; + item.UserShort.Id = userShort.Id; + item.UserShort.Image = userShort.Image; + } + questions.Add(item); + } + return new ApiSuccessResult>(questions); + } + + public async Task>> GetMyQuestionSaved(string id) + { + Guid userId = Guid.Parse(id); + var users = await _dataContext.User.ToListAsync(); + + var questions = await( + from questionSave in _dataContext.QuestionSaves + join question in _dataContext.Questions on questionSave.QuestionId equals question.Id + where questionSave.UserId == userId + select question + ).ToListAsync(); + + var result = new List(); + foreach (var item in questions) + { + var question = _mapper.Map(item); + var userShort = users.First(x => x.Id == item.AuthorId); + if (userShort is not null) + { + question.UserShort.FullName = userShort.Fullname; + question.UserShort.Id = userShort.Id; + question.UserShort.Image = userShort.Image; + } + question.SaveNumber = await _dataContext.QuestionSaves.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + question.CommentNumber = await _dataContext.Answers.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + question.LikeNumber = await _dataContext.QuestionLikes.Where(x => x.QuestionId.Equals(question.Id)).CountAsync(); + result.Add(question); + } + + return new ApiSuccessResult>(result); + } } diff --git a/VNH.Infrastructure/Implement/Catalog/NewsHistory/NewsService.cs b/VNH.Infrastructure/Implement/Catalog/NewsHistory/NewsService.cs new file mode 100644 index 0000000..46450c9 --- /dev/null +++ b/VNH.Infrastructure/Implement/Catalog/NewsHistory/NewsService.cs @@ -0,0 +1,104 @@ +using HtmlAgilityPack; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VNH.Application.DTOs.Common.ResponseNotification; +using VNH.Application.Interfaces.Catalog.NewsHistory; +using VNH.Domain; +using VNH.Infrastructure.Presenters.Migrations; + +namespace VNH.Infrastructure.Implement.Catalog.NewsHistory +{ + public class NewsService : INewsService + { + private readonly VietNamHistoryContext _dataContext; + public NewsService(VietNamHistoryContext dataContext) + { + _dataContext = dataContext; + } + public async Task> CrawlNews(string url) + { + var httpClient = new HttpClient(); + var html = httpClient.GetStringAsync(url).Result; + + var htmlDocument = new HtmlDocument(); + htmlDocument.LoadHtml(html); + + var newsList = new List(); + try + { + var newsNodes = htmlDocument.DocumentNode.SelectNodes("//ul[@class='list-news']/li"); + if (newsNodes != null) + { + foreach (var newsNode in newsNodes) + { + var titleNode = newsNode.SelectSingleNode(".//h3/a"); + var descriptionNode = newsNode.SelectSingleNode(".//div[@class='sapo']"); + var imageNode = newsNode.SelectSingleNode(".//img"); + var pubDate = newsNode.SelectSingleNode(".//div[@class='catetime']//span[@class='time need-get-timeago']"); + + if (titleNode != null && descriptionNode != null && imageNode != null) + { + string titleAttributeValue = pubDate.GetAttributeValue("title", ""); + var news = new News + { + Id = Guid.NewGuid(), + Title = titleNode.InnerText.Trim(), + Description = descriptionNode.InnerText.Trim(), + Image = imageNode.GetAttributeValue("src", "").Trim(), + Url = "https://danviet.vn" + titleNode.GetAttributeValue("href", "").Trim(), + CreatedAt = DateTime.Parse(titleAttributeValue) + }; + + newsList.Add(news); + } + } + } + int countUpdate = 0; + newsList = newsList.OrderByDescending(x => x.CreatedAt).ToList(); + if (newsList.Count != 0) + { + var news = await _dataContext.News.ToListAsync(); + var article = news.OrderByDescending(x => x.CreatedAt).FirstOrDefault(); + if (news != null && article != null) + { + foreach (var item in newsList) + { + if (item.CreatedAt <= article.CreatedAt) + { + break; + } + countUpdate++; + _dataContext.News.Add(item); + await _dataContext.SaveChangesAsync(); + } + } + else + { + countUpdate = newsList.Count; + _dataContext.News.AddRange(newsList); + await _dataContext.SaveChangesAsync(); + } + } + + return new ApiSuccessResult(countUpdate); + + } + catch (Exception e) + { + return new ApiErrorResult("Lỗi crawl: " + e.Message); + } + + } + + public async Task>> GetNews() + { + var news = await _dataContext.News.ToListAsync(); + news = news.OrderByDescending(news => news.CreatedAt).ToList(); + return new ApiSuccessResult>(news); + } + } +} diff --git a/VNH.Infrastructure/Implement/Catalog/Posts/PostService.cs b/VNH.Infrastructure/Implement/Catalog/Posts/PostService.cs index d5e1548..3939e22 100644 --- a/VNH.Infrastructure/Implement/Catalog/Posts/PostService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Posts/PostService.cs @@ -4,18 +4,15 @@ using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; -using System.Globalization; -using System.Net.NetworkInformation; -using System.Text; -using System.Text.RegularExpressions; -using VNH.Application.DTOs.Catalog.HashTags; using VNH.Application.DTOs.Catalog.Posts; using VNH.Application.DTOs.Catalog.Users; +using VNH.Application.DTOs.Common; using VNH.Application.DTOs.Common.ResponseNotification; using VNH.Application.Interfaces.Common; using VNH.Application.Interfaces.Posts; using VNH.Domain; using VNH.Domain.Entities; +using VNH.Infrastructure.Implement.Common; using VNH.Infrastructure.Presenters; using VNH.Infrastructure.Presenters.Migrations; @@ -49,8 +46,8 @@ public async Task> Create(CreatePostDto requestDto, s post.CreatedAt = DateTime.Now; post.UserId = user.Id; post.TopicId = requestDto.TopicId; - string formattedDateTime = post.CreatedAt.ToString("HH:mm:ss.fff-dd-MM-yyyy"); - var Id = SanitizeString(post.Title); + string formattedDateTime = post.CreatedAt.ToString("HHmmss.fff") + HandleCommon.GenerateRandomNumber().ToString(); + var Id = HandleCommon.SanitizeString(post.Title); post.SubId = Id + "-" + formattedDateTime; try { @@ -76,32 +73,9 @@ public async Task> Create(CreatePostDto requestDto, s } await _dataContext.SaveChangesAsync(); } - var postReponse = _mapper.Map(post); - - postReponse.Image = post.Image; - var useDto = new UserShortDto() - { - FullName = user.Fullname, - Id = user.Id, - Image = user.Image - }; - postReponse.UserShort = useDto; - var listPostTag = await _dataContext.PostTags.Where(x => x.PostId.Equals(postReponse.Id)).Select(x => x.TagId).ToListAsync(); - - var tags = await _dataContext.Tags - .Where(x => listPostTag.Any(TagId => TagId == x.Id)) - .ToListAsync(); - foreach (var tag in tags) - { - postReponse.Tags.Add(new TagDto() - { - Name = tag.Name, - Id = tag.Id, - }); - } - var topic = await _dataContext.Topics.FirstAsync(x => x.Id == post.TopicId); - postReponse.TopicName = topic.Title; + var detail = await Detail(post.SubId); + var postReponse = detail.ResultObj; return new ApiSuccessResult(postReponse); } @@ -110,49 +84,26 @@ public async Task> Create(CreatePostDto requestDto, s return new ApiErrorResult("Lỗi lưu bài viết : " + ex.Message); } } - - private static string RemoveDiacritics(string input) - { - string normalizedString = input.Normalize(NormalizationForm.FormD); - StringBuilder stringBuilder = new StringBuilder(); - - foreach (char c in normalizedString) - { - if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark) - { - stringBuilder.Append(c); - } - } - - return stringBuilder.ToString().Normalize(NormalizationForm.FormC); - } - private static string SanitizeString(string input) - { - string withoutDiacritics = RemoveDiacritics(input).Trim().Replace(" ", "-"); - string sanitizedString = Regex.Replace(withoutDiacritics, "[^a-zA-Z0-9-]", ""); - - return sanitizedString; - } - public async Task> Update(CreatePostDto requestDto, string name) { var user = await _userManager.FindByEmailAsync(name); - var updatePost = _dataContext.Posts.First(x=>x.Id.Equals(requestDto.Id)); + var updatePost = _dataContext.Posts.First(x=>x.Id.Equals(requestDto.Id) && !x.IsDeleted); if (updatePost is null) { return new ApiErrorResult("Lỗi :Bài viết không được cập nhập (không tìm thấy bài viết)"); } - if (updatePost.Image != string.Empty) + if (updatePost.Image != string.Empty && requestDto.Image != null) { await _storageService.DeleteFileAsync(updatePost.Image); + updatePost.Image = await _image.SaveFile(requestDto.Image); } - updatePost.Image = await _image.SaveFile(requestDto.Image); + updatePost.Title = requestDto.Title; updatePost.UpdatedAt = DateTime.Now; updatePost.TopicId = requestDto.TopicId; updatePost.Content = requestDto.Content; - string formattedDateTime = DateTime.Now.ToString("HH:mm:ss.fff-dd-MM-yyyy"); - var Id = SanitizeString(updatePost.Title); + string formattedDateTime = DateTime.Now.ToString("HHmmss.fff") + HandleCommon.GenerateRandomNumber().ToString(); + var Id = HandleCommon.SanitizeString(requestDto.Title); updatePost.SubId = Id.Trim().Replace(" ", "-") + "-" + formattedDateTime; try { @@ -179,32 +130,8 @@ public async Task> Update(CreatePostDto requestDto, s } await _dataContext.SaveChangesAsync(); - var postReponse = _mapper.Map(updatePost); - - postReponse.Image = updatePost.Image; - var useDto = new UserShortDto() - { - FullName = user.Fullname, - Id = user.Id, - Image = user.Image - }; - postReponse.UserShort = useDto; - var listPostTag = await _dataContext.PostTags.Where(x => x.PostId.Equals(postReponse.Id)).Select(x => x.TagId).ToListAsync(); - - var tags = await _dataContext.Tags - .Where(x => listPostTag.Any(TagId => TagId == x.Id)) - .ToListAsync(); - foreach (var tag in tags) - { - postReponse.Tags.Add(new TagDto() - { - Name = tag.Name, - Id = tag.Id, - }); - } - - var topic = await _dataContext.Topics.FirstAsync(x => x.Id == updatePost.TopicId); - postReponse.TopicName = topic.Title; + var detail = await Detail(updatePost.SubId); + var postReponse = detail.ResultObj; return new ApiSuccessResult(postReponse); } @@ -216,14 +143,13 @@ public async Task> Update(CreatePostDto requestDto, s public async Task> Detail(string Id) { - var post = await _dataContext.Posts.FirstOrDefaultAsync(x=>x.SubId.Equals(Id)); + var post = await _dataContext.Posts.FirstOrDefaultAsync(x=>x.SubId.Equals(Id) && !x.IsDeleted); if (post is null) { return new ApiErrorResult("Không tìm thấy bài viết"); } var user = await _userManager.FindByIdAsync(post.UserId.ToString()); var postResponse = _mapper.Map(post); - postResponse.Image = post.Image; var listPostTag = await _dataContext.PostTags.Where(x => x.PostId.Equals(postResponse.Id)).Select(x => x.TagId).ToListAsync(); var tags = await _dataContext.Tags @@ -244,8 +170,8 @@ public async Task> Detail(string Id) Image = user.Image }; post.ViewNumber += 1; - var topic = await _dataContext.Topics.FirstAsync(x => x.Id == post.TopicId); - postResponse.TopicName = topic.Title; + var topic = await _dataContext.Topics.FirstOrDefaultAsync(x => x.Id == post.TopicId); + postResponse.TopicName = topic?.Title; postResponse.SaveNumber = await _dataContext.PostSaves.Where(x=>x.PostId.Equals(post.Id)).CountAsync(); postResponse.CommentNumber = await _dataContext.PostComments.Where(x => x.PostId.Equals(post.Id)).CountAsync(); postResponse.LikeNumber = await _dataContext.PostLikes.Where(x=>x.PostId.Equals(post.Id)).CountAsync(); @@ -257,8 +183,9 @@ public async Task> Detail(string Id) public async Task>> GetAll() { - var posts = await _dataContext.Posts.ToListAsync(); - var users = await _dataContext.User.ToListAsync(); + var posts = await _dataContext.Posts.Where(x=>!x.IsDeleted).OrderByDescending(x => x.CreatedAt).ToListAsync(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); + var topics = await _dataContext.Topics.ToListAsync(); var result = new List(); foreach (var item in posts) @@ -271,7 +198,33 @@ public async Task>> GetAll() post.UserShort.Id = userShort.Id; post.UserShort.Image = userShort.Image; } - post.Image = item.Image; + post.TopicName = topics.FirstOrDefault(x => x.Id == item.TopicId)?.Title ?? ""; + result.Add(post); + } + + return new ApiSuccessResult>(result); + } + public async Task>> GetAllMobile() + { + var posts = await _dataContext.Posts.Where(x => !x.IsDeleted).OrderByDescending(x => x.CreatedAt).ToListAsync(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); + var topics = await _dataContext.Topics.ToListAsync(); + + var result = new List(); + foreach (var item in posts) + { + var post = _mapper.Map(item); + var userShort = users.First(x => x.Id == item.UserId); + if (userShort is not null) + { + post.UserShort.FullName = userShort.Fullname; + post.UserShort.Id = userShort.Id; + post.UserShort.Image = userShort.Image; + } + post.TopicName = topics.FirstOrDefault(x => x.Id == item.TopicId)?.Title; + post.SaveNumber = await _dataContext.PostSaves.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + post.CommentNumber = await _dataContext.PostComments.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + post.LikeNumber = await _dataContext.PostLikes.Where(x => x.PostId.Equals(post.Id)).CountAsync(); result.Add(post); } @@ -280,17 +233,17 @@ public async Task>> GetAll() public async Task> Delete(string id, string userId) { - var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.Id.Equals(id) && x.UserId.ToString().Equals(userId)); + var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.Id.Equals(id) && x.UserId.ToString().Equals(userId) && !x.IsDeleted); if (post is null) { return new ApiErrorResult("Không tìm thấy bài viết"); } - if (post.Image != string.Empty) - { - await _storageService.DeleteFileAsync(post.Image); - } - _dataContext.Posts.Remove(post); - + //if (post.Image != string.Empty) + //{ + // await _storageService.DeleteFileAsync(post.Image); + //} + post.IsDeleted = true; + _dataContext.Posts.Update(post); await _dataContext.SaveChangesAsync(); return new ApiSuccessResult("Đã xóa bài viết"); @@ -298,28 +251,29 @@ public async Task> Delete(string id, string userId) public async Task> DeleteAdmin(string id) { - var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.Id.Equals(id)); + var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.Id.Equals(id) && !x.IsDeleted); if (post is null) { return new ApiErrorResult("Không tìm thấy bài viết"); } - if (post.Image != string.Empty) - { - await _storageService.DeleteFileAsync(post.Image); - } - _dataContext.Posts.Remove(post); + //if (post.Image != string.Empty) + //{ + // await _storageService.DeleteFileAsync(post.Image); + //} + post.IsDeleted = true; + _dataContext.Posts.Update(post); await _dataContext.SaveChangesAsync(); return new ApiSuccessResult("Đã xóa bài viết"); } - public async Task> AddOrUnLikePost(PostFpkDto postFpk) + public async Task> AddOrUnLikePost(PostFpkDto postFpk) { - var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.SubId.Equals(postFpk.PostId)); + var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.SubId.Equals(postFpk.PostId) && !x.IsDeleted); if (post is null) { - return new ApiErrorResult("Không tìm thấy bài viết"); + return new ApiErrorResult("Không tìm thấy bài viết"); } var check = _dataContext.PostLikes.Where(x => x.PostId == post.Id && x.UserId == Guid.Parse(postFpk.UserId)).FirstOrDefault(); var likeNumber = await _dataContext.PostLikes.Where(x => x.PostId == post.Id).CountAsync(); @@ -333,23 +287,24 @@ public async Task> AddOrUnLikePost(PostFpkDto postFpk) }; _dataContext.PostLikes.Add(like); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(likeNumber+1); + return new ApiSuccessResult(new() { Check = true, Quantity = likeNumber + 1}); } else { - _dataContext.PostLikes.Remove(check); + _dataContext.PostLikes.Remove(check); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(likeNumber-1); + return new ApiSuccessResult(new() { Check = false, Quantity = likeNumber - 1 }); + } } - public async Task> AddOrRemoveSavePost(PostFpkDto postFpk) + public async Task> AddOrRemoveSavePost(PostFpkDto postFpk) { - var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.SubId.Equals(postFpk.PostId)); + var post = await _dataContext.Posts.FirstOrDefaultAsync(x => x.SubId.Equals(postFpk.PostId) && !x.IsDeleted); if (post is null) { - return new ApiErrorResult("Không tìm thấy bài viết"); + return new ApiErrorResult("Không tìm thấy bài viết"); } var check = _dataContext.PostSaves.Where(x => x.PostId == post.Id && x.UserId == Guid.Parse(postFpk.UserId)).FirstOrDefault(); var saveNumber = await _dataContext.PostSaves.Where(x => x.PostId == post.Id).CountAsync(); @@ -363,13 +318,13 @@ public async Task> AddOrRemoveSavePost(PostFpkDto postFpk) }; _dataContext.PostSaves.Add(save); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(saveNumber+1); + return new ApiSuccessResult(new() { Check = true, Quantity = saveNumber + 1 }); } else { _dataContext.PostSaves.Remove(check); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(saveNumber-1); + return new ApiSuccessResult(new() { Check = false, Quantity = saveNumber - 1 }); } @@ -377,7 +332,7 @@ public async Task> AddOrRemoveSavePost(PostFpkDto postFpk) public async Task> ReportPost(ReportPostDto reportPostDto) { - var post = _dataContext.Posts.FirstOrDefault(x => x.SubId.Equals(reportPostDto.PostId)); + var post = _dataContext.Posts.FirstOrDefault(x => x.SubId.Equals(reportPostDto.PostId) && !x.IsDeleted); if (post == null) { return new ApiErrorResult("Bài viết không tồn tại"); @@ -391,8 +346,7 @@ public async Task> ReportPost(ReportPostDto reportPostDto) return new ApiSuccessResult("Đã gửi báo cáo đến kiểm duyệt viên! Chúng tôi sẽ phản hồi bạn sớm nhất có thể! Xin cảm ơn."); } - [Authorize(Roles = "admin")] - public async Task> GetReport() + public async Task>> GetReport() { var reportPost = await _dataContext.PostReportDetails .OrderByDescending(x=>x.ReportDate) @@ -402,23 +356,23 @@ public async Task> GetReport() { results.Add(_mapper.Map(item)); } - return results; + return new ApiSuccessResult>(results); } - public async Task> GetLike(PostFpkDto postFpk) + public async Task> GetLike(PostFpkDto postFpk) { - var post = _dataContext.Posts.First(x => x.SubId.Equals(postFpk.PostId)); + var post = _dataContext.Posts.First(x => x.SubId.Equals(postFpk.PostId) && !x.IsDeleted); var check = await _dataContext.PostLikes.Where(x => x.PostId.Equals(post.Id) && x.UserId == Guid.Parse(postFpk.UserId)).FirstOrDefaultAsync(); - var reuslt = check != null; - return new ApiSuccessResult(reuslt); + var number = await _dataContext.PostLikes.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + return new ApiSuccessResult(new() { Check = (check != null), Quantity = number}); } - public async Task> GetSave(PostFpkDto postFpk) + public async Task> GetSave(PostFpkDto postFpk) { - var post = _dataContext.Posts.First(x => x.SubId.Equals(postFpk.PostId)); + var post = _dataContext.Posts.First(x => x.SubId.Equals(postFpk.PostId) && !x.IsDeleted); var check = await _dataContext.PostSaves.Where(x => x.PostId.Equals(post.Id) && x.UserId == Guid.Parse(postFpk.UserId)).FirstOrDefaultAsync(); - var reuslt = check != null; - return new ApiSuccessResult(reuslt); + var number = await _dataContext.PostSaves.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + return new ApiSuccessResult(new() { Check = (check != null), Quantity = number }); } public async Task>> GetPostByTag(string tag) @@ -426,14 +380,14 @@ public async Task>> GetPostByTag(string tag) var posts = await _dataContext.Posts .Where(post => _dataContext.PostTags .Any(postTag => _dataContext.Tags - .Any(tagEntity => tagEntity.Name.ToLower().Contains(tag.ToLower()) && tagEntity.Id == postTag.TagId) + .Any(tagEntity => tagEntity.Name.ToLower().Equals(tag.ToLower()) && tagEntity.Id == postTag.TagId) && postTag.PostId == post.Id)) .ToListAsync(); if (posts.IsNullOrEmpty()) { return new ApiSuccessResult>(new List()); } - var users = await _dataContext.User.ToListAsync(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); var result = new List(); foreach (var item in posts) @@ -447,6 +401,9 @@ public async Task>> GetPostByTag(string tag) post.UserShort.Image = userShort.Image; } post.Image = item.Image; + var topic = await _dataContext.Topics.FirstOrDefaultAsync(x => x.Id == item.TopicId); + post.TopicName = topic?.Title; + result.Add(post); } return new ApiSuccessResult>(result); @@ -454,12 +411,12 @@ public async Task>> GetPostByTag(string tag) public async Task>> GetComment(string postId) { - var post = await _dataContext.Posts.FirstAsync(x => x.SubId.Equals(postId)); + var post = await _dataContext.Posts.FirstAsync(x => x.SubId.Equals(postId) && !x.IsDeleted); if (post == null) { return new ApiSuccessResult>(); } - var users = await _dataContext.User.ToListAsync(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); var postComment = await _dataContext.PostComments.Where(x=>x.PostId.Equals(post.Id)).ToListAsync(); var postSubComment = await _dataContext.PostSubComments.ToListAsync(); @@ -493,7 +450,7 @@ public async Task>> GetComment(string postId) private UserShortDto? GetUserShort(List users, Guid? IdUser) { return users - .Where(x => x.Id.Equals(IdUser)) + .Where(x => x.Id.Equals(IdUser) && !x.IsDeleted) .Select(x => new UserShortDto { Id = x.Id, @@ -505,13 +462,14 @@ public async Task>> GetComment(string postId) public async Task>> CreateComment(CommentPostDto comment) { - var post = await _dataContext.Posts.FirstOrDefaultAsync(x=>x.SubId.Equals(comment.PostId)); + var post = await _dataContext.Posts.FirstOrDefaultAsync(x=>x.SubId.Equals(comment.PostId) && !x.IsDeleted); if (post == null) { return new ApiErrorResult>("Không tìm thấy bài đọc bạn bình luận, có thể nó đã bị xóa"); } PostComment postComment = _mapper.Map(comment); postComment.PostId = post.Id; + postComment.UpdatedAt = DateTime.Now; _dataContext.PostComments.Add(postComment); await _dataContext.SaveChangesAsync(); var comments = await GetComment(comment.PostId); @@ -533,28 +491,33 @@ public async Task>> UpdateComment(CommentPostDto _dataContext.PostComments.Update(postComment); await _dataContext.SaveChangesAsync(); - var comments = await GetComment(comment.PostId); + var subPost = await _dataContext.Posts.FirstAsync(x => x.Id == comment.PostId); + var comments = await GetComment(subPost.SubId); await _commentHubContext.Clients.All.SendAsync("ReceiveComment", comments); return comments; } - public async Task> DeteleComment(string id) + public async Task>> DeteleComment(string id) { var comment = await _dataContext.PostComments.FirstOrDefaultAsync(x=>x.Id.Equals(Guid.Parse(id))); if (comment == null) { - return new ApiErrorResult("Không tìm thấy bình luận"); + return new ApiErrorResult> ("Không tìm thấy bình luận"); } _dataContext.PostComments.Remove(comment); await _dataContext.SaveChangesAsync(); - return new ApiSuccessResult(); + + var subPost = await _dataContext.Posts.FirstAsync(x => x.Id == comment.PostId); + var comments = await GetComment(subPost.SubId); + await _commentHubContext.Clients.All.SendAsync("ReceiveComment", comments); + return comments; } public async Task>> GetMyPostSaved(string id) { Guid userId = Guid.Parse(id); - var users = await _dataContext.User.ToListAsync(); + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); var posts = await ( from postSave in _dataContext.PostSaves @@ -574,14 +537,139 @@ select post post.UserShort.Id = userShort.Id; post.UserShort.Image = userShort.Image; } - post.Image = item.Image; result.Add(post); } return new ApiSuccessResult>(result); } - public Task>> GetMyPost(string id) + public async Task>> GetMyPost(string id) { - throw new NotImplementedException(); + var posts = await _dataContext.Posts.Where(x=>x.UserId.Equals(Guid.Parse(id)) && !x.IsDeleted).ToListAsync(); + var result = new List(); + foreach (var item in posts) + { + var post = _mapper.Map(item); + post.SaveNumber = await _dataContext.PostSaves.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + post.CommentNumber = await _dataContext.PostComments.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + post.LikeNumber = await _dataContext.PostLikes.Where(x => x.PostId.Equals(post.Id)).CountAsync(); + result.Add(post); + } + + return new ApiSuccessResult>(result); + } + + public async Task>> SearchPosts(string keyWord) + { + if (keyWord.StartsWith("#")) + { + keyWord = keyWord.TrimStart('#'); + return await GetPostByTag(keyWord); + } + var users = await _dataContext.User.Where(x=> !x.IsDeleted).ToListAsync(); + var posts = new List(); + string[] searchKeywords = keyWord.ToLower().Split(' '); + var result = from post in _dataContext.Posts.Where(x => !x.IsDeleted) as IEnumerable + let titleWords = post.Title.ToLower().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries) + let searchPhrases = HandleCommon.GenerateSearchPhrases(searchKeywords) + let matchingPhrases = searchPhrases + .Where(phrase => titleWords.Contains(phrase)) + where matchingPhrases.Any() + let matchCount = matchingPhrases.Count() + orderby matchCount descending + select new Post() + { + Id = post.Id, + SubId = post.SubId, + Title = post.Title, + Image = post.Image, + CreatedAt = post.CreatedAt, + UpdatedAt = post.UpdatedAt, + UserId = post.UserId, + ViewNumber = post.ViewNumber + }; + + foreach (var post in result) + { + var item = _mapper.Map(post); + var userShort = users.First(x => x.Id == post.UserId); + if (userShort is not null) + { + item.UserShort.FullName = userShort.Fullname; + item.UserShort.Id = userShort.Id; + item.UserShort.Image = userShort.Image; + } + posts.Add(item); + } + return new ApiSuccessResult>(posts); + } + public async Task>> GetRandomPost(int quantity) + { + if (quantity == 0) + { + return await GetAll(); + } + DateTime currentDate = DateTime.Now; + DateTime startDate = currentDate.AddDays(-30); + var posts = await _dataContext.Posts + .Where(post => post.CreatedAt >= startDate && post.CreatedAt <= currentDate && !post.IsDeleted) + .Take(100) + .ToListAsync(); + + var list = new List(); + int[] numbers = {}; + Random random = new Random(); + var maxNum = posts.Count < 100 ? posts.Count : 99; + var getNum = quantity < posts.Count ? quantity : posts.Count; + for (int i = 0; i < getNum; i++) + { + var index = random.Next(0, maxNum); + if (!numbers.Contains(index)) + { + Array.Resize(ref numbers, numbers.Length + 1); + numbers[numbers.Length - 1] = index; + list.Add(posts[i]); + } else + { + i-=1; + } + } + var result = _mapper.Map>(list); + + return new ApiSuccessResult>(result); + + } + + public async Task>> FindByTopic(string topicName) + { + var posts = await _dataContext.Posts + .Where(post => _dataContext.TopicDetails + .Any(postTag => _dataContext.Topics + .Any(tagEntity => tagEntity.Title.ToLower().Equals(topicName.ToLower()) && tagEntity.Id == postTag.TopicId) + && postTag.PostId == post.Id) && !post.IsDeleted) + .ToListAsync(); + if (posts.IsNullOrEmpty()) + { + return new ApiSuccessResult>(new List()); + } + var users = await _dataContext.User.Where(x => !x.IsDeleted).ToListAsync(); + + var result = new List(); + foreach (var item in posts) + { + var post = _mapper.Map(item); + var userShort = users.First(x => x.Id == item.UserId); + if (userShort is not null) + { + post.UserShort.FullName = userShort.Fullname; + post.UserShort.Id = userShort.Id; + post.UserShort.Image = userShort.Image; + } + post.Image = item.Image; + var topic = await _dataContext.Topics.FirstOrDefaultAsync(x => x.Id == item.TopicId); + post.TopicName = topic?.Title; + + result.Add(post); + } + return new ApiSuccessResult>(result); } } } diff --git a/VNH.Infrastructure/Implement/Catalog/Topics/TopicService.cs b/VNH.Infrastructure/Implement/Catalog/Topics/TopicService.cs index e8b425c..c9920a2 100644 --- a/VNH.Infrastructure/Implement/Catalog/Topics/TopicService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Topics/TopicService.cs @@ -68,6 +68,17 @@ public async Task>> GetAllTopic() return new ApiSuccessResult>(topicResponse); } + public async Task> GetById(string idTopic) + { + var topic = await _dbContext.Topics.FirstOrDefaultAsync(x => x.Id == Guid.Parse(idTopic)); + var result = new TopicReponseDto() + { + Id = topic.Id, + Title = topic.Title + }; + return new ApiSuccessResult(result); + } + public async Task> UpdateTopic(Guid topicId, string topicTitle) { var topic = await _dbContext.Topics.FirstOrDefaultAsync(x => x.Id == topicId); diff --git a/VNH.Infrastructure/Implement/Catalog/Users/UserService.cs b/VNH.Infrastructure/Implement/Catalog/Users/UserService.cs index 6f731fc..d68479b 100644 --- a/VNH.Infrastructure/Implement/Catalog/Users/UserService.cs +++ b/VNH.Infrastructure/Implement/Catalog/Users/UserService.cs @@ -12,6 +12,7 @@ using VNH.Application.Interfaces.Common; using Microsoft.AspNetCore.Http; using VNH.Infrastructure.Implement.Common; +using Microsoft.EntityFrameworkCore; namespace VNH.Infrastructure.Implement.Catalog.Users { @@ -70,13 +71,14 @@ public async Task> Update(UserUpdateDto request) public async Task> GetImage(string email) { - var user = await _userManager.FindByNameAsync(email); + var user = await _dataContext.User.FirstOrDefaultAsync(x=>x.Email.Equals(email)); + if(user is null) return new ApiSuccessResult(string.Empty); return new ApiSuccessResult(user.Image); } - public async Task> SetImageUser(string name, IFormFile image) + public async Task> SetImageUser(string email, IFormFile image) { - var user = await _userManager.FindByNameAsync(name); + var user = await _dataContext.User.FirstOrDefaultAsync(x => x.Email.Equals(email)); if (user.Image != string.Empty) { await _storageService.DeleteFileAsync(user.Image); diff --git a/VNH.Infrastructure/Implement/Common/HandleCommon.cs b/VNH.Infrastructure/Implement/Common/HandleCommon.cs new file mode 100644 index 0000000..f6ec98c --- /dev/null +++ b/VNH.Infrastructure/Implement/Common/HandleCommon.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +namespace VNH.Infrastructure.Implement.Common +{ + public static class HandleCommon + { + public static string RemoveDiacritics(string input) + { + string normalizedString = input.Normalize(NormalizationForm.FormD); + StringBuilder stringBuilder = new StringBuilder(); + + foreach (char c in normalizedString) + { + if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark) + { + stringBuilder.Append(c); + } + } + + return stringBuilder.ToString().Normalize(NormalizationForm.FormC); + } + public static string SanitizeString(string input) + { + string withoutDiacritics = RemoveDiacritics(input).Trim().Replace(" ", "-"); + string sanitizedString = Regex.Replace(withoutDiacritics, "[^a-zA-Z0-9-]", ""); + + return sanitizedString; + } + public static int GenerateRandomNumber() + { + Random random = new Random(); + return random.Next(100, 1000); + } + public static IEnumerable GenerateSearchPhrases(string[] searchKeywords) + { + List searchPhrases = new(); + for (int i = searchKeywords.Length; i >= 1; i--) + { + for (int j = 0; j <= searchKeywords.Length - i; j++) + { + string phrase = string.Join(" ", searchKeywords.Skip(j).Take(i)); + searchPhrases.Add(phrase); + } + } + return searchPhrases; + } + } +} diff --git a/VNH.Infrastructure/Migrations/20231018014102_Init_Database.Designer.cs b/VNH.Infrastructure/Migrations/20231018014102_Init_Database.Designer.cs deleted file mode 100644 index 9a9b97c..0000000 --- a/VNH.Infrastructure/Migrations/20231018014102_Init_Database.Designer.cs +++ /dev/null @@ -1,1773 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231018014102_Init_Database")] - partial class Init_Database - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "1270383a-290a-4c5e-8826-562d998d4fae", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "4ea95e9f-aa5a-4cef-b1e4-01332acf69e2", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "02fde28e-4c7f-4023-821c-c654a4eb0080", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "4c01e053-2305-475a-9e02-72a5d42690fa", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEOw1VikrgkAjKdkOIzWPZF75vuWlYVlt26baQdSJNhrtHU8Kmb5+IUWoIvdjRbiPeQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231018023612_Update_Fk_UserRole.Designer.cs b/VNH.Infrastructure/Migrations/20231018023612_Update_Fk_UserRole.Designer.cs deleted file mode 100644 index c7a9b95..0000000 --- a/VNH.Infrastructure/Migrations/20231018023612_Update_Fk_UserRole.Designer.cs +++ /dev/null @@ -1,1773 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231018023612_Update_Fk_UserRole")] - partial class Update_Fk_UserRole - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "dfd7b1af-c20d-44a7-bec4-35dffd9ffa71", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "13c5c2b0-b161-4609-b855-2d59bd827c12", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "d96e32a9-9a47-401f-b582-ca0ed6787615", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "a0234eb9-f81e-4936-903e-ac2488a2cde6", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEAnALxO8DpC3lTevQ6OIE/b9T/ebBU9SWduNAPcet2wJYq7LOBBuIQsS5ve2hNVqzg==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231018023612_Update_Fk_UserRole.cs b/VNH.Infrastructure/Migrations/20231018023612_Update_Fk_UserRole.cs deleted file mode 100644 index 91dbaf5..0000000 --- a/VNH.Infrastructure/Migrations/20231018023612_Update_Fk_UserRole.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Update_Fk_UserRole : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddForeignKey( - name: "FK_AppUserRoles_AspNetUsers_UserId", - table: "UserRoles", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231018032201_Update_Fk_Q_A.Designer.cs b/VNH.Infrastructure/Migrations/20231018032201_Update_Fk_Q_A.Designer.cs deleted file mode 100644 index 93f3a0c..0000000 --- a/VNH.Infrastructure/Migrations/20231018032201_Update_Fk_Q_A.Designer.cs +++ /dev/null @@ -1,1789 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231018032201_Update_Fk_Q_A")] - partial class Update_Fk_Q_A - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "2c3d1d52-774b-4e85-9266-910749dc241c", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "b41c57ae-5ca0-4577-b13b-3a279a50ff66", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "d1ed4026-d502-4de6-b035-87d8950b6c5f", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "d1c93819-11ce-4df6-acef-1ae093f8f8bd", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEHgsneHS+BII5ynrJKBeKxsnj2qbWbjfP11usvXR3H6cfqOAk1JECHOoB6lSZNGiDQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231018032201_Update_Fk_Q_A.cs b/VNH.Infrastructure/Migrations/20231018032201_Update_Fk_Q_A.cs deleted file mode 100644 index 0d852c5..0000000 --- a/VNH.Infrastructure/Migrations/20231018032201_Update_Fk_Q_A.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Update_Fk_Q_A : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "QuestionId", - table: "Answer", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - - migrationBuilder.CreateIndex( - name: "IX_Answer_QuestionId", - table: "Answer", - column: "QuestionId"); - - migrationBuilder.AddForeignKey( - name: "FK__Answer__QuestionId__1AD3FVA4", - table: "Answer", - column: "QuestionId", - principalTable: "Question", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__Answer__QuestionId__1AD3FVA4", - table: "Answer"); - - migrationBuilder.DropIndex( - name: "IX_Answer_QuestionId", - table: "Answer"); - - migrationBuilder.DropColumn( - name: "QuestionId", - table: "Answer"); - - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231020032001_Add_content_report.Designer.cs b/VNH.Infrastructure/Migrations/20231020032001_Add_content_report.Designer.cs deleted file mode 100644 index 65d0431..0000000 --- a/VNH.Infrastructure/Migrations/20231020032001_Add_content_report.Designer.cs +++ /dev/null @@ -1,1840 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231020032001_Add_content_report")] - partial class Add_content_report - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("9cc193cd-87ae-4461-a708-5812ecdc419a"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4363), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("91c52180-68bf-40cc-b9d4-451e9d7cafd8"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4380), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("1238884a-e607-4404-b75e-857b505e743e"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4384), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("77051145-b23f-4dff-a085-558cef7fb308"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4395), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("7a8ea6de-a8ad-46e7-87a8-320ef172c92a"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4398), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("f34f82ed-9f42-46cd-b8af-556d355ead56"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4400), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("af65cb27-c071-4a40-9eb3-229f3c6a31c0"), - CreatedAt = new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4403), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "1d585cd1-5a94-4d6f-91dc-5fbb2f87ca27", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "f6fc687f-91b6-4669-9864-7c2334138f2c", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "4c2db2a5-6346-48ed-abe9-557445024d5d", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "5a8d35f4-3d57-4b6b-a110-7e1e2dfd1c28", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEC4LVLxeuToaRsRzOdS1JZ9qPI3fFEyKHfBN1GilqAQip2H3VBARICtrifyztvOfNA==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231020032001_Add_content_report.cs b/VNH.Infrastructure/Migrations/20231020032001_Add_content_report.cs deleted file mode 100644 index b8f02dd..0000000 --- a/VNH.Infrastructure/Migrations/20231020032001_Add_content_report.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Add_content_report : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.InsertData( - table: "Report", - columns: new[] { "Id", "CreatedAt", "Description", "Title" }, - values: new object[,] - { - { new Guid("1238884a-e607-4404-b75e-857b505e743e"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4384), "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", "Chứa nội dung bạo lực hoặc đội nhóm xấu" }, - { new Guid("77051145-b23f-4dff-a085-558cef7fb308"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4395), "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", "Chứa nội dung tự tử hoặc tự gây thương tổn" }, - { new Guid("7a8ea6de-a8ad-46e7-87a8-320ef172c92a"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4398), "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" }, - { new Guid("91c52180-68bf-40cc-b9d4-451e9d7cafd8"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4380), "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", "Nội dung xấu, xúc phạm, hay kỳ thị" }, - { new Guid("9cc193cd-87ae-4461-a708-5812ecdc419a"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4363), " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", "Nội dung vi phạm quy định về quyền riêng tư" }, - { new Guid("af65cb27-c071-4a40-9eb3-229f3c6a31c0"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4403), "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" }, - { new Guid("f34f82ed-9f42-46cd-b8af-556d355ead56"), new DateTime(2023, 10, 20, 10, 20, 0, 417, DateTimeKind.Local).AddTicks(4400), "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", "Bài đăng chứa thông tin sai lệch hoặc giả mạo" } - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231020073854_Add_Report_Date_For_ReportDetail.Designer.cs b/VNH.Infrastructure/Migrations/20231020073854_Add_Report_Date_For_ReportDetail.Designer.cs deleted file mode 100644 index 48d7c41..0000000 --- a/VNH.Infrastructure/Migrations/20231020073854_Add_Report_Date_For_ReportDetail.Designer.cs +++ /dev/null @@ -1,1754 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231020073854_Add_Report_Date_For_ReportDetail")] - partial class Add_Report_Date_For_ReportDetail - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231020073854_Add_Report_Date_For_ReportDetail.cs b/VNH.Infrastructure/Migrations/20231020073854_Add_Report_Date_For_ReportDetail.cs deleted file mode 100644 index d3e4933..0000000 --- a/VNH.Infrastructure/Migrations/20231020073854_Add_Report_Date_For_ReportDetail.cs +++ /dev/null @@ -1,250 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Add_Report_Date_For_ReportDetail : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__PostRepor__Repor__151B244E", - table: "PostReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__PostRepor__UserI__160F4887", - table: "PostReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__QuestionR__Quest__2180FB33", - table: "QuestionReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__QuestionR__Quest__22751F6C", - table: "QuestionReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__QuestionR__UserI__236943A5", - table: "QuestionReportDetail"); - - - migrationBuilder.AlterColumn( - name: "UserId", - table: "QuestionReportDetail", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ReportId", - table: "QuestionReportDetail", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "QuestionId", - table: "QuestionReportDetail", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "ReportDate", - table: "QuestionReportDetail", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "PostReportDetail", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "ReportId", - table: "PostReportDetail", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "ReportDate", - table: "PostReportDetail", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddForeignKey( - name: "FK__PostRepor__Repor__151B244E", - table: "PostReportDetail", - column: "ReportId", - principalTable: "Report", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK__PostRepor__UserI__160F4887", - table: "PostReportDetail", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionR__Quest__2180FB33", - table: "QuestionReportDetail", - column: "QuestionId", - principalTable: "Question", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionR__Quest__22751F6C", - table: "QuestionReportDetail", - column: "ReportId", - principalTable: "Report", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionR__UserI__236943A5", - table: "QuestionReportDetail", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__PostRepor__Repor__151B244E", - table: "PostReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__PostRepor__UserI__160F4887", - table: "PostReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__QuestionR__Quest__2180FB33", - table: "QuestionReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__QuestionR__Quest__22751F6C", - table: "QuestionReportDetail"); - - migrationBuilder.DropForeignKey( - name: "FK__QuestionR__UserI__236943A5", - table: "QuestionReportDetail"); - - migrationBuilder.DropColumn( - name: "ReportDate", - table: "QuestionReportDetail"); - - migrationBuilder.DropColumn( - name: "ReportDate", - table: "PostReportDetail"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "QuestionReportDetail", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AlterColumn( - name: "ReportId", - table: "QuestionReportDetail", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AlterColumn( - name: "QuestionId", - table: "QuestionReportDetail", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "PostReportDetail", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AlterColumn( - name: "ReportId", - table: "PostReportDetail", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - - migrationBuilder.AddForeignKey( - name: "FK__PostRepor__Repor__151B244E", - table: "PostReportDetail", - column: "ReportId", - principalTable: "Report", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK__PostRepor__UserI__160F4887", - table: "PostReportDetail", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionR__Quest__2180FB33", - table: "QuestionReportDetail", - column: "QuestionId", - principalTable: "Question", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionR__Quest__22751F6C", - table: "QuestionReportDetail", - column: "ReportId", - principalTable: "Report", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionR__UserI__236943A5", - table: "QuestionReportDetail", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id"); - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231020080714_Add_Checked_For_ReportDetail.Designer.cs b/VNH.Infrastructure/Migrations/20231020080714_Add_Checked_For_ReportDetail.Designer.cs deleted file mode 100644 index 3fb783d..0000000 --- a/VNH.Infrastructure/Migrations/20231020080714_Add_Checked_For_ReportDetail.Designer.cs +++ /dev/null @@ -1,1862 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231020080714_Add_Checked_For_ReportDetail")] - partial class Add_Checked_For_ReportDetail - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8233), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8251), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8253), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8255), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8258), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8259), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8262), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "8f306177-bd4a-4f3d-812f-774927febc0a", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "ef4bd6d1-c7b9-4013-93ec-2614e3d532a4", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "cdd07513-a753-4446-bb2e-fdf342432274", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "311ace0d-cd72-4127-9f17-ae26c351e8c3", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEDUOWq3UqyNeXmAlz5MOnvKn0UfK+m9H7SYBn0R02ctctjwJsE941TRCPRhvLl8i1A==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231020080714_Add_Checked_For_ReportDetail.cs b/VNH.Infrastructure/Migrations/20231020080714_Add_Checked_For_ReportDetail.cs deleted file mode 100644 index fa89f39..0000000 --- a/VNH.Infrastructure/Migrations/20231020080714_Add_Checked_For_ReportDetail.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Add_Checked_For_ReportDetail : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Checked", - table: "QuestionReportDetail", - type: "bit", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "Checked", - table: "PostReportDetail", - type: "bit", - nullable: false, - defaultValue: false); - - migrationBuilder.InsertData( - table: "Report", - columns: new[] { "Id", "CreatedAt", "Description", "Title" }, - values: new object[,] - { - { new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8251), "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", "Nội dung xấu, xúc phạm, hay kỳ thị" }, - { new Guid("3043c693-b3c9-453e-9876-31c943222576"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8262), "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" }, - { new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8255), "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", "Chứa nội dung tự tử hoặc tự gây thương tổn" }, - { new Guid("4a780087-9058-41c9-b84b-944d1a502010"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8259), "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", "Bài đăng chứa thông tin sai lệch hoặc giả mạo" }, - { new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8253), "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", "Chứa nội dung bạo lực hoặc đội nhóm xấu" }, - { new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8258), "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" }, - { new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), new DateTime(2023, 10, 20, 15, 7, 14, 489, DateTimeKind.Local).AddTicks(8233), " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", "Nội dung vi phạm quy định về quyền riêng tư" } - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e")); - - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("3043c693-b3c9-453e-9876-31c943222576")); - - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("349ed807-6107-436f-9a4c-9d6183fbc444")); - - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("4a780087-9058-41c9-b84b-944d1a502010")); - - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("bab1da58-6921-44b9-837f-c58d3998497b")); - - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347")); - - migrationBuilder.DeleteData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("d30e1353-0163-43c1-b757-7957981b0eda")); - - migrationBuilder.DeleteData( - table: "Roles", - keyColumn: "Id", - keyValue: new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604")); - - migrationBuilder.DeleteData( - table: "Roles", - keyColumn: "Id", - keyValue: new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575")); - - migrationBuilder.DeleteData( - table: "Roles", - keyColumn: "Id", - keyValue: new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a")); - - migrationBuilder.DeleteData( - table: "UserShort", - keyColumn: "Id", - keyValue: new Guid("d1f771da-b318-42f8-a003-5a15614216f5")); - - migrationBuilder.DeleteData( - table: "UserRoles", - keyColumns: new[] { "RoleId", "UserId" }, - keyValues: new object[] { new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), new Guid("d1f771da-b318-42f8-a003-5a15614216f5") }); - - migrationBuilder.DropColumn( - name: "Checked", - table: "QuestionReportDetail"); - - migrationBuilder.DropColumn( - name: "Checked", - table: "PostReportDetail"); - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231030155718_Add_column_Desciption_For_User.Designer.cs b/VNH.Infrastructure/Migrations/20231030155718_Add_column_Desciption_For_User.Designer.cs deleted file mode 100644 index 1b3ac19..0000000 --- a/VNH.Infrastructure/Migrations/20231030155718_Add_column_Desciption_For_User.Designer.cs +++ /dev/null @@ -1,1865 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231030155718_Add_column_Desciption_For_User")] - partial class Add_column_Desciption_For_User - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UrlImage") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("varbinary(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6204), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6217), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6220), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6223), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6226), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6227), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6229), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "53d56036-6dad-4af5-bc07-50c37802f581", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "8415b1f8-a403-4e5c-8f51-6b26c9d5e831", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "072f5603-571d-4abd-aac3-9f1a63bebbf5", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("varbinary(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "a724fd15-f4c5-41b9-b5ea-cc6830547381", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEMNM6h+03V7gLq621F97RFvghVMLEWUnOTU/6iUH5VpKYhA06DtBrRLe1zh5RQeIbA==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231030155718_Add_column_Desciption_For_User.cs b/VNH.Infrastructure/Migrations/20231030155718_Add_column_Desciption_For_User.cs deleted file mode 100644 index 4eb6d2b..0000000 --- a/VNH.Infrastructure/Migrations/20231030155718_Add_column_Desciption_For_User.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Add_column_Desciption_For_User : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Introduction", - table: "UserShort", - type: "nvarchar(max)", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Introduction", - table: "UserShort"); - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231109154951_Update_Image_Attribute.Designer.cs b/VNH.Infrastructure/Migrations/20231109154951_Update_Image_Attribute.Designer.cs deleted file mode 100644 index 1218cca..0000000 --- a/VNH.Infrastructure/Migrations/20231109154951_Update_Image_Attribute.Designer.cs +++ /dev/null @@ -1,1869 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231109154951_Update_Image_Attribute")] - partial class Update_Image_Attribute - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5927), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5947), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5949), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5953), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5956), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5959), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5961), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "157e4a93-81f2-48c6-a1a9-511f70d19c99", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "55fcc52e-27d5-4665-8967-13fe97e02ebe", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "a0e89f69-ee8c-4a09-be4d-4a9857fbc8d3", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "16823ad9-fa17-4b28-a964-b367dc4ff5e4", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEKBatixPeSdVUG7X4YQBbyiJZRsH7gYPsSCSoDGJUBmJtWNmm9381o9NNa6J4kJndQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231109154951_Update_Image_Attribute.cs b/VNH.Infrastructure/Migrations/20231109154951_Update_Image_Attribute.cs deleted file mode 100644 index 5013e82..0000000 --- a/VNH.Infrastructure/Migrations/20231109154951_Update_Image_Attribute.cs +++ /dev/null @@ -1,201 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Update_Image_Attribute : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "UrlImage", - table: "Document", - newName: "Image"); - - migrationBuilder.AlterColumn( - name: "Image", - table: "UserShort", - type: "varchar(max)", - maxLength: 3145728, - nullable: true, - oldClrType: typeof(byte[]), - oldType: "varbinary(max)", - oldMaxLength: 3145728, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Image", - table: "Post", - type: "varchar(max)", - nullable: true, - oldClrType: typeof(byte[]), - oldType: "varbinary(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "Document", - type: "nvarchar(500)", - maxLength: 500, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(255)", - oldMaxLength: 255, - oldNullable: true); - - migrationBuilder.AddColumn( - name: "Image", - table: "Course", - type: "varchar(max)", - nullable: true); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5947)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("3043c693-b3c9-453e-9876-31c943222576"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5961)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5953)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5959)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5949)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5956)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - column: "CreatedAt", - value: new DateTime(2023, 11, 9, 22, 49, 50, 982, DateTimeKind.Local).AddTicks(5927)); - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Image", - table: "Course"); - - migrationBuilder.RenameColumn( - name: "Image", - table: "Document", - newName: "UrlImage"); - - migrationBuilder.AlterColumn( - name: "Image", - table: "UserShort", - type: "varbinary(max)", - maxLength: 3145728, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldMaxLength: 3145728, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Image", - table: "Post", - type: "varbinary(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Description", - table: "Document", - type: "nvarchar(255)", - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(500)", - oldMaxLength: 500, - oldNullable: true); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6217)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("3043c693-b3c9-453e-9876-31c943222576"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6229)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6223)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6227)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6220)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6226)); - - migrationBuilder.UpdateData( - table: "Report", - keyColumn: "Id", - keyValue: new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - column: "CreatedAt", - value: new DateTime(2023, 10, 30, 22, 57, 18, 543, DateTimeKind.Local).AddTicks(6204)); - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231115135948_Add_SubId_For_Post.Designer.cs b/VNH.Infrastructure/Migrations/20231115135948_Add_SubId_For_Post.Designer.cs deleted file mode 100644 index 5ae9d50..0000000 --- a/VNH.Infrastructure/Migrations/20231115135948_Add_SubId_For_Post.Designer.cs +++ /dev/null @@ -1,1874 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231115135948_Add_SubId_For_Post")] - partial class Add_SubId_For_Post - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4498), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4512), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4514), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4517), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4519), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4521), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 15, 20, 59, 47, 967, DateTimeKind.Local).AddTicks(4523), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "c049643c-c9b8-41d0-8395-d3a6663aa08c", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "42822a68-ed12-4cf6-bcc2-89669626ce1f", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "3c7eb7aa-d2ef-4743-b3c5-5f4033a49e32", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "e4db3b3b-2a30-41be-9af7-9376685bcb91", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEB0zhlwScfiTBuzJqqT3p3s7NJWVsU53x9K+0sUJFhZjzP3yeXNagsvqaA/7vIvKiA==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231115135948_Add_SubId_For_Post.cs b/VNH.Infrastructure/Migrations/20231115135948_Add_SubId_For_Post.cs deleted file mode 100644 index d8724f1..0000000 --- a/VNH.Infrastructure/Migrations/20231115135948_Add_SubId_For_Post.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Add_SubId_For_Post : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__Post__UserId__778AC167", - table: "Post"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "Post", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), - oldClrType: typeof(Guid), - oldType: "uniqueidentifier", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Title", - table: "Post", - type: "nvarchar(255)", - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(255)", - oldMaxLength: 255); - - migrationBuilder.AddColumn( - name: "SubId", - table: "Post", - type: "varchar(300)", - maxLength: 300, - nullable: true); - - - migrationBuilder.AddForeignKey( - name: "FK__Post__UserId__778AC167", - table: "Post", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__Post__UserId__778AC167", - table: "Post"); - - migrationBuilder.DropColumn( - name: "SubId", - table: "Post"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "Post", - type: "uniqueidentifier", - nullable: true, - oldClrType: typeof(Guid), - oldType: "uniqueidentifier"); - - migrationBuilder.AlterColumn( - name: "Title", - table: "Post", - type: "nvarchar(255)", - maxLength: 255, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(255)", - oldMaxLength: 255, - oldNullable: true); - - - migrationBuilder.AddForeignKey( - name: "FK__Post__UserId__778AC167", - table: "Post", - column: "UserId", - principalTable: "UserShort", - principalColumn: "Id"); - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231116162352_document create.Designer.cs b/VNH.Infrastructure/Migrations/20231116162352_document create.Designer.cs deleted file mode 100644 index 6353d74..0000000 --- a/VNH.Infrastructure/Migrations/20231116162352_document create.Designer.cs +++ /dev/null @@ -1,1867 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231116162352_document create")] - partial class documentcreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("varbinary(max)"); - - b.Property("ContentType") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4154), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4164), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4167), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4169), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4173), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4175), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 16, 23, 23, 51, 917, DateTimeKind.Local).AddTicks(4176), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "a7761124-c49c-4938-966b-9c2fdbaa11b8", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "e83ff527-39a8-46fa-a01e-3064a6f3daf6", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "f8c65095-8569-45aa-8673-93fa4635701e", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "d93ca1cb-4367-4dc4-a399-9749e502cb02", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEDg9jA9joNhSW0bDPeNk70fvxUVtfQsuFSeT7T9xQ6QJSSXmh+0a1+36CPBEcSdoeg==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231116162352_document create.cs b/VNH.Infrastructure/Migrations/20231116162352_document create.cs deleted file mode 100644 index 1d947ad..0000000 --- a/VNH.Infrastructure/Migrations/20231116162352_document create.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class documentcreate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Image", - table: "Document"); - - -/* - migrationBuilder.AlterColumn( - name: "FileName", - table: "Document", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "varchar(255)", - oldUnicode: false, - oldMaxLength: 255, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "Document", - type: "datetime", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "datetime", - oldNullable: true); - - - - */ - - - - - - - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - - /* migrationBuilder.AlterColumn( - name: "FileName", - table: "Document", - type: "varchar(255)", - unicode: false, - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "CreatedAt", - table: "Document", - type: "datetime", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "datetime");*/ - - /* migrationBuilder.AddColumn( - name: "Image", - table: "Document", - type: "varchar(255)", - unicode: false, - maxLength: 255, - nullable: true);*/ - - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231118131741_Update_Docs_Table.Designer.cs b/VNH.Infrastructure/Migrations/20231118131741_Update_Docs_Table.Designer.cs deleted file mode 100644 index fc99d1e..0000000 --- a/VNH.Infrastructure/Migrations/20231118131741_Update_Docs_Table.Designer.cs +++ /dev/null @@ -1,1864 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231118131741_Update_Docs_Table")] - partial class Update_Docs_Table - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1571), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1586), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1588), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1590), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1592), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1594), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 18, 20, 17, 41, 588, DateTimeKind.Local).AddTicks(1596), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "680bc398-aef8-439a-b268-b7f73588b94c", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "ccfce868-876f-4240-abd0-3a0c4893eeb7", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "51bf1f0f-5f05-473f-a48b-b102f8f06272", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("UserShort"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "f1c303ad-8432-4bb0-be7a-43d59b2c6dab", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEGRCels5gTIO3nU1TVxHwe0txuW6KfZFFUojWI8PuPulbQk5JmdHXTmg6aLYNm8WMQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.UserShort", "UserShort") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("UserShort"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.UserShort", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.UserShort", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231118131741_Update_Docs_Table.cs b/VNH.Infrastructure/Migrations/20231118131741_Update_Docs_Table.cs deleted file mode 100644 index 526a92f..0000000 --- a/VNH.Infrastructure/Migrations/20231118131741_Update_Docs_Table.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class Update_Docs_Table : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Content", - table: "Document"); - - migrationBuilder.DropColumn( - name: "ContentType", - table: "Document"); - - migrationBuilder.AddColumn( - name: "SubId", - table: "Document", - type: "varchar(500)", - nullable: true); - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "SubId", - table: "Document"); - - migrationBuilder.AddColumn( - name: "Content", - table: "Document", - type: "varbinary(max)", - nullable: true); - - migrationBuilder.AddColumn( - name: "ContentType", - table: "Document", - type: "varchar(255)", - unicode: false, - maxLength: 255, - nullable: true); - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231120064521_update question table.Designer.cs b/VNH.Infrastructure/Migrations/20231120064521_update question table.Designer.cs deleted file mode 100644 index 2339f4a..0000000 --- a/VNH.Infrastructure/Migrations/20231120064521_update question table.Designer.cs +++ /dev/null @@ -1,1867 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231120064521_update question table")] - partial class updatequestiontable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreateAt") - .HasColumnType("datetime"); - - b.Property("QuestionTagId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UpdateAt") - .HasColumnType("datetime"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9106), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9119), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9128), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9130), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9132), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9134), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 20, 13, 45, 21, 422, DateTimeKind.Local).AddTicks(9136), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "96d770d8-a4ff-4dee-b4bd-04ca001bd966", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "cb600f97-e6e5-4637-bf30-2ebbd58b1b1f", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "2836b3ed-85bd-41f9-be79-b119bf758116", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("User"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "1f080d53-1ba8-40e4-933e-beec13bccc47", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEHTZdl4u/ySPUE8WUW2tg/Obhugs4eMLtK2evXlyfWMpo6GT+LxC4Nrq2dDO5kTBag==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231120064521_update question table.cs b/VNH.Infrastructure/Migrations/20231120064521_update question table.cs deleted file mode 100644 index 81acba4..0000000 --- a/VNH.Infrastructure/Migrations/20231120064521_update question table.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class updatequestiontable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "PubDate", - table: "Question", - newName: "UpdateAt"); - - migrationBuilder.AddColumn( - name: "CreateAt", - table: "Question", - type: "datetime", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CreateAt", - table: "Question"); - - migrationBuilder.RenameColumn( - name: "UpdateAt", - table: "Question", - newName: "PubDate"); - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231120075940_update questiontag table.Designer.cs b/VNH.Infrastructure/Migrations/20231120075940_update questiontag table.Designer.cs deleted file mode 100644 index 856381f..0000000 --- a/VNH.Infrastructure/Migrations/20231120075940_update questiontag table.Designer.cs +++ /dev/null @@ -1,1867 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231120075940_update questiontag table")] - partial class updatequestiontagtable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.13") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreateAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UpdateAt") - .HasColumnType("datetime"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7611), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7626), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7628), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7630), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7633), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7635), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 20, 14, 59, 40, 9, DateTimeKind.Local).AddTicks(7638), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "3c8c3656-a093-436a-b933-f03b9d81e9cf", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "b20d6ee0-be88-4692-8caf-972dadeae732", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "0243427d-0e22-44e5-9b3b-9ad4a0a1af2d", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("User"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "97810ee5-1e9f-4e90-ab40-879967fc7712", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEIWL/TKj5ZHCyE4ZZl2ZXw+wZLwOQGc+y6AfMEtWMXlAeLUgpiUkcvSPhbOZfxa6NA==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "IdNavigation") - .WithOne("QuestionTag") - .HasForeignKey("VNH.Domain.QuestionTag", "Id") - .IsRequired() - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("IdNavigation"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231120075940_update questiontag table.cs b/VNH.Infrastructure/Migrations/20231120075940_update questiontag table.cs deleted file mode 100644 index ecdd468..0000000 --- a/VNH.Infrastructure/Migrations/20231120075940_update questiontag table.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class updatequestiontagtable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "QuestionTagId", - table: "Question"); - - migrationBuilder.AddColumn( - name: "QuestionId", - table: "QuestionTag", - type: "uniqueidentifier", - nullable: true); - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "QuestionId", - table: "QuestionTag"); - - migrationBuilder.AddColumn( - name: "QuestionTagId", - table: "Question", - type: "uniqueidentifier", - nullable: true); - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231120083158_update questiontag table 2.Designer.cs b/VNH.Infrastructure/Migrations/20231120083158_update questiontag table 2.Designer.cs deleted file mode 100644 index 6816e85..0000000 --- a/VNH.Infrastructure/Migrations/20231120083158_update questiontag table 2.Designer.cs +++ /dev/null @@ -1,1868 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231120083158_update questiontag table 2")] - partial class updatequestiontagtable2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.13") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreateAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UpdateAt") - .HasColumnType("datetime"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(8992), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(9008), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(9012), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(9014), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(9015), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(9019), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 20, 15, 31, 58, 283, DateTimeKind.Local).AddTicks(9022), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "aa8e1650-179c-4a94-9cbb-0cab7bc4de2f", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "2451c9c3-67fd-460d-bb03-41e8c983c567", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "8e52473d-a973-4bfd-a56d-5619b283c03c", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("User"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "ef9d9f06-80d5-4d94-94c0-11d815bfb947", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEG7Ij74W/Ytocnd8C5Edhh18X+HmKbQGkGt4aUoOlSEWSn/QAeYyKZO+QjjVFhkLeA==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionTag") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("Question"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231120083158_update questiontag table 2.cs b/VNH.Infrastructure/Migrations/20231120083158_update questiontag table 2.cs deleted file mode 100644 index 266fb2c..0000000 --- a/VNH.Infrastructure/Migrations/20231120083158_update questiontag table 2.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class updatequestiontagtable2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__QuestionTag__Id__2739D489", - table: "QuestionTag"); - - - migrationBuilder.CreateIndex( - name: "IX_QuestionTag_QuestionId", - table: "QuestionTag", - column: "QuestionId"); - - migrationBuilder.AddForeignKey( - name: "FK__QuestionTag__Id__2739D489", - table: "QuestionTag", - column: "QuestionId", - principalTable: "Question", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK__QuestionTag__Id__2739D489", - table: "QuestionTag"); - - migrationBuilder.DropIndex( - name: "IX_QuestionTag_QuestionId", - table: "QuestionTag"); - - - migrationBuilder.AddForeignKey( - name: "FK__QuestionTag__Id__2739D489", - table: "QuestionTag", - column: "Id", - principalTable: "Question", - principalColumn: "Id"); - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231121014823_add column UpdateAt for table Answer.Designer.cs b/VNH.Infrastructure/Migrations/20231121014823_add column UpdateAt for table Answer.Designer.cs deleted file mode 100644 index ae8318a..0000000 --- a/VNH.Infrastructure/Migrations/20231121014823_add column UpdateAt for table Answer.Designer.cs +++ /dev/null @@ -1,1871 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VNH.Infrastructure.Presenters.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231121014823_add column UpdateAt for table Answer")] - partial class addcolumnUpdateAtfortableAnswer - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.13") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("AppRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("UserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - - b.HasData( - new - { - UserId = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - RoleId = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575") - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId"); - - b.ToTable("AppUserTokens", (string)null); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Confirm") - .HasColumnType("bit"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("MostConfirm") - .HasColumnType("bit"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdateAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("QuestionId"); - - b.ToTable("Answer"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AnswerId"); - - b.HasIndex("UserId"); - - b.ToTable("AnswerVote"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseName") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Course"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseComment"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Score") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseRating"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSave"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("CourseSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("FileName") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasColumnType("nvarchar(max)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Document"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("DocumentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DocumentId"); - - b.HasIndex("UserId"); - - b.ToTable("DocumentSave"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Title") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Notification"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("IsRead") - .HasColumnType("int"); - - b.Property("NotificationId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PostId") - .IsRequired() - .HasColumnType("nvarchar(255)"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TagId"); - - b.ToTable("PostTags"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("QuizId") - .HasColumnType("uniqueidentifier"); - - b.Property("Time") - .HasColumnType("time"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.ToTable("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("TestMark") - .HasColumnType("float"); - - b.Property("TestTime") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ExerciseId"); - - b.HasIndex("UserId"); - - b.ToTable("ExerciseDetail"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CourseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ExerciseId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UrlVideo") - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("Lesson"); - }); - - modelBuilder.Entity("VNH.Domain.News", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Url") - .IsRequired() - .HasMaxLength(255) - .IsUnicode(false) - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.ToTable("News"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Property("Id") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Image") - .HasColumnType("nvarchar(max)"); - - b.Property("SubId") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserId"); - - b.ToTable("Post"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostComment"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostLike"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("PostReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSave"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("PreCommentId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PreCommentId"); - - b.HasIndex("UserId"); - - b.ToTable("PostSubComment"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("CreateAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UpdateAt") - .HasColumnType("datetime"); - - b.Property("ViewNumber") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Question"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionLike"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Checked") - .HasColumnType("bit"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ReportDate") - .HasColumnType("datetime2"); - - b.Property("ReportId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("ReportId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionReportDetail"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("UserId"); - - b.ToTable("QuestionSave"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("QuestionId") - .HasColumnType("uniqueidentifier"); - - b.Property("TagId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("QuestionId"); - - b.HasIndex("TagId"); - - b.ToTable("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Answer1") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer2") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer3") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Answer4") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Question") - .HasColumnType("nvarchar(max)"); - - b.Property("RightAnswer") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.HasKey("Id"); - - b.ToTable("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Report"); - - b.HasData( - new - { - Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6220), - Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", - Title = "Nội dung vi phạm quy định về quyền riêng tư" - }, - new - { - Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6265), - Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", - Title = "Nội dung xấu, xúc phạm, hay kỳ thị" - }, - new - { - Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6271), - Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", - Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" - }, - new - { - Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6276), - Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", - Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" - }, - new - { - Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6287), - Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", - Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" - }, - new - { - Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6293), - Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", - Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" - }, - new - { - Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 21, 8, 48, 23, 480, DateTimeKind.Local).AddTicks(6299), - Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", - Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" - }); - }); - - modelBuilder.Entity("VNH.Domain.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "7b0fac8e-d69b-42f0-9297-ae69d464541c", - Name = "admin", - NormalizedName = "admin" - }, - new - { - Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "77204fec-1ade-4423-87aa-24ca8fcab8ad", - Name = "teacher", - NormalizedName = "teacher" - }, - new - { - Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "6e610eda-543a-490d-a3a7-55725384a36e", - Name = "student", - NormalizedName = "student" - }); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Search"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasColumnType("nvarchar(max)"); - - b.Property("PreAnswerId") - .HasColumnType("uniqueidentifier"); - - b.Property("PubDate") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.HasIndex("PreAnswerId"); - - b.ToTable("SubAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.HasKey("Id"); - - b.ToTable("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AuthorId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("UpdatedAt") - .HasColumnType("datetime"); - - b.HasKey("Id"); - - b.HasIndex("AuthorId"); - - b.ToTable("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("PostId") - .HasColumnType("nvarchar(255)"); - - b.Property("TopicId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("PostId"); - - b.HasIndex("TopicId"); - - b.ToTable("TopicDetail"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("DateOfBirth") - .HasColumnType("datetime"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Fullname") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Gender") - .HasColumnType("int"); - - b.Property("Image") - .HasMaxLength(3145728) - .HasColumnType("nvarchar(max)"); - - b.Property("Introduction") - .HasColumnType("nvarchar(max)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("NumberConfirm") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("User"); - - b.HasData( - new - { - Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), - AccessFailedCount = 0, - ConcurrencyStamp = "501e73f3-8ee6-4fd4-8b04-46c28c2ce1d2", - DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), - Email = "admin@gmail.com", - EmailConfirmed = true, - Fullname = "Lương Xuân Nhất", - Gender = 0, - Image = "", - LockoutEnabled = false, - NormalizedEmail = "onionwebdev@gmail.com", - NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAENICOb0t0UqlZQ2EC4KFMuRVhESBv/2Xzz197VB/tnt7ZD4+kfsoLTshwe+n+mVrMg==", - PhoneNumberConfirmed = false, - SecurityStamp = "", - TwoFactorEnabled = false, - UserName = "admin" - }); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Answers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); - - b.HasOne("VNH.Domain.Question", "Questions") - .WithMany("Answers") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Answer__QuestionId__1AD3FVA4"); - - b.Navigation("Author"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("VNH.Domain.AnswerVote", b => - { - b.HasOne("VNH.Domain.Answer", "Answer") - .WithMany("AnswerVotes") - .HasForeignKey("AnswerId") - .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("AnswerVotes") - .HasForeignKey("UserId") - .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); - - b.Navigation("Answer"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Courses") - .HasForeignKey("UserId") - .HasConstraintName("FK__Course__UserId__787EE5A0"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseComments") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseCom__UserI__797309D9"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseRating", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseRatings") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseRatings") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSave", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("CourseSaves") - .HasForeignKey("CourseId") - .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSav__UserI__03F0984C"); - - b.Navigation("Course"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.CourseSubComment", b => - { - b.HasOne("VNH.Domain.CourseComment", "PreComment") - .WithMany("CourseSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("CourseSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Documents") - .HasForeignKey("UserId") - .HasConstraintName("FK__Document__UserId__0A9D95DB"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.DocumentSave", b => - { - b.HasOne("VNH.Domain.Document", "Document") - .WithMany("DocumentSaves") - .HasForeignKey("DocumentId") - .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("DocumentSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); - - b.Navigation("Document"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => - { - b.HasOne("VNH.Domain.Entities.Notification", "Notification") - .WithMany("NotificationDetails") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("NotificationDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__NotificationDetail__UserId__1EA48E88"); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostTags") - .HasForeignKey("PostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("PostTags") - .HasForeignKey("TagId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Post"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.HasOne("VNH.Domain.Lesson", "IdNavigation") - .WithOne("Exercise") - .HasForeignKey("VNH.Domain.Exercise", "Id") - .IsRequired() - .HasConstraintName("FK__Exercise__Id__282DF8C2"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.ExerciseDetail", b => - { - b.HasOne("VNH.Domain.Exercise", "Exercise") - .WithMany("ExerciseDetails") - .HasForeignKey("ExerciseId") - .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("ExerciseDetails") - .HasForeignKey("UserId") - .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); - - b.Navigation("Exercise"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.HasOne("VNH.Domain.Course", "Course") - .WithMany("Lessons") - .HasForeignKey("CourseId") - .HasConstraintName("FK__Lesson__CourseId__7F2BE32F"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("Posts") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__TopicId__76969D2E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("Posts") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__Post__UserId__778AC167"); - - b.Navigation("Topic"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostComments") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostComme__UserI__10566F31"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostLike", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostLikes") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostLike__UserId__14270015"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostReportDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostReportDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostRepor__PostI__17036CC0"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("PostReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__Repor__151B244E"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__PostRepor__UserI__160F4887"); - - b.Navigation("Post"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSave", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("PostSaves") - .HasForeignKey("PostId") - .HasConstraintName("FK__PostSave__PostId__08B54D69"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSave__UserId__09A971A2"); - - b.Navigation("Post"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.PostSubComment", b => - { - b.HasOne("VNH.Domain.PostComment", "PreComment") - .WithMany("PostSubComments") - .HasForeignKey("PreCommentId") - .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("PostSubComments") - .HasForeignKey("UserId") - .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); - - b.Navigation("PreComment"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Questions") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Question__Author__18EBB532"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionLike", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionLikes") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionLikes") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionReportDetails") - .HasForeignKey("QuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__2180FB33"); - - b.HasOne("VNH.Domain.Report", "Report") - .WithMany("QuestionReportDetails") - .HasForeignKey("ReportId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionReportDetails") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() - .HasConstraintName("FK__QuestionR__UserI__236943A5"); - - b.Navigation("Question"); - - b.Navigation("Report"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionSave", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionSaves") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionS__Quest__25518C17"); - - b.HasOne("VNH.Domain.User", "User") - .WithMany("QuestionSaves") - .HasForeignKey("UserId") - .HasConstraintName("FK__QuestionS__UserI__245D67DE"); - - b.Navigation("Question"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.QuestionTag", b => - { - b.HasOne("VNH.Domain.Question", "Question") - .WithMany("QuestionTag") - .HasForeignKey("QuestionId") - .HasConstraintName("FK__QuestionTag__Id__2739D489"); - - b.HasOne("VNH.Domain.Tag", "Tag") - .WithMany("QuestionTags") - .HasForeignKey("TagId") - .HasConstraintName("FK__QuestionT__TagId__2645B050"); - - b.Navigation("Question"); - - b.Navigation("Tag"); - }); - - modelBuilder.Entity("VNH.Domain.Quiz", b => - { - b.HasOne("VNH.Domain.Exercise", "IdNavigation") - .WithOne("Quiz") - .HasForeignKey("VNH.Domain.Quiz", "Id") - .IsRequired() - .HasConstraintName("FK__Quiz__Id__29221CFB"); - - b.Navigation("IdNavigation"); - }); - - modelBuilder.Entity("VNH.Domain.Search", b => - { - b.HasOne("VNH.Domain.User", "User") - .WithMany("Searches") - .HasForeignKey("UserId") - .HasConstraintName("FK__Search__UserId__17F790F9"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("VNH.Domain.SubAnswer", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("SubAnswers") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); - - b.HasOne("VNH.Domain.Answer", "PreAnswer") - .WithMany("SubAnswers") - .HasForeignKey("PreAnswerId") - .HasConstraintName("FK__SubAnswer__PreAn__1BC821DD"); - - b.Navigation("Author"); - - b.Navigation("PreAnswer"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.HasOne("VNH.Domain.User", "Author") - .WithMany("Topics") - .HasForeignKey("AuthorId") - .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); - - b.Navigation("Author"); - }); - - modelBuilder.Entity("VNH.Domain.TopicDetail", b => - { - b.HasOne("VNH.Domain.Post", "Post") - .WithMany("TopicDetails") - .HasForeignKey("PostId") - .HasConstraintName("FK__TopicDeta__TagId__07C12930"); - - b.HasOne("VNH.Domain.Topic", "Topic") - .WithMany("TopicDetails") - .HasForeignKey("TopicId") - .HasConstraintName("FK__TopicDeta__Topic__06CD04F7"); - - b.Navigation("Post"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("VNH.Domain.Answer", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("SubAnswers"); - }); - - modelBuilder.Entity("VNH.Domain.Course", b => - { - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("VNH.Domain.CourseComment", b => - { - b.Navigation("CourseSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Document", b => - { - b.Navigation("DocumentSaves"); - }); - - modelBuilder.Entity("VNH.Domain.Entities.Notification", b => - { - b.Navigation("NotificationDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Exercise", b => - { - b.Navigation("ExerciseDetails"); - - b.Navigation("Quiz"); - }); - - modelBuilder.Entity("VNH.Domain.Lesson", b => - { - b.Navigation("Exercise"); - }); - - modelBuilder.Entity("VNH.Domain.Post", b => - { - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostTags"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.PostComment", b => - { - b.Navigation("PostSubComments"); - }); - - modelBuilder.Entity("VNH.Domain.Question", b => - { - b.Navigation("Answers"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("QuestionTag"); - }); - - modelBuilder.Entity("VNH.Domain.Report", b => - { - b.Navigation("PostReportDetails"); - - b.Navigation("QuestionReportDetails"); - }); - - modelBuilder.Entity("VNH.Domain.Tag", b => - { - b.Navigation("PostTags"); - - b.Navigation("QuestionTags"); - }); - - modelBuilder.Entity("VNH.Domain.Topic", b => - { - b.Navigation("Posts"); - - b.Navigation("TopicDetails"); - }); - - modelBuilder.Entity("VNH.Domain.User", b => - { - b.Navigation("AnswerVotes"); - - b.Navigation("Answers"); - - b.Navigation("CourseComments"); - - b.Navigation("CourseRatings"); - - b.Navigation("CourseSaves"); - - b.Navigation("CourseSubComments"); - - b.Navigation("Courses"); - - b.Navigation("DocumentSaves"); - - b.Navigation("Documents"); - - b.Navigation("ExerciseDetails"); - - b.Navigation("NotificationDetails"); - - b.Navigation("PostComments"); - - b.Navigation("PostLikes"); - - b.Navigation("PostReportDetails"); - - b.Navigation("PostSaves"); - - b.Navigation("PostSubComments"); - - b.Navigation("Posts"); - - b.Navigation("QuestionLikes"); - - b.Navigation("QuestionReportDetails"); - - b.Navigation("QuestionSaves"); - - b.Navigation("Questions"); - - b.Navigation("Searches"); - - b.Navigation("SubAnswers"); - - b.Navigation("Topics"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231121014823_add column UpdateAt for table Answer.cs b/VNH.Infrastructure/Migrations/20231121014823_add column UpdateAt for table Answer.cs deleted file mode 100644 index 4006ace..0000000 --- a/VNH.Infrastructure/Migrations/20231121014823_add column UpdateAt for table Answer.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class addcolumnUpdateAtfortableAnswer : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UpdateAt", - table: "Answer", - type: "datetime", - nullable: true); - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UpdateAt", - table: "Answer"); - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231121030333_add column UpdateAt for table SubAnswer.cs b/VNH.Infrastructure/Migrations/20231121030333_add column UpdateAt for table SubAnswer.cs deleted file mode 100644 index 580f348..0000000 --- a/VNH.Infrastructure/Migrations/20231121030333_add column UpdateAt for table SubAnswer.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace VNH.Infrastructure.Migrations -{ - /// - public partial class addcolumnUpdateAtfortableSubAnswer : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UpdateAt", - table: "SubAnswer", - type: "datetime", - nullable: true); - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UpdateAt", - table: "SubAnswer"); - - } - } -} diff --git a/VNH.Infrastructure/Migrations/20231121030333_add column UpdateAt for table SubAnswer.Designer.cs b/VNH.Infrastructure/Migrations/20231205113916_init.Designer.cs similarity index 95% rename from VNH.Infrastructure/Migrations/20231121030333_add column UpdateAt for table SubAnswer.Designer.cs rename to VNH.Infrastructure/Migrations/20231205113916_init.Designer.cs index 3402ab0..1c20d8a 100644 --- a/VNH.Infrastructure/Migrations/20231121030333_add column UpdateAt for table SubAnswer.Designer.cs +++ b/VNH.Infrastructure/Migrations/20231205113916_init.Designer.cs @@ -12,8 +12,8 @@ namespace VNH.Infrastructure.Migrations { [DbContext(typeof(VietNamHistoryContext))] - [Migration("20231121030333_add column UpdateAt for table SubAnswer")] - partial class addcolumnUpdateAtfortableSubAnswer + [Migration("20231205113916_init")] + partial class init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -143,16 +143,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); - b.Property("MostConfirm") + b.Property("CreatedAt") + .HasColumnType("datetime"); + + b.Property("IsDeleted") .HasColumnType("bit"); - b.Property("PubDate") - .HasColumnType("datetime"); + b.Property("MostConfirm") + .HasColumnType("bit"); b.Property("QuestionId") .HasColumnType("uniqueidentifier"); - b.Property("UpdateAt") + b.Property("UpdatedAt") .HasColumnType("datetime"); b.HasKey("Id"); @@ -172,6 +175,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("AnswerId") .HasColumnType("uniqueidentifier"); + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -204,6 +210,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Image") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("UpdatedAt") .HasColumnType("datetime"); @@ -335,6 +344,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("FileName") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("SubId") .HasColumnType("nvarchar(max)"); @@ -524,6 +536,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ExerciseId") .HasColumnType("uniqueidentifier"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("Title") .HasMaxLength(500) .HasColumnType("nvarchar(500)"); @@ -545,25 +560,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("CreatedAt") + .HasColumnType("datetime2"); + b.Property("Description") - .HasColumnType("text"); + .HasColumnType("nvarchar(max)"); b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); + .HasColumnType("nvarchar(max)"); b.Property("Title") .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); + .HasColumnType("nvarchar(max)"); b.Property("Url") .IsRequired() - .HasMaxLength(255) .IsUnicode(false) - .HasColumnType("varchar(255)"); + .HasColumnType("varchar(max)"); b.HasKey("Id"); @@ -585,6 +598,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Image") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("SubId") .HasMaxLength(300) .HasColumnType("nvarchar(300)"); @@ -762,17 +778,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); - b.Property("CreateAt") + b.Property("CreatedAt") .HasColumnType("datetime"); + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("SubId") + .HasColumnType("nvarchar(max)"); + b.Property("Title") .HasMaxLength(500) .HasColumnType("nvarchar(500)"); - b.Property("UpdateAt") + b.Property("UpdatedAt") .HasColumnType("datetime"); - b.Property("ViewNumber") + b.Property("ViewNumber") .HasColumnType("int"); b.HasKey("Id"); @@ -935,49 +957,49 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) new { Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6450), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5119), Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", Title = "Nội dung vi phạm quy định về quyền riêng tư" }, new { Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6463), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5130), Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", Title = "Nội dung xấu, xúc phạm, hay kỳ thị" }, new { Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6465), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5132), Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" }, new { Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6468), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5135), Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" }, new { Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6470), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5137), Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" }, new { Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6472), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5139), Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" }, new { Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6474), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5141), Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" }); @@ -1006,21 +1028,21 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) new { Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "12e5e898-54fb-436f-b388-3a86dab13fad", + ConcurrencyStamp = "0280c004-4c9d-4c8d-b5db-b082e6f7acb0", Name = "admin", NormalizedName = "admin" }, new { Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "661a3ba6-1d96-4fee-a6c3-c6bb4226e93b", + ConcurrencyStamp = "b7987496-177d-4832-9dfa-b9bbd1d9f845", Name = "teacher", NormalizedName = "teacher" }, new { Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "8354d441-e7d9-4c7a-b73d-44bd84e3d088", + ConcurrencyStamp = "ef959ed9-61b1-490f-99c0-7f0e4dede450", Name = "student", NormalizedName = "student" }); @@ -1056,13 +1078,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); + b.Property("CreatedAt") + .HasColumnType("datetime"); + b.Property("PreAnswerId") .HasColumnType("uniqueidentifier"); - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("UpdateAt") + b.Property("UpdatedAt") .HasColumnType("datetime"); b.HasKey("Id"); @@ -1167,6 +1189,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Introduction") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("LockoutEnabled") .HasColumnType("bit"); @@ -1209,17 +1234,18 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), AccessFailedCount = 0, - ConcurrencyStamp = "d22c9b5e-0177-4807-ac36-e61bb86cc5f5", + ConcurrencyStamp = "8ef2dc7b-f7d6-4b9e-a78f-762bbc8312be", DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), Email = "admin@gmail.com", EmailConfirmed = true, Fullname = "Lương Xuân Nhất", Gender = 0, Image = "", + IsDeleted = false, LockoutEnabled = false, NormalizedEmail = "onionwebdev@gmail.com", NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEFIJwgq3eV+hZm2d+7apMkFyGpxUYooCdajUXUKqWLSUwBa69VQf3AtsTvTaradpQQ==", + PasswordHash = "AQAAAAEAACcQAAAAEFYvExancfwhSmTXA7fMTCW4e2eH7v0R7f+24QMimThVbykB6RkZFmfzHeqHbq5r6w==", PhoneNumberConfirmed = false, SecurityStamp = "", TwoFactorEnabled = false, diff --git a/VNH.Infrastructure/Migrations/20231018014102_Init_Database.cs b/VNH.Infrastructure/Migrations/20231205113916_init.cs similarity index 81% rename from VNH.Infrastructure/Migrations/20231018014102_Init_Database.cs rename to VNH.Infrastructure/Migrations/20231205113916_init.cs index 3635f53..3910222 100644 --- a/VNH.Infrastructure/Migrations/20231018014102_Init_Database.cs +++ b/VNH.Infrastructure/Migrations/20231205113916_init.cs @@ -8,25 +8,11 @@ namespace VNH.Infrastructure.Migrations { /// - public partial class Init_Database : Migration + public partial class init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.CreateTable( - name: "Roles", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: true), - NormalizedName = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Roles", x => x.Id); - }); - migrationBuilder.CreateTable( name: "AppRoleClaims", columns: table => new @@ -40,13 +26,6 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_AppRoleClaims", x => x.Id); - - table.ForeignKey( - name: "FK_AppRoleClaims_Roles_RoleId", - column: x => x.RoleId, - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -82,11 +61,11 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), - Description = table.Column(type: "text", nullable: true), - Image = table.Column(type: "text", nullable: true), - PubDate = table.Column(type: "datetime", nullable: true), - Url = table.Column(type: "varchar(255)", unicode: false, maxLength: 255, nullable: false) + Title = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + CreatedAt = table.Column(type: "datetime2", nullable: false), + Image = table.Column(type: "nvarchar(max)", nullable: true), + Url = table.Column(type: "varchar(max)", unicode: false, nullable: false) }, constraints: table => { @@ -118,10 +97,21 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_Report", x => x.Id); - }); - + migrationBuilder.CreateTable( + name: "Roles", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: true), + NormalizedName = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Roles", x => x.Id); + }); migrationBuilder.CreateTable( name: "Tag", @@ -136,15 +126,17 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "UserShort", + name: "User", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Fullname = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), DateOfBirth = table.Column(type: "datetime", nullable: true), + Introduction = table.Column(type: "nvarchar(max)", nullable: true), Gender = table.Column(type: "int", nullable: false), - Image = table.Column(type: "varbinary(max)", maxLength: 3145728, nullable: true), + Image = table.Column(type: "nvarchar(max)", maxLength: 3145728, nullable: true), NumberConfirm = table.Column(type: "nvarchar(max)", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), UserName = table.Column(type: "nvarchar(max)", nullable: true), NormalizedUserName = table.Column(type: "nvarchar(max)", nullable: true), Email = table.Column(type: "nvarchar(max)", nullable: true), @@ -178,6 +170,7 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_UserClaims", x => x.Id); + }); migrationBuilder.CreateTable( @@ -190,34 +183,17 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AppUserRoles_Roles_RoleId", - column: x => x.RoleId, - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - }); + name: "FK_AppUserRoles_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); - migrationBuilder.CreateTable( - name: "Answer", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Content = table.Column(type: "nvarchar(max)", nullable: true), - AuthorId = table.Column(type: "uniqueidentifier", nullable: true), - PubDate = table.Column(type: "datetime", nullable: true), - Confirm = table.Column(type: "bit", nullable: true), - MostConfirm = table.Column(type: "bit", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Answer", x => x.Id); table.ForeignKey( - name: "FK__Answer__AuthorId__1AD3FDA4", - column: x => x.AuthorId, - principalTable: "UserShort", + name: "FK_AppUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "User", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -231,7 +207,9 @@ protected override void Up(MigrationBuilder migrationBuilder) Description = table.Column(type: "nvarchar(max)", nullable: true), UserId = table.Column(type: "uniqueidentifier", nullable: true), CreatedAt = table.Column(type: "datetime", nullable: true), - UpdatedAt = table.Column(type: "datetime", nullable: true) + UpdatedAt = table.Column(type: "datetime", nullable: true), + Image = table.Column(type: "nvarchar(max)", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { @@ -239,9 +217,8 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "FK__Course__UserId__787EE5A0", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -250,13 +227,12 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "uniqueidentifier", nullable: false), Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), - Description = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - UrlImage = table.Column(type: "varchar(255)", unicode: false, maxLength: 255, nullable: true), - FileName = table.Column(type: "varchar(255)", unicode: false, maxLength: 255, nullable: true), - ContentType = table.Column(type: "varchar(255)", unicode: false, maxLength: 255, nullable: true), - Content = table.Column(type: "varbinary(max)", nullable: true), - UserId = table.Column(type: "uniqueidentifier", nullable: true), - CreatedAt = table.Column(type: "datetime", nullable: true), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + SubId = table.Column(type: "nvarchar(max)", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + FileName = table.Column(type: "nvarchar(max)", nullable: true), + UserId = table.Column(type: "uniqueidentifier", unicode: false, maxLength: 255, nullable: true), + CreatedAt = table.Column(type: "datetime", nullable: false), UpdatedAt = table.Column(type: "datetime", nullable: true) }, constraints: table => @@ -265,8 +241,8 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "FK__Document__UserId__0A9D95DB", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -292,7 +268,7 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "FK__NotificationDetail__UserId__1EA48E88", column: x => x.UserId, - principalTable: "UserShort", + principalTable: "User", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -303,11 +279,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "uniqueidentifier", nullable: false), Title = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + SubId = table.Column(type: "nvarchar(max)", nullable: true), Content = table.Column(type: "nvarchar(max)", nullable: true), - ViewNumber = table.Column(type: "int", nullable: true), + ViewNumber = table.Column(type: "int", nullable: false), AuthorId = table.Column(type: "uniqueidentifier", nullable: true), - PubDate = table.Column(type: "datetime", nullable: true), - QuestionTagId = table.Column(type: "uniqueidentifier", nullable: true) + UpdatedAt = table.Column(type: "datetime", nullable: true), + CreatedAt = table.Column(type: "datetime", nullable: false), + IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { @@ -315,9 +293,8 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "FK__Question__Author__18EBB532", column: x => x.AuthorId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -334,9 +311,8 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "FK__Search__UserId__17F790F9", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -355,61 +331,8 @@ protected override void Up(MigrationBuilder migrationBuilder) table.ForeignKey( name: "FK__Topic__AuthorId__05D8E0BE", column: x => x.AuthorId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AnswerVote", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - AnswerId = table.Column(type: "uniqueidentifier", nullable: true), - UserId = table.Column(type: "uniqueidentifier", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AnswerVote", x => x.Id); - table.ForeignKey( - name: "FK__AnswerVot__Answe__1DB06A4F", - column: x => x.AnswerId, - principalTable: "Answer", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK__AnswerVot__UserI__1EA48E88", - column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - }); - - migrationBuilder.CreateTable( - name: "SubAnswer", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - PreAnswerId = table.Column(type: "uniqueidentifier", nullable: true), - Content = table.Column(type: "nvarchar(max)", nullable: true), - AuthorId = table.Column(type: "uniqueidentifier", nullable: true), - PubDate = table.Column(type: "datetime", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_SubAnswer", x => x.Id); - table.ForeignKey( - name: "FK__SubAnswer__Autho__1CBC4616", - column: x => x.AuthorId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); - table.ForeignKey( - name: "FK__SubAnswer__PreAn__1BC821DD", - column: x => x.PreAnswerId, - principalTable: "Answer", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -430,14 +353,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__CourseCom__Cours__7A672E12", column: x => x.CourseId, principalTable: "Course", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__CourseCom__UserI__797309D9", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", - onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -456,14 +377,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__CourseRat__Cours__7D439ABD", column: x => x.CourseId, principalTable: "Course", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__CourseRat__UserI__7E37BEF6", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id" - , onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -481,13 +400,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__CourseSav__Cours__04E4BC85", column: x => x.CourseId, principalTable: "Course", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__CourseSav__UserI__03F0984C", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id" - , onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -499,7 +417,8 @@ protected override void Up(MigrationBuilder migrationBuilder) UrlVideo = table.Column(type: "varchar(255)", unicode: false, maxLength: 255, nullable: true), Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), CourseId = table.Column(type: "uniqueidentifier", nullable: true), - ExerciseId = table.Column(type: "uniqueidentifier", nullable: true) + ExerciseId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { @@ -508,7 +427,7 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__Lesson__CourseId__7F2BE32F", column: x => x.CourseId, principalTable: "Course", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -526,14 +445,42 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__DocumentS__Docum__0C85DE4D", column: x => x.DocumentId, principalTable: "Document", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__DocumentS__UserI__0B91BA14", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id" - , onDelete: ReferentialAction.NoAction - ); + principalTable: "User", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Answer", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + QuestionId = table.Column(type: "uniqueidentifier", nullable: false), + Content = table.Column(type: "nvarchar(max)", nullable: true), + AuthorId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetime", nullable: true), + UpdatedAt = table.Column(type: "datetime", nullable: true), + Confirm = table.Column(type: "bit", nullable: true), + MostConfirm = table.Column(type: "bit", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Answer", x => x.Id); + table.ForeignKey( + name: "FK__Answer__AuthorId__1AD3FDA4", + column: x => x.AuthorId, + principalTable: "User", + principalColumn: "Id"); + table.ForeignKey( + name: "FK__Answer__QuestionId__1AD3FVA4", + column: x => x.QuestionId, + principalTable: "Question", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -551,13 +498,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__QuestionL__Quest__1F98B2C1", column: x => x.QuestionId, principalTable: "Question", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__QuestionL__UserI__208CD6FA", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id" - , onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -565,10 +511,12 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - QuestionId = table.Column(type: "uniqueidentifier", nullable: true), - ReportId = table.Column(type: "uniqueidentifier", nullable: true), - UserId = table.Column(type: "uniqueidentifier", nullable: true), - Description = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true) + QuestionId = table.Column(type: "uniqueidentifier", nullable: false), + ReportId = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Description = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), + ReportDate = table.Column(type: "datetime2", nullable: false), + Checked = table.Column(type: "bit", nullable: false) }, constraints: table => { @@ -577,18 +525,20 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__QuestionR__Quest__2180FB33", column: x => x.QuestionId, principalTable: "Question", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK__QuestionR__Quest__22751F6C", column: x => x.ReportId, principalTable: "Report", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK__QuestionR__UserI__236943A5", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id" - , onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -606,12 +556,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__QuestionS__Quest__25518C17", column: x => x.QuestionId, principalTable: "Question", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__QuestionS__UserI__245D67DE", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -619,7 +569,8 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - TagId = table.Column(type: "uniqueidentifier", nullable: true) + TagId = table.Column(type: "uniqueidentifier", nullable: true), + QuestionId = table.Column(type: "uniqueidentifier", nullable: true) }, constraints: table => { @@ -628,12 +579,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__QuestionT__TagId__2645B050", column: x => x.TagId, principalTable: "Tag", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__QuestionTag__Id__2739D489", - column: x => x.Id, + column: x => x.QuestionId, principalTable: "Question", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -641,14 +592,16 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), - Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), + SubId = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: true), + Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), Content = table.Column(type: "nvarchar(max)", nullable: true), TopicId = table.Column(type: "uniqueidentifier", nullable: false), - CreatedAt = table.Column(type: "datetime", nullable: true), + CreatedAt = table.Column(type: "datetime", nullable: false), UpdatedAt = table.Column(type: "datetime", nullable: true), - UserId = table.Column(type: "uniqueidentifier", nullable: true), - Image = table.Column(type: "varbinary(max)", nullable: true), - ViewNumber = table.Column(type: "int", nullable: false) + UserId = table.Column(type: "uniqueidentifier", nullable: false), + Image = table.Column(type: "nvarchar(max)", nullable: true), + ViewNumber = table.Column(type: "int", nullable: false), + IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { @@ -658,12 +611,13 @@ protected override void Up(MigrationBuilder migrationBuilder) column: x => x.TopicId, principalTable: "Topic", principalColumn: "Id", - onDelete: ReferentialAction.NoAction); + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK__Post__UserId__778AC167", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -684,12 +638,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__CourseSub__PreCo__7C4F7684", column: x => x.PreCommentId, principalTable: "CourseComment", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalColumn: "Id"); table.ForeignKey( name: "FK__CourseSub__UserI__7B5B524B", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -712,7 +666,57 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__Exercise__Id__282DF8C2", column: x => x.Id, principalTable: "Lesson", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "AnswerVote", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AnswerId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: true), + QuestionId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AnswerVote", x => x.Id); + table.ForeignKey( + name: "FK__AnswerVot__Answe__1DB06A4F", + column: x => x.AnswerId, + principalTable: "Answer", + principalColumn: "Id"); + table.ForeignKey( + name: "FK__AnswerVot__UserI__1EA48E88", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "SubAnswer", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PreAnswerId = table.Column(type: "uniqueidentifier", nullable: true), + Content = table.Column(type: "nvarchar(max)", nullable: true), + AuthorId = table.Column(type: "uniqueidentifier", nullable: true), + CreatedAt = table.Column(type: "datetime", nullable: true), + UpdatedAt = table.Column(type: "datetime", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAnswer", x => x.Id); + table.ForeignKey( + name: "FK__SubAnswer__Autho__1CBC4616", + column: x => x.AuthorId, + principalTable: "User", + principalColumn: "Id"); + table.ForeignKey( + name: "FK__SubAnswer__PreAn__1BC821DD", + column: x => x.PreAnswerId, + principalTable: "Answer", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -733,12 +737,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__PostComme__PostI__0F624AF8", column: x => x.PostId, principalTable: "Post", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__PostComme__UserI__10566F31", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -756,12 +760,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__PostLike__PostId__1332DBDC", column: x => x.PostId, principalTable: "Post", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__PostLike__UserId__14270015", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -769,10 +773,12 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - ReportId = table.Column(type: "uniqueidentifier", nullable: true), - UserId = table.Column(type: "uniqueidentifier", nullable: true), + ReportId = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "uniqueidentifier", nullable: false), PostId = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - Description = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true) + Description = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), + ReportDate = table.Column(type: "datetime2", nullable: false), + Checked = table.Column(type: "bit", nullable: false) }, constraints: table => { @@ -781,17 +787,19 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__PostRepor__PostI__17036CC0", column: x => x.PostId, principalTable: "Post", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__PostRepor__Repor__151B244E", column: x => x.ReportId, principalTable: "Report", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK__PostRepor__UserI__160F4887", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -809,12 +817,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__PostSave__PostId__08B54D69", column: x => x.PostId, principalTable: "Post", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__PostSave__UserId__09A971A2", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -858,12 +866,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__TopicDeta__TagId__07C12930", column: x => x.PostId, principalTable: "Post", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__TopicDeta__Topic__06CD04F7", column: x => x.TopicId, principalTable: "Topic", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -883,12 +891,12 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__ExerciseD__Exerc__02084FDA", column: x => x.ExerciseId, principalTable: "Exercise", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__ExerciseD__UserI__01142BA1", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalTable: "User", + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -910,7 +918,7 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__Quiz__Id__29221CFB", column: x => x.Id, principalTable: "Exercise", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -931,12 +939,26 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK__PostSubCo__PreCo__114A936A", column: x => x.PreCommentId, principalTable: "PostComment", - principalColumn: "Id", onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); table.ForeignKey( name: "FK__PostSubCo__UserI__123EB7A3", column: x => x.UserId, - principalTable: "UserShort", - principalColumn: "Id", onDelete: ReferentialAction.NoAction); + principalTable: "User", + principalColumn: "Id"); + }); + + migrationBuilder.InsertData( + table: "Report", + columns: new[] { "Id", "CreatedAt", "Description", "Title" }, + values: new object[,] + { + { new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5130), "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", "Nội dung xấu, xúc phạm, hay kỳ thị" }, + { new Guid("3043c693-b3c9-453e-9876-31c943222576"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5141), "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" }, + { new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5135), "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", "Chứa nội dung tự tử hoặc tự gây thương tổn" }, + { new Guid("4a780087-9058-41c9-b84b-944d1a502010"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5139), "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", "Bài đăng chứa thông tin sai lệch hoặc giả mạo" }, + { new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5132), "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", "Chứa nội dung bạo lực hoặc đội nhóm xấu" }, + { new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5137), "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" }, + { new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5119), " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", "Nội dung vi phạm quy định về quyền riêng tư" } }); migrationBuilder.InsertData( @@ -944,15 +966,15 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" }, values: new object[,] { - { new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), "02fde28e-4c7f-4023-821c-c654a4eb0080", "student", "student" }, - { new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), "1270383a-290a-4c5e-8826-562d998d4fae", "admin", "admin" }, - { new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), "4ea95e9f-aa5a-4cef-b1e4-01332acf69e2", "teacher", "teacher" } + { new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), "ef959ed9-61b1-490f-99c0-7f0e4dede450", "student", "student" }, + { new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), "0280c004-4c9d-4c8d-b5db-b082e6f7acb0", "admin", "admin" }, + { new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), "b7987496-177d-4832-9dfa-b9bbd1d9f845", "teacher", "teacher" } }); migrationBuilder.InsertData( - table: "UserShort", - columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "DateOfBirth", "Email", "EmailConfirmed", "Fullname", "Gender", "Image", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "NumberConfirm", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" }, - values: new object[] { new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), 0, "4c01e053-2305-475a-9e02-72a5d42690fa", new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), "admin@gmail.com", true, "Lương Xuân Nhất", 0, null, false, null, "onionwebdev@gmail.com", "admin", null, "AQAAAAEAACcQAAAAEOw1VikrgkAjKdkOIzWPZF75vuWlYVlt26baQdSJNhrtHU8Kmb5+IUWoIvdjRbiPeQ==", null, false, "", false, "admin" }); + table: "User", + columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "DateOfBirth", "Email", "EmailConfirmed", "Fullname", "Gender", "Image", "Introduction", "IsDeleted", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "NumberConfirm", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" }, + values: new object[] { new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), 0, "8ef2dc7b-f7d6-4b9e-a78f-762bbc8312be", new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), "admin@gmail.com", true, "Lương Xuân Nhất", 0, "", null, false, false, null, "onionwebdev@gmail.com", "admin", null, "AQAAAAEAACcQAAAAEFYvExancfwhSmTXA7fMTCW4e2eH7v0R7f+24QMimThVbykB6RkZFmfzHeqHbq5r6w==", null, false, "", false, "admin" }); migrationBuilder.InsertData( table: "UserRoles", @@ -964,6 +986,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Answer", column: "AuthorId"); + migrationBuilder.CreateIndex( + name: "IX_Answer_QuestionId", + table: "Answer", + column: "QuestionId"); + migrationBuilder.CreateIndex( name: "IX_AnswerVote_AnswerId", table: "AnswerVote", @@ -1174,6 +1201,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "QuestionSave", column: "UserId"); + migrationBuilder.CreateIndex( + name: "IX_QuestionTag_QuestionId", + table: "QuestionTag", + column: "QuestionId"); + migrationBuilder.CreateIndex( name: "IX_QuestionTag_TagId", table: "QuestionTag", @@ -1312,9 +1344,6 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "Tag"); - migrationBuilder.DropTable( - name: "Question"); - migrationBuilder.DropTable( name: "Exercise"); @@ -1327,6 +1356,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "Lesson"); + migrationBuilder.DropTable( + name: "Question"); + migrationBuilder.DropTable( name: "Topic"); @@ -1334,7 +1366,7 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "Course"); migrationBuilder.DropTable( - name: "UserShort"); + name: "User"); } } } diff --git a/VNH.Infrastructure/Migrations/VietNamHistoryContextModelSnapshot.cs b/VNH.Infrastructure/Migrations/VietNamHistoryContextModelSnapshot.cs index a1120af..a8d1090 100644 --- a/VNH.Infrastructure/Migrations/VietNamHistoryContextModelSnapshot.cs +++ b/VNH.Infrastructure/Migrations/VietNamHistoryContextModelSnapshot.cs @@ -140,16 +140,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); - b.Property("MostConfirm") + b.Property("CreatedAt") + .HasColumnType("datetime"); + + b.Property("IsDeleted") .HasColumnType("bit"); - b.Property("PubDate") - .HasColumnType("datetime"); + b.Property("MostConfirm") + .HasColumnType("bit"); b.Property("QuestionId") .HasColumnType("uniqueidentifier"); - b.Property("UpdateAt") + b.Property("UpdatedAt") .HasColumnType("datetime"); b.HasKey("Id"); @@ -169,6 +172,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("AnswerId") .HasColumnType("uniqueidentifier"); + b.Property("QuestionId") + .HasColumnType("uniqueidentifier"); + b.Property("UserId") .HasColumnType("uniqueidentifier"); @@ -201,6 +207,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Image") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("UpdatedAt") .HasColumnType("datetime"); @@ -332,6 +341,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FileName") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("SubId") .HasColumnType("nvarchar(max)"); @@ -521,6 +533,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ExerciseId") .HasColumnType("uniqueidentifier"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("Title") .HasMaxLength(500) .HasColumnType("nvarchar(500)"); @@ -542,25 +557,23 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("CreatedAt") + .HasColumnType("datetime2"); + b.Property("Description") - .HasColumnType("text"); + .HasColumnType("nvarchar(max)"); b.Property("Image") - .HasColumnType("text"); - - b.Property("PubDate") - .HasColumnType("datetime"); + .HasColumnType("nvarchar(max)"); b.Property("Title") .IsRequired() - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); + .HasColumnType("nvarchar(max)"); b.Property("Url") .IsRequired() - .HasMaxLength(255) .IsUnicode(false) - .HasColumnType("varchar(255)"); + .HasColumnType("varchar(max)"); b.HasKey("Id"); @@ -582,6 +595,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Image") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("SubId") .HasMaxLength(300) .HasColumnType("nvarchar(300)"); @@ -759,17 +775,23 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); - b.Property("CreateAt") + b.Property("CreatedAt") .HasColumnType("datetime"); + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("SubId") + .HasColumnType("nvarchar(max)"); + b.Property("Title") .HasMaxLength(500) .HasColumnType("nvarchar(500)"); - b.Property("UpdateAt") + b.Property("UpdatedAt") .HasColumnType("datetime"); - b.Property("ViewNumber") + b.Property("ViewNumber") .HasColumnType("int"); b.HasKey("Id"); @@ -932,49 +954,49 @@ protected override void BuildModel(ModelBuilder modelBuilder) new { Id = new Guid("d30e1353-0163-43c1-b757-7957981b0eda"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6450), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5119), Description = " Báo cáo này được sử dụng khi người dùng chia sẻ nội dung cá nhân của bạn mà bạn cho rằng vi phạm quyền riêng tư của bạn.", Title = "Nội dung vi phạm quy định về quyền riêng tư" }, new { Id = new Guid("25752490-4ba5-4abb-ac3b-192205cd1b6e"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6463), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5130), Description = "Sử dụng khi bạn thấy nội dung bài đăng chứa lời lẽ xúc phạm, kỳ thị hoặc có tính chất đe doạ đến người khác.", Title = "Nội dung xấu, xúc phạm, hay kỳ thị" }, new { Id = new Guid("bab1da58-6921-44b9-837f-c58d3998497b"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6465), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5132), Description = "Dùng khi bạn thấy nội dung chứa hình ảnh hoặc video bạo lực hoặc đội nhóm xấu, hoặc khuyến khích hành vi bạo lực.", Title = "Chứa nội dung bạo lực hoặc đội nhóm xấu" }, new { Id = new Guid("349ed807-6107-436f-9a4c-9d6183fbc444"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6468), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5135), Description = "Sử dụng khi bạn thấy nội dung chứa hình ảnh tự tử hoặc khuyến khích hành vi tự gây thương tổn.", Title = "Chứa nội dung tự tử hoặc tự gây thương tổn" }, new { Id = new Guid("c4ddb872-06c5-4779-a8a3-a55e5b2c5347"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6470), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5137), Description = "Sử dụng khi bạn cho rằng Nội dung vi phạm quyền sở hữu trí tuệ hoặc bản quyền, chẳng hạn như sử dụng hình ảnh hoặc video mà bạn sở hữu mà không có sự cho phép.", Title = "Nội dung vi phạm bản quyền hoặc sở hữu trí tuệ" }, new { Id = new Guid("4a780087-9058-41c9-b84b-944d1a502010"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6472), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5139), Description = "Sử dụng khi bạn thấy rằng nội dung chứa thông tin sai lệch, giả mạo hoặc vi phạm quy tắc về sự thật và trung thực.", Title = "Bài đăng chứa thông tin sai lệch hoặc giả mạo" }, new { Id = new Guid("3043c693-b3c9-453e-9876-31c943222576"), - CreatedAt = new DateTime(2023, 11, 21, 10, 3, 33, 369, DateTimeKind.Local).AddTicks(6474), + CreatedAt = new DateTime(2023, 12, 5, 18, 39, 16, 240, DateTimeKind.Local).AddTicks(5141), Description = "Dùng khi bạn muốn báo cáo vì nó quá nhiều thông báo hoặc quảng cáo không mong muốn.", Title = "Nội dung xuất hiện quá nhiều thông báo hoặc quảng cáo không mong muốn" }); @@ -1003,21 +1025,21 @@ protected override void BuildModel(ModelBuilder modelBuilder) new { Id = new Guid("a18be9c0-aa65-4af8-bd17-00bd9344e575"), - ConcurrencyStamp = "12e5e898-54fb-436f-b388-3a86dab13fad", + ConcurrencyStamp = "0280c004-4c9d-4c8d-b5db-b082e6f7acb0", Name = "admin", NormalizedName = "admin" }, new { Id = new Guid("cfafcfcd-d796-43f4-8ac0-ead43bd2f18a"), - ConcurrencyStamp = "661a3ba6-1d96-4fee-a6c3-c6bb4226e93b", + ConcurrencyStamp = "b7987496-177d-4832-9dfa-b9bbd1d9f845", Name = "teacher", NormalizedName = "teacher" }, new { Id = new Guid("5d4e4081-91f8-4fc0-b8eb-9860b7849604"), - ConcurrencyStamp = "8354d441-e7d9-4c7a-b73d-44bd84e3d088", + ConcurrencyStamp = "ef959ed9-61b1-490f-99c0-7f0e4dede450", Name = "student", NormalizedName = "student" }); @@ -1053,13 +1075,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); + b.Property("CreatedAt") + .HasColumnType("datetime"); + b.Property("PreAnswerId") .HasColumnType("uniqueidentifier"); - b.Property("PubDate") - .HasColumnType("datetime"); - - b.Property("UpdateAt") + b.Property("UpdatedAt") .HasColumnType("datetime"); b.HasKey("Id"); @@ -1130,7 +1152,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("TopicDetail"); }); - modelBuilder.Entity("VNH.Domain.UserShort", b => + modelBuilder.Entity("VNH.Domain.User", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -1164,6 +1186,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Introduction") .HasColumnType("nvarchar(max)"); + b.Property("IsDeleted") + .HasColumnType("bit"); + b.Property("LockoutEnabled") .HasColumnType("bit"); @@ -1199,24 +1224,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.ToTable("UserShort"); + b.ToTable("User"); b.HasData( new { Id = new Guid("d1f771da-b318-42f8-a003-5a15614216f5"), AccessFailedCount = 0, - ConcurrencyStamp = "d22c9b5e-0177-4807-ac36-e61bb86cc5f5", + ConcurrencyStamp = "8ef2dc7b-f7d6-4b9e-a78f-762bbc8312be", DateOfBirth = new DateTime(2002, 3, 18, 0, 0, 0, 0, DateTimeKind.Local), Email = "admin@gmail.com", EmailConfirmed = true, Fullname = "Lương Xuân Nhất", Gender = 0, Image = "", + IsDeleted = false, LockoutEnabled = false, NormalizedEmail = "onionwebdev@gmail.com", NormalizedUserName = "admin", - PasswordHash = "AQAAAAEAACcQAAAAEFIJwgq3eV+hZm2d+7apMkFyGpxUYooCdajUXUKqWLSUwBa69VQf3AtsTvTaradpQQ==", + PasswordHash = "AQAAAAEAACcQAAAAEFYvExancfwhSmTXA7fMTCW4e2eH7v0R7f+24QMimThVbykB6RkZFmfzHeqHbq5r6w==", PhoneNumberConfirmed = false, SecurityStamp = "", TwoFactorEnabled = false, @@ -1226,7 +1252,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("VNH.Domain.Answer", b => { - b.HasOne("VNH.Domain.UserShort", "Author") + b.HasOne("VNH.Domain.User", "Author") .WithMany("Answers") .HasForeignKey("AuthorId") .HasConstraintName("FK__Answer__AuthorId__1AD3FDA4"); @@ -1250,24 +1276,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("AnswerId") .HasConstraintName("FK__AnswerVot__Answe__1DB06A4F"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("AnswerVotes") .HasForeignKey("UserId") .HasConstraintName("FK__AnswerVot__UserI__1EA48E88"); b.Navigation("Answer"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.Course", b => { - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("Courses") .HasForeignKey("UserId") .HasConstraintName("FK__Course__UserId__787EE5A0"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.CourseComment", b => @@ -1277,14 +1303,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("CourseId") .HasConstraintName("FK__CourseCom__Cours__7A672E12"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("CourseComments") .HasForeignKey("UserId") .HasConstraintName("FK__CourseCom__UserI__797309D9"); b.Navigation("Course"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.CourseRating", b => @@ -1294,14 +1320,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("CourseId") .HasConstraintName("FK__CourseRat__Cours__7D439ABD"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("CourseRatings") .HasForeignKey("UserId") .HasConstraintName("FK__CourseRat__UserI__7E37BEF6"); b.Navigation("Course"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.CourseSave", b => @@ -1311,14 +1337,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("CourseId") .HasConstraintName("FK__CourseSav__Cours__04E4BC85"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("CourseSaves") .HasForeignKey("UserId") .HasConstraintName("FK__CourseSav__UserI__03F0984C"); b.Navigation("Course"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.CourseSubComment", b => @@ -1328,24 +1354,24 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("PreCommentId") .HasConstraintName("FK__CourseSub__PreCo__7C4F7684"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("CourseSubComments") .HasForeignKey("UserId") .HasConstraintName("FK__CourseSub__UserI__7B5B524B"); b.Navigation("PreComment"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.Document", b => { - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("Documents") .HasForeignKey("UserId") .HasConstraintName("FK__Document__UserId__0A9D95DB"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.DocumentSave", b => @@ -1355,14 +1381,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("DocumentId") .HasConstraintName("FK__DocumentS__Docum__0C85DE4D"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("DocumentSaves") .HasForeignKey("UserId") .HasConstraintName("FK__DocumentS__UserI__0B91BA14"); b.Navigation("Document"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.Entities.NotificationDetail", b => @@ -1374,7 +1400,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("FK__NotificationDetail__NotificationId__1EQ48E88"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("NotificationDetails") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) @@ -1383,7 +1409,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Notification"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.Entities.PostTag", b => @@ -1423,14 +1449,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("ExerciseId") .HasConstraintName("FK__ExerciseD__Exerc__02084FDA"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("ExerciseDetails") .HasForeignKey("UserId") .HasConstraintName("FK__ExerciseD__UserI__01142BA1"); b.Navigation("Exercise"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.Lesson", b => @@ -1452,7 +1478,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("FK__Post__TopicId__76969D2E"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("Posts") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) @@ -1461,7 +1487,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Topic"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.PostComment", b => @@ -1471,14 +1497,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("PostId") .HasConstraintName("FK__PostComme__PostI__0F624AF8"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("PostComments") .HasForeignKey("UserId") .HasConstraintName("FK__PostComme__UserI__10566F31"); b.Navigation("Post"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.PostLike", b => @@ -1488,14 +1514,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("PostId") .HasConstraintName("FK__PostLike__PostId__1332DBDC"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("PostLikes") .HasForeignKey("UserId") .HasConstraintName("FK__PostLike__UserId__14270015"); b.Navigation("Post"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.PostReportDetail", b => @@ -1512,7 +1538,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("FK__PostRepor__Repor__151B244E"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("PostReportDetails") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) @@ -1523,7 +1549,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Report"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.PostSave", b => @@ -1533,14 +1559,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("PostId") .HasConstraintName("FK__PostSave__PostId__08B54D69"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("PostSaves") .HasForeignKey("UserId") .HasConstraintName("FK__PostSave__UserId__09A971A2"); b.Navigation("Post"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.PostSubComment", b => @@ -1550,19 +1576,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("PreCommentId") .HasConstraintName("FK__PostSubCo__PreCo__114A936A"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("PostSubComments") .HasForeignKey("UserId") .HasConstraintName("FK__PostSubCo__UserI__123EB7A3"); b.Navigation("PreComment"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.Question", b => { - b.HasOne("VNH.Domain.UserShort", "Author") + b.HasOne("VNH.Domain.User", "Author") .WithMany("Questions") .HasForeignKey("AuthorId") .HasConstraintName("FK__Question__Author__18EBB532"); @@ -1577,14 +1603,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("QuestionId") .HasConstraintName("FK__QuestionL__Quest__1F98B2C1"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("QuestionLikes") .HasForeignKey("UserId") .HasConstraintName("FK__QuestionL__UserI__208CD6FA"); b.Navigation("Question"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.QuestionReportDetail", b => @@ -1603,7 +1629,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasConstraintName("FK__QuestionR__Quest__22751F6C"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("QuestionReportDetails") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) @@ -1614,7 +1640,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Report"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.QuestionSave", b => @@ -1624,14 +1650,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("QuestionId") .HasConstraintName("FK__QuestionS__Quest__25518C17"); - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("QuestionSaves") .HasForeignKey("UserId") .HasConstraintName("FK__QuestionS__UserI__245D67DE"); b.Navigation("Question"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.QuestionTag", b => @@ -1664,17 +1690,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("VNH.Domain.Search", b => { - b.HasOne("VNH.Domain.UserShort", "UserShort") + b.HasOne("VNH.Domain.User", "User") .WithMany("Searches") .HasForeignKey("UserId") .HasConstraintName("FK__Search__UserId__17F790F9"); - b.Navigation("UserShort"); + b.Navigation("User"); }); modelBuilder.Entity("VNH.Domain.SubAnswer", b => { - b.HasOne("VNH.Domain.UserShort", "Author") + b.HasOne("VNH.Domain.User", "Author") .WithMany("SubAnswers") .HasForeignKey("AuthorId") .HasConstraintName("FK__SubAnswer__Autho__1CBC4616"); @@ -1691,7 +1717,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("VNH.Domain.Topic", b => { - b.HasOne("VNH.Domain.UserShort", "Author") + b.HasOne("VNH.Domain.User", "Author") .WithMany("Topics") .HasForeignKey("AuthorId") .HasConstraintName("FK__Topic__AuthorId__05D8E0BE"); @@ -1815,7 +1841,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("TopicDetails"); }); - modelBuilder.Entity("VNH.Domain.UserShort", b => + modelBuilder.Entity("VNH.Domain.User", b => { b.Navigation("AnswerVotes"); diff --git a/VNH.Infrastructure/Presenters/ChatSignalR.cs b/VNH.Infrastructure/Presenters/ChatSignalR.cs index a12adf4..7024b57 100644 --- a/VNH.Infrastructure/Presenters/ChatSignalR.cs +++ b/VNH.Infrastructure/Presenters/ChatSignalR.cs @@ -8,14 +8,20 @@ public class ChatSignalR : Hub { public async Task SendComment(CommentPostDto comment) { - // Broadcast the comment to all connected clients + // Broadcast the subAnswer to all connected clients await Clients.All.SendAsync("ReceiveComment", comment); } public async Task SendAnswer(AnswerQuestionDto comment) { - await Clients.All.SendAsync("ReceiveAnswer", comment); } + + //public async Task SendSubAnswer(List subAnswer) + //{ + // await Clients.All.SendAsync("ReceiveSubAnswer", subAnswer); + //} + + } } diff --git a/VNH.Infrastructure/VNH.Infrastructure.csproj b/VNH.Infrastructure/VNH.Infrastructure.csproj index 7e052ea..24a64b5 100644 --- a/VNH.Infrastructure/VNH.Infrastructure.csproj +++ b/VNH.Infrastructure/VNH.Infrastructure.csproj @@ -8,6 +8,7 @@ + diff --git a/VNH.WebAPi/Controllers/AccountController.cs b/VNH.WebAPi/Controllers/AccountController.cs index 33cb6f5..1335e5b 100644 --- a/VNH.WebAPi/Controllers/AccountController.cs +++ b/VNH.WebAPi/Controllers/AccountController.cs @@ -36,7 +36,7 @@ public async Task Login([FromBody] LoginRequest request) var result = await _account.Authenticate(request); if (!result.IsSuccessed) { - return BadRequest(result); + return Ok(result); } var userPrincipal = _account.ValidateToken(result.ResultObj); var authProperties = new AuthenticationProperties @@ -266,7 +266,7 @@ public async Task EmailConfirm(string numberConfirm) public async Task ForgetPassword([FromQuery] string email) { var result = await _account.ForgetPassword(email); - return result.IsSuccessed ? Ok(result) : BadRequest(result); + return Ok(result); } [HttpGet("ForgetPassword/ConfirmCode")] @@ -281,7 +281,7 @@ public async Task ConfirmCode([FromQuery] string email) public async Task ResetPassword(ResetPassDto resetPass) { var result = await _account.ResetPassword(resetPass); - return result.IsSuccessed ? Ok(result) : BadRequest(result); + return Ok(result); } diff --git a/VNH.WebAPi/Controllers/AnswerController.cs b/VNH.WebAPi/Controllers/AnswerController.cs index 1862dc0..17d1bbd 100644 --- a/VNH.WebAPi/Controllers/AnswerController.cs +++ b/VNH.WebAPi/Controllers/AnswerController.cs @@ -48,7 +48,7 @@ public async Task UpdateAnswer(AnswerQuestionDto answer) var result = await _answerService.UpdateAnswer(answer); return result is null ? BadRequest(result) : Ok(result); } - [HttpDelete] + [HttpDelete("delete")] [Authorize] public async Task DeleteAnswer(string idAnswer) { @@ -84,7 +84,7 @@ public async Task UpdateSubAnswer(SubAnswerQuestionDto subAnswer) } - [HttpDelete] + [HttpDelete("DeleteSub")] [Authorize] public async Task DeleteSubAnswer(string idSubAnswer) { @@ -97,14 +97,34 @@ public async Task DeleteSubAnswer(string idSubAnswer) return result is null ? BadRequest(result) : Ok(result); } + [HttpPost("Confirm")] + [Authorize] + public async Task ConfirmAnswer(AnswerFpkDto answer) + { + var id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; + if(id == answer.QuestionUserId) + { + var result = await _answerService.ConfirmedByQuestioner(answer.AnswerId); + return Ok(result); + } + return Ok(); + + } [HttpPost("Vote")] [Authorize] - public async Task Vote([FromForm] AnswerFpkDto answerFpk) + public async Task Vote(AnswerFpkDto answer) { - var result = await _answerService.ConfirmOrNoConfirm(answerFpk); - return result is null ? BadRequest(result) : Ok(result); + var result = await _answerService.VoteConfirmByUser(answer); + return Ok(result); } + [HttpGet("GetMyVote")] + [Authorize] + public async Task GetVote(string answerId, string userId) + { + var result = await _answerService.GetMyVote(answerId, userId); + return Ok(result); + } } } diff --git a/VNH.WebAPi/Controllers/DocumentController.cs b/VNH.WebAPi/Controllers/DocumentController.cs index 8f52516..0d80377 100644 --- a/VNH.WebAPi/Controllers/DocumentController.cs +++ b/VNH.WebAPi/Controllers/DocumentController.cs @@ -52,7 +52,7 @@ public async Task Detail(string id) return result is null ? BadRequest(result) : Ok(result); } - [HttpDelete] + [HttpDelete("Delete")] public async Task Delete(string Id) { var result = await _documentService.Delete(Id, User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""); @@ -67,9 +67,6 @@ public async Task GetSaveDocs([FromForm] DocumentFpkDto docsFpk) return result is null ? BadRequest(result) : Ok(result); } - - - [HttpPost("Save")] [Authorize] public async Task Save([FromForm] DocumentFpkDto docsFpk) @@ -78,7 +75,12 @@ public async Task Save([FromForm] DocumentFpkDto docsFpk) return result is null ? BadRequest(result) : Ok(result); } - + [HttpGet("Search")] + public async Task Search(string keyWord) + { + var result = await _documentService.Search(keyWord); + return !result.IsSuccessed ? BadRequest(result) : Ok(result); + } } } diff --git a/VNH.WebAPi/Controllers/NewsController.cs b/VNH.WebAPi/Controllers/NewsController.cs new file mode 100644 index 0000000..7a939e8 --- /dev/null +++ b/VNH.WebAPi/Controllers/NewsController.cs @@ -0,0 +1,35 @@ +using Microsoft.AspNetCore.Mvc; +using VNH.Application.Interfaces.Catalog.NewsHistory; +using VNH.Domain; + +namespace VNH.WebAPi.Controllers +{ + [Route("[controller]")] + [ApiController] + public class NewsController : ControllerBase + { + private readonly INewsService _newsService; + public NewsController(INewsService newsService) { + _newsService = newsService; + } + + [HttpPost] + public async Task CrawlNews(string? url = "https://danviet.vn/lich-su-viet-nam.html") + { + var result = await _newsService.CrawlNews(url); + if (result.IsSuccessed) + { + result.Message = "Có " + result.ResultObj + " bản tin được cập nhập"; + } + return Ok(result); + } + + [HttpGet] + public async Task GetNews() + { + var result = await _newsService.GetNews(); + return Ok(result); + } + + } +} diff --git a/VNH.WebAPi/Controllers/PostController.cs b/VNH.WebAPi/Controllers/PostController.cs index cda3bba..e574814 100644 --- a/VNH.WebAPi/Controllers/PostController.cs +++ b/VNH.WebAPi/Controllers/PostController.cs @@ -1,11 +1,9 @@ -using Azure; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using VNH.Application.DTOs.Catalog.Posts; -using VNH.Application.Interfaces.Catalog.Chats; +using VNH.Application.DTOs.Common.ResponseNotification; using VNH.Application.Interfaces.Posts; -using VNH.Domain; namespace VNH.WebAPi.Controllers { @@ -14,7 +12,6 @@ namespace VNH.WebAPi.Controllers public class PostController : ControllerBase { private readonly IPostService _postService; - private readonly ICommentService _commentService; public PostController(IPostService postService) { _postService = postService; @@ -26,8 +23,18 @@ public async Task Index() var result = await _postService.GetAll(); return result is null ? BadRequest(result) : Ok(result); } - - + [HttpGet("DiscoverMobile")] + public async Task IndexMobile() + { + var result = await _postService.GetAllMobile(); + return result is null ? BadRequest(result) : Ok(result); + } + [HttpGet("RandomArticle")] + public async Task RandomPost(int quantity = 0) + { + var result = await _postService.GetRandomPost(quantity); + return result is null ? BadRequest(result) : Ok(result); + } [HttpPost] [Authorize] [Consumes("multipart/form-data")] @@ -53,14 +60,14 @@ public async Task Detail(string id) return result is null ? BadRequest(result) : Ok(result); } - [HttpDelete] + [HttpDelete("Delete")] public async Task Delete(string Id) { var result = await _postService.Delete(Id, User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""); return result is null ? BadRequest(result) : Ok(result); } - [HttpDelete("delete")] + [HttpDelete("Remove")] [Authorize(Roles = "admin")] public async Task DeleteAdmin(string Id) { @@ -73,6 +80,7 @@ public async Task GetLikePost([FromQuery] PostFpkDto postFpk) var result = await _postService.GetLike(postFpk); return result is null ? BadRequest(result) : Ok(result); } + [HttpPost("Like")] [Authorize] public async Task Like([FromForm] PostFpkDto postFpk) @@ -87,7 +95,7 @@ public async Task GetSavePost([FromQuery] PostFpkDto postFpk) var result = await _postService.GetSave(postFpk); return result is null ? BadRequest(result) : Ok(result); } - [HttpGet()] + [HttpGet("MyPostSaved")] [Authorize] public async Task GetMyPostSaved() { @@ -117,7 +125,7 @@ public async Task Save([FromForm] PostFpkDto postFpk) public async Task Report([FromBody] ReportPostDto reportPostDto) { var result = await _postService.ReportPost(reportPostDto); - return result is null ? BadRequest(result) : Ok(result); + return !result.IsSuccessed ? BadRequest(result) : Ok(result); } [HttpGet("Report")] @@ -125,7 +133,7 @@ public async Task Report([FromBody] ReportPostDto reportPostDto) public async Task GetReport() { var result = await _postService.GetReport(); - return result is null ? BadRequest(result) : Ok(result); + return !result.IsSuccessed ? BadRequest(result) : Ok(result); } [HttpGet("FindByTag")] public async Task GetPostByTag(string tag) @@ -133,6 +141,12 @@ public async Task GetPostByTag(string tag) var result = await _postService.GetPostByTag(tag); return result is null ? BadRequest(result) : Ok(result); } + [HttpGet("Search")] + public async Task Search([FromQuery] string keyWord) + { + var result = await _postService.SearchPosts(keyWord); + return result is null ? BadRequest(result) : Ok(result); + } [HttpGet("Chat")] public async Task GetComments(string PostId) { @@ -170,5 +184,19 @@ public async Task DeleteComment(string idComment) var result = await _postService.DeteleComment(idComment); return result is null ? BadRequest(result) : Ok(result); } + [HttpGet("Chat/NumberComment")] + public async Task GetCommentPost(string PostId) + { + var result = await _postService.GetComment(PostId); + var numberResult = new ApiSuccessResult(result.ResultObj.Count); + return numberResult is null ? BadRequest(numberResult) : Ok(numberResult); + } + + [HttpGet("FindByTopic")] + public async Task FindByTopic(string TopicName) + { + var result = await _postService.FindByTopic(TopicName); + return result is null ? BadRequest(result) : Ok(result); + } } } diff --git a/VNH.WebAPi/Controllers/QuestionController.cs b/VNH.WebAPi/Controllers/QuestionController.cs index 137d0d4..d37bbcc 100644 --- a/VNH.WebAPi/Controllers/QuestionController.cs +++ b/VNH.WebAPi/Controllers/QuestionController.cs @@ -4,8 +4,6 @@ using VNH.Application.DTOs.Catalog.Forum.Question; using VNH.Application.DTOs.Catalog.Posts; using VNH.Application.Interfaces.Catalog.Forum; -using VNH.Application.Interfaces.Posts; -using VNH.Infrastructure.Implement.Catalog.Posts; namespace VNH.WebAPi.Controllers { @@ -22,8 +20,6 @@ public QuestionController(IQuestionService questionService) _questionService = questionService; } - - [HttpPost] [Authorize] [Consumes("multipart/form-data")] @@ -33,8 +29,6 @@ public async Task CreateQuestion([FromForm] CreateQuestionDto req return result is null ? BadRequest(result) : Ok(result); } - - [HttpPut] [Authorize] [Consumes("multipart/form-data")] @@ -44,15 +38,23 @@ public async Task UpdateQuestion([FromForm] CreateQuestionDto req return result == null ? BadRequest(result) : Ok(result); } - [HttpGet("{id}")] public async Task Detail(string id) { var result = await _questionService.Detail(id); - return result is null ? BadRequest(result) : Ok(result); + if(result.IsSuccessed) + return Ok(result); + return BadRequest(result); } - + [HttpGet("Detail")] + public async Task SubDetail(string subId) + { + var result = await _questionService.SubDetail(subId); + if(result.IsSuccessed) + return Ok(result); + return BadRequest(result); + } [HttpGet] public async Task Index() @@ -61,17 +63,28 @@ public async Task Index() return result is null ? BadRequest(result) : Ok(result); } - [HttpDelete] + [HttpDelete("Delete")] public async Task Delete(string Id) { var result = await _questionService.Delete(Id, User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""); return result is null ? BadRequest(result) : Ok(result); } - - + [HttpPost("Like")] + [Authorize] + public async Task Like([FromForm] QuestionFpkDto questionFpk) + { + var result = await _questionService.AddOrUnLikeQuestion(questionFpk); + return result is null ? BadRequest(result) : Ok(result); + } + [HttpGet("Like")] + public async Task GetLikePost([FromQuery] QuestionFpkDto questionFpk) + { + var result = await _questionService.GetLike(questionFpk); + return result is null ? BadRequest(result) : Ok(result); + } [HttpGet("Save")] [Authorize] - public async Task GetSaveQuestion([FromForm] QuestionFpkDto questionFpk) + public async Task GetSaveQuestion([FromQuery] QuestionFpkDto questionFpk) { var result = await _questionService.GetSave(questionFpk); return result is null ? BadRequest(result) : Ok(result); @@ -83,8 +96,43 @@ public async Task Save([FromForm] QuestionFpkDto questionFpk) var result = await _questionService.AddOrRemoveSaveQuestion(questionFpk); return result is null ? BadRequest(result) : Ok(result); } + [HttpGet("MyQuestionSaved")] + [Authorize] + public async Task GetMyQuestionSaved() + { + var id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""; + var result = await _questionService.GetMyQuestionSaved(id); + return result is null ? BadRequest(result) : Ok(result); + } + [HttpGet("MyQuestion")] + [Authorize] + public async Task GetMyQuestion() + { + var id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? ""; + var result = await _questionService.GetMyQuestion(id); + return result is null ? BadRequest(result) : Ok(result); + } + [HttpPost("Report")] + [Authorize] + public async Task Report([FromBody] ReportQuestionDto reportquestionDto) + { + var result = await _questionService.ReportQuestion(reportquestionDto); + return result is null ? BadRequest(result) : Ok(result); + } - + [HttpGet("Report")] + [Authorize(Roles = "admin, sensor")] + public async Task GetReport() + { + var result = await _questionService.GetReport(); + return result is null ? BadRequest(result) : Ok(result); + } + [HttpGet("Search")] + public async Task Search([FromQuery] string keyWord) + { + var result = await _questionService.SearchQuestions(keyWord); + return result is null ? BadRequest(result) : Ok(result); + } [HttpGet("AllTag")] public async Task GetAllTag( int numberTag) { diff --git a/VNH.WebAPi/Controllers/TopicController.cs b/VNH.WebAPi/Controllers/TopicController.cs index b304a40..e8ed2c6 100644 --- a/VNH.WebAPi/Controllers/TopicController.cs +++ b/VNH.WebAPi/Controllers/TopicController.cs @@ -20,44 +20,34 @@ public TopicController(ITopicService topicService) { public async Task GetAllTopic() { var result = await _topicService.GetAllTopic(); - if (!result.IsSuccessed) - { - return BadRequest(result); - } - return Ok(result); + return result is null ? BadRequest(result) : Ok(result); + } + [HttpGet("GetById")] + public async Task GetById(string idTopic) + { + var result = await _topicService.GetById(idTopic); + return result is null ? BadRequest(result) : Ok(result); } [HttpPost] [Authorize] public async Task CreateTopic(string topic) { var result = await _topicService.CreateTopic(topic, User.Identity.Name); - if (!result.IsSuccessed) - { - return BadRequest(result); - } - return Ok(result); + return result is null ? BadRequest(result) : Ok(result); } [HttpPut] [Authorize] public async Task UpdateTopic(Guid topicId ,string topic) { var result = await _topicService.UpdateTopic(topicId, topic); - if (!result.IsSuccessed) - { - return BadRequest(result); - } - return Ok(result); + return result is null ? BadRequest(result) : Ok(result); } [HttpDelete] [Authorize] public async Task DeleteTopic(Guid topicId ) { var result = await _topicService.DeleteTopic(topicId); - if (!result.IsSuccessed) - { - return BadRequest(result); - } - return Ok(result); + return result is null ? BadRequest(result) : Ok(result); } } diff --git a/VNH.WebAPi/Program.cs b/VNH.WebAPi/Program.cs index 48aff8a..5c9be14 100644 --- a/VNH.WebAPi/Program.cs +++ b/VNH.WebAPi/Program.cs @@ -6,6 +6,10 @@ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.Extensions.Options; using VNH.Infrastructure.Presenters; +using Microsoft.Extensions.Configuration; +using VNH.Infrastructure.Presenters.Migrations; +using Microsoft.EntityFrameworkCore; +using VNH.Application.Interfaces.Catalog.Forum; namespace VNH.WebAPi { @@ -17,6 +21,13 @@ public static void Main(string[] args) // Add services to the container. // Add DI in other layer + var connectionString = builder.Environment.IsDevelopment() + ? builder.Configuration.GetConnectionString("LocalDataConnect") + : builder.Configuration.GetConnectionString("DataConnect"); + builder.Services.AddDbContext(options => + { + options.UseSqlServer(connectionString); + }); builder.Services.AddInfrastructure(builder.Configuration); builder.Services.AddApplication(); @@ -118,11 +129,9 @@ public static void Main(string[] args) { app.Logger.LogInformation("Request RemoteIp: {RemoteIpAddress}", context.Connection.RemoteIpAddress); - await next(context); }); - app.UseStaticFiles(); app.UseForwardedHeaders(); diff --git a/VNH.WebAPi/VNH.WebAPi.csproj b/VNH.WebAPi/VNH.WebAPi.csproj index cc3c28a..3e5f825 100644 --- a/VNH.WebAPi/VNH.WebAPi.csproj +++ b/VNH.WebAPi/VNH.WebAPi.csproj @@ -25,6 +25,7 @@ + diff --git a/VNH.WebAPi/appsettings.json b/VNH.WebAPi/appsettings.json index 8d5d4dd..8c1fa3c 100644 --- a/VNH.WebAPi/appsettings.json +++ b/VNH.WebAPi/appsettings.json @@ -11,11 +11,9 @@ "Issuer": "https://webapi.tedu.com.vn" }, "ConnectionStrings": { - "DataConnect": "Data Source=.;Initial Catalog=VietNamHistory_2;Integrated Security=True;Encrypt=true;TrustServerCertificate=true;" + "LocalDataConnect": "Data Source=.;Initial Catalog=VietNamHistory;Integrated Security=True;Encrypt=true;TrustServerCertificate=true;", + "DataConnect": "Data Source=SQL5106.site4now.net;Initial Catalog=db_aa121e_vuanhpham25;User Id=db_aa121e_vuanhpham25_admin;Password=30102002Mai" }, - //"ConnectionStrings": { - // "DataConnect": "Data Source=SQL5111.site4now.net;Initial Catalog=db_aa121e_vuanhpham25;User Id=db_aa121e_vuanhpham25_admin;Password=30102002Mai" - //}, "MailSettings": { "Mail": "xuannhat1932002@gmail.com", diff --git a/VNH.WebAPi/wwwroot/Images/0bfff704-5419-44b7-890a-f0eae7d0a3a5.jpg b/VNH.WebAPi/wwwroot/Images/0bfff704-5419-44b7-890a-f0eae7d0a3a5.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/0bfff704-5419-44b7-890a-f0eae7d0a3a5.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/1377b41a-8bee-4600-9a8a-763a087b7f93.pdf b/VNH.WebAPi/wwwroot/Images/1377b41a-8bee-4600-9a8a-763a087b7f93.pdf deleted file mode 100644 index 53bdb15..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/1377b41a-8bee-4600-9a8a-763a087b7f93.pdf and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/1b9c3f74-5489-40ba-81d7-7ef5f213d933.pdf b/VNH.WebAPi/wwwroot/Images/1b9c3f74-5489-40ba-81d7-7ef5f213d933.pdf deleted file mode 100644 index e549845..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/1b9c3f74-5489-40ba-81d7-7ef5f213d933.pdf and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/23e731c7-b422-4d75-88d7-e9385b25516c.docx b/VNH.WebAPi/wwwroot/Images/23e731c7-b422-4d75-88d7-e9385b25516c.docx deleted file mode 100644 index 7d53182..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/23e731c7-b422-4d75-88d7-e9385b25516c.docx and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/2ef22127-d152-4a81-a543-5c84b0086487.jpg b/VNH.WebAPi/wwwroot/Images/2ef22127-d152-4a81-a543-5c84b0086487.jpg new file mode 100644 index 0000000..2a93a02 Binary files /dev/null and b/VNH.WebAPi/wwwroot/Images/2ef22127-d152-4a81-a543-5c84b0086487.jpg differ diff --git a/VNH.WebAPi/wwwroot/Images/388a0d16-aa7f-43b6-844b-1e54239a4dde.jpg b/VNH.WebAPi/wwwroot/Images/388a0d16-aa7f-43b6-844b-1e54239a4dde.jpg deleted file mode 100644 index 3bcd629..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/388a0d16-aa7f-43b6-844b-1e54239a4dde.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/38da0237-684d-49da-8686-34dcd8cf136a.docx b/VNH.WebAPi/wwwroot/Images/38da0237-684d-49da-8686-34dcd8cf136a.docx deleted file mode 100644 index 5f0680c..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/38da0237-684d-49da-8686-34dcd8cf136a.docx and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/480bd1c7-64e6-4b48-bd03-e3ec56d8b12a.jpg b/VNH.WebAPi/wwwroot/Images/480bd1c7-64e6-4b48-bd03-e3ec56d8b12a.jpg deleted file mode 100644 index 38c6ca6..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/480bd1c7-64e6-4b48-bd03-e3ec56d8b12a.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/579f864d-a6a8-415c-b09d-9d72c1f568f8.png b/VNH.WebAPi/wwwroot/Images/579f864d-a6a8-415c-b09d-9d72c1f568f8.png deleted file mode 100644 index 981e50a..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/579f864d-a6a8-415c-b09d-9d72c1f568f8.png and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/5d1cb295-0303-407d-8503-c6cc299ccaba.webp b/VNH.WebAPi/wwwroot/Images/5d1cb295-0303-407d-8503-c6cc299ccaba.webp deleted file mode 100644 index 0ad6320..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/5d1cb295-0303-407d-8503-c6cc299ccaba.webp and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/62a24386-c08f-4fb6-88e7-4d3db800d338.docx b/VNH.WebAPi/wwwroot/Images/62a24386-c08f-4fb6-88e7-4d3db800d338.docx deleted file mode 100644 index 5f0680c..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/62a24386-c08f-4fb6-88e7-4d3db800d338.docx and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/90999f1f-7bc0-4299-9e15-515b4b666e80.jpg b/VNH.WebAPi/wwwroot/Images/90999f1f-7bc0-4299-9e15-515b4b666e80.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/90999f1f-7bc0-4299-9e15-515b4b666e80.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/9213abc8-f92e-45c6-b6a4-ba26ab11bf8f.jpg b/VNH.WebAPi/wwwroot/Images/9213abc8-f92e-45c6-b6a4-ba26ab11bf8f.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/9213abc8-f92e-45c6-b6a4-ba26ab11bf8f.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/9311869c-0250-4454-9f23-f0008ff1df25.jpg b/VNH.WebAPi/wwwroot/Images/9311869c-0250-4454-9f23-f0008ff1df25.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/9311869c-0250-4454-9f23-f0008ff1df25.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/9537cf85-db92-446f-a396-f22912ece15b.jpg b/VNH.WebAPi/wwwroot/Images/9537cf85-db92-446f-a396-f22912ece15b.jpg deleted file mode 100644 index cde6010..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/9537cf85-db92-446f-a396-f22912ece15b.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/722cc51c-e4a3-4bfc-ac5c-9f7708cba3ba.jpg b/VNH.WebAPi/wwwroot/Images/afb13b9f-6a1b-47c0-bc27-5f116cce4952.jpg similarity index 100% rename from VNH.WebAPi/wwwroot/Images/722cc51c-e4a3-4bfc-ac5c-9f7708cba3ba.jpg rename to VNH.WebAPi/wwwroot/Images/afb13b9f-6a1b-47c0-bc27-5f116cce4952.jpg diff --git a/VNH.WebAPi/wwwroot/Images/b4e1a2c8-cb30-4e3d-9b3b-b1c5434a47c7.pdf b/VNH.WebAPi/wwwroot/Images/b4e1a2c8-cb30-4e3d-9b3b-b1c5434a47c7.pdf new file mode 100644 index 0000000..1c3ff06 Binary files /dev/null and b/VNH.WebAPi/wwwroot/Images/b4e1a2c8-cb30-4e3d-9b3b-b1c5434a47c7.pdf differ diff --git a/VNH.WebAPi/wwwroot/Images/b88dd7ce-cd18-4641-a7ee-a80d22ef19bd.jpg b/VNH.WebAPi/wwwroot/Images/b88dd7ce-cd18-4641-a7ee-a80d22ef19bd.jpg deleted file mode 100644 index 78ce2a9..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/b88dd7ce-cd18-4641-a7ee-a80d22ef19bd.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/ba338d23-206a-4860-8250-df454edaa5a9.jpg b/VNH.WebAPi/wwwroot/Images/ba338d23-206a-4860-8250-df454edaa5a9.jpg deleted file mode 100644 index d38e010..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/ba338d23-206a-4860-8250-df454edaa5a9.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/c1719ecf-7a06-416d-89ab-6b33c0ba3aca.pdf b/VNH.WebAPi/wwwroot/Images/c1719ecf-7a06-416d-89ab-6b33c0ba3aca.pdf new file mode 100644 index 0000000..1c3ff06 Binary files /dev/null and b/VNH.WebAPi/wwwroot/Images/c1719ecf-7a06-416d-89ab-6b33c0ba3aca.pdf differ diff --git a/VNH.WebAPi/wwwroot/Images/c5fa9e72-b3dc-4602-b364-499a52fd4eb4.jpg b/VNH.WebAPi/wwwroot/Images/c5fa9e72-b3dc-4602-b364-499a52fd4eb4.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/c5fa9e72-b3dc-4602-b364-499a52fd4eb4.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/cfa7441c-2dba-40ec-96f1-3eab8d75038a.jpg b/VNH.WebAPi/wwwroot/Images/cfa7441c-2dba-40ec-96f1-3eab8d75038a.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/cfa7441c-2dba-40ec-96f1-3eab8d75038a.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/0b8dcf23-280d-42a4-a5e9-66c03c3ec100.jpg b/VNH.WebAPi/wwwroot/Images/d04f3cf6-5745-420c-a482-d26e5f0ba49c.jpg similarity index 100% rename from VNH.WebAPi/wwwroot/Images/0b8dcf23-280d-42a4-a5e9-66c03c3ec100.jpg rename to VNH.WebAPi/wwwroot/Images/d04f3cf6-5745-420c-a482-d26e5f0ba49c.jpg diff --git a/VNH.WebAPi/wwwroot/Images/d150588a-521f-4566-b275-fa9672ca6c17.jpg b/VNH.WebAPi/wwwroot/Images/d150588a-521f-4566-b275-fa9672ca6c17.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/d150588a-521f-4566-b275-fa9672ca6c17.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/d98e15bc-cfd7-4b01-a66a-5be7ac314eea.png b/VNH.WebAPi/wwwroot/Images/d98e15bc-cfd7-4b01-a66a-5be7ac314eea.png deleted file mode 100644 index 981e50a..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/d98e15bc-cfd7-4b01-a66a-5be7ac314eea.png and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/dbba024f-d3d5-48cd-bc78-39f29699504a.png b/VNH.WebAPi/wwwroot/Images/dbba024f-d3d5-48cd-bc78-39f29699504a.png new file mode 100644 index 0000000..5858315 Binary files /dev/null and b/VNH.WebAPi/wwwroot/Images/dbba024f-d3d5-48cd-bc78-39f29699504a.png differ diff --git a/VNH.WebAPi/wwwroot/Images/dd42bbfc-570f-43ee-b805-60037ad12a88.jpg b/VNH.WebAPi/wwwroot/Images/dd42bbfc-570f-43ee-b805-60037ad12a88.jpg deleted file mode 100644 index 8e3a875..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/dd42bbfc-570f-43ee-b805-60037ad12a88.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/e5b0ceaf-0a06-4ecc-9178-9779bc0c5291.pdf b/VNH.WebAPi/wwwroot/Images/e5b0ceaf-0a06-4ecc-9178-9779bc0c5291.pdf deleted file mode 100644 index 53bdb15..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/e5b0ceaf-0a06-4ecc-9178-9779bc0c5291.pdf and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/eb5c7df6-3116-4a2a-afa5-9850591a5180.jpg b/VNH.WebAPi/wwwroot/Images/eb5c7df6-3116-4a2a-afa5-9850591a5180.jpg deleted file mode 100644 index 94ac5d8..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/eb5c7df6-3116-4a2a-afa5-9850591a5180.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/f3e712b0-0cae-45ea-a125-b76b4f755182.jpg b/VNH.WebAPi/wwwroot/Images/f3e712b0-0cae-45ea-a125-b76b4f755182.jpg deleted file mode 100644 index d38e010..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/f3e712b0-0cae-45ea-a125-b76b4f755182.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/f4ea89c2-8b6f-408a-a1d8-17e24e71ed30.docx b/VNH.WebAPi/wwwroot/Images/f4ea89c2-8b6f-408a-a1d8-17e24e71ed30.docx deleted file mode 100644 index 5f0680c..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/f4ea89c2-8b6f-408a-a1d8-17e24e71ed30.docx and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/fc5ab291-a20a-46ef-8de0-0e7466a15b42.jpg b/VNH.WebAPi/wwwroot/Images/fc5ab291-a20a-46ef-8de0-0e7466a15b42.jpg new file mode 100644 index 0000000..4092aa0 Binary files /dev/null and b/VNH.WebAPi/wwwroot/Images/fc5ab291-a20a-46ef-8de0-0e7466a15b42.jpg differ diff --git a/VNH.WebAPi/wwwroot/Images/fd4345ef-b792-4b9d-a198-7d9db0d0f457.jpg b/VNH.WebAPi/wwwroot/Images/fd4345ef-b792-4b9d-a198-7d9db0d0f457.jpg deleted file mode 100644 index 3bcd629..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/fd4345ef-b792-4b9d-a198-7d9db0d0f457.jpg and /dev/null differ diff --git a/VNH.WebAPi/wwwroot/Images/ffd3abf2-ab40-4534-b5c9-ee5549ebd516.jpg b/VNH.WebAPi/wwwroot/Images/ffd3abf2-ab40-4534-b5c9-ee5549ebd516.jpg deleted file mode 100644 index 56b295c..0000000 Binary files a/VNH.WebAPi/wwwroot/Images/ffd3abf2-ab40-4534-b5c9-ee5549ebd516.jpg and /dev/null differ