AsiignmentStruct
This commit is contained in:
@@ -67,11 +67,11 @@ namespace Entities.Contracts
|
||||
ComputerScience, // 计算机科学
|
||||
}
|
||||
|
||||
public enum QuestionGroupState : byte
|
||||
public enum AssignmentStructType : byte
|
||||
{
|
||||
Standalone,
|
||||
Group,
|
||||
Subquestion
|
||||
Question,
|
||||
Struct,
|
||||
SubQuestion
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Entities.DTO;
|
||||
|
||||
namespace Entities.Contracts
|
||||
{
|
||||
@@ -53,7 +54,7 @@ namespace Entities.Contracts
|
||||
[ForeignKey(nameof(CreatorId))]
|
||||
public User Creator { get; set; }
|
||||
public ICollection<AssignmentClass> AssignmentClasses { get; set; }
|
||||
public AssignmentStruct ExamStruct { get; set; }
|
||||
public AssignmentQuestion ExamStruct { get; set; }
|
||||
public ICollection<AssignmentAttachment> AssignmentAttachments { get; set; }
|
||||
public ICollection<Submission> Submissions { get; set; }
|
||||
|
||||
|
@@ -18,23 +18,28 @@ namespace Entities.Contracts
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Column("question_id")]
|
||||
public Guid QuestionId { get; set; }
|
||||
public Guid? QuestionId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("group_id")]
|
||||
[ForeignKey("AssignmentGroup")]
|
||||
public Guid AssignmentStructId { get; set; }
|
||||
[Column("assignment")]
|
||||
[ForeignKey("Assignment")]
|
||||
public Guid? AssignmentId { get; set; }
|
||||
|
||||
[Column("title")]
|
||||
[MaxLength(1024)]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[Column("description")]
|
||||
public Guid? QuestionContextId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("question_number")]
|
||||
public byte Index { get; set; }
|
||||
|
||||
|
||||
[Column("parent_question_group_id")]
|
||||
public Guid? ParentAssignmentQuestionId { get; set; }
|
||||
|
||||
[Column("group_state")]
|
||||
public QuestionGroupState GroupState { get; set; } = QuestionGroupState.Standalone;
|
||||
public AssignmentStructType StructType { get; set; } = AssignmentStructType.Question;
|
||||
|
||||
[Column("created_at")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
@@ -42,13 +47,17 @@ namespace Entities.Contracts
|
||||
[Column("score")]
|
||||
public float? Score { get; set; }
|
||||
|
||||
|
||||
[Column("deleted")]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
|
||||
public Question Question { get; set; }
|
||||
public AssignmentStruct AssignmentStruct { get; set; }
|
||||
public Question? Question { get; set; }
|
||||
public Assignment? Assignment { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(QuestionContextId))]
|
||||
public QuestionContext? QuestionContext { get; set; }
|
||||
|
||||
public ICollection<SubmissionDetail> SubmissionDetails { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ParentAssignmentQuestionId))]
|
||||
|
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Entities.Contracts
|
||||
{
|
||||
[Table("assignment_group")]
|
||||
public class AssignmentStruct
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Column("assignment")]
|
||||
[ForeignKey("Assignment")]
|
||||
public Guid? AssignmentId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("title")]
|
||||
[MaxLength(65535)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column("descript")]
|
||||
[MaxLength(65535)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Column("layout")]
|
||||
public Layout Layout { get; set; }
|
||||
|
||||
[Column("total_points")]
|
||||
public float? Score { get; set; }
|
||||
|
||||
[Column("index")]
|
||||
public byte Index { get; set; }
|
||||
|
||||
[Column("parent_group")]
|
||||
public Guid? ParentStructId { get; set; }
|
||||
|
||||
[Column("deleted")]
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
|
||||
// Navigation Properties
|
||||
public Assignment? Assignment { get; set; }
|
||||
public AssignmentStruct? ParentStruct { get; set;}
|
||||
public ICollection<AssignmentStruct> ChildrenGroups { get; set; }
|
||||
public ICollection<AssignmentQuestion> AssignmentQuestions { get; set; }
|
||||
|
||||
|
||||
public AssignmentStruct()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
ChildrenGroups = new HashSet<AssignmentStruct>();
|
||||
AssignmentQuestions = new HashSet<AssignmentQuestion>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -24,8 +24,7 @@ namespace Entities.Contracts
|
||||
[MaxLength(65535)]
|
||||
public string? Answer { get; set; }
|
||||
|
||||
[Column("description")]
|
||||
public Guid? DescriptionId { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
[Column("type")]
|
||||
@@ -68,11 +67,6 @@ namespace Entities.Contracts
|
||||
[ForeignKey(nameof(CreatorId))]
|
||||
public User Creator { get; set; }
|
||||
|
||||
[ForeignKey(nameof(DescriptionId))]
|
||||
public QuestionContext Description { get; set; }
|
||||
public Question? ParentQuestion { get; set; }
|
||||
public ICollection<Question>? ChildrenQuestion { get; set; }
|
||||
|
||||
[ForeignKey(nameof(KeyPointId))]
|
||||
public KeyPoint? KeyPoint { get; set; }
|
||||
[ForeignKey(nameof(LessonId))]
|
||||
@@ -84,7 +78,6 @@ namespace Entities.Contracts
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
AssignmentQuestions = new HashSet<AssignmentQuestion>();
|
||||
ChildrenQuestion = new HashSet<Question>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,13 +13,13 @@ namespace Entities.Contracts
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[InverseProperty(nameof(Question.Description))]
|
||||
public ICollection<Question> Questions { get; set; } = new List<Question>();
|
||||
[InverseProperty(nameof(AssignmentQuestion.QuestionContext))]
|
||||
public ICollection<AssignmentQuestion>? Questions { get; set; } = new List<AssignmentQuestion>();
|
||||
|
||||
|
||||
public QuestionContext()
|
||||
{
|
||||
Questions = new HashSet<Question>();
|
||||
Questions = new HashSet<AssignmentQuestion>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,17 +9,19 @@ namespace Entities.DTO
|
||||
{
|
||||
public class AssignmentQuestionDto
|
||||
{
|
||||
public float Score { get; set; } = 0;
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public QuestionContextDto? Description { get; set; }
|
||||
|
||||
public byte Index { get; set; } = 0;
|
||||
public QuestionGroupState GroupState { get; set; } = QuestionGroupState.Standalone;
|
||||
|
||||
public float Score { get; set; } = 0;
|
||||
|
||||
public Layout Layout { get; set; } = Layout.horizontal;
|
||||
public AssignmentStructType StructType { get; set; } = AssignmentStructType.Question;
|
||||
|
||||
public AssignmentQuestionDto? ParentAssignmentQuestion { get; set; }
|
||||
public ICollection<AssignmentQuestionDto> ChildrenAssignmentQuestion { get; set; } = new List<AssignmentQuestionDto>();
|
||||
|
||||
|
||||
|
||||
public QuestionDto Question { get; set; }
|
||||
public QuestionDto? Question { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -8,25 +8,6 @@ using System.Xml.Serialization;
|
||||
|
||||
namespace Entities.DTO
|
||||
{
|
||||
|
||||
public class AssignmentStructDto
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public float Score { get; set; } = 0;
|
||||
public byte Index { get; set; } = 0;
|
||||
public Layout Layout { get; set; } = Layout.horizontal;
|
||||
|
||||
|
||||
|
||||
|
||||
public ICollection<AssignmentQuestionDto> AssignmentQuestions { get; set; } = new List<AssignmentQuestionDto>();
|
||||
|
||||
public AssignmentStructDto? ParentStruct { get; set; }
|
||||
public ICollection<AssignmentStructDto> ChildrenGroups { get; set; } = new List<AssignmentStructDto>();
|
||||
}
|
||||
|
||||
public class AssignmentDto
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
@@ -41,7 +22,7 @@ namespace Entities.DTO
|
||||
public DateTime DueDate { get; set; }
|
||||
public Guid CreatorId { get; set; }
|
||||
|
||||
public AssignmentStructDto ExamStruct { get; set; } = new AssignmentStructDto();
|
||||
public AssignmentQuestionDto ExamStruct { get; set; } = new AssignmentQuestionDto();
|
||||
}
|
||||
|
||||
public class AssignmentClassDto
|
||||
|
@@ -15,8 +15,6 @@ namespace Entities.DTO
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public QuestionContextDto? Description { get; set; }
|
||||
|
||||
public QuestionType Type { get; set; } = QuestionType.Unknown;
|
||||
|
||||
public string? Answer { get; set; } = string.Empty;
|
||||
|
Reference in New Issue
Block a user