72 lines
1.8 KiB
C#
72 lines
1.8 KiB
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Entities.DTO;
|
|
|
|
namespace Entities.Contracts
|
|
{
|
|
[Table("exam_questions")]
|
|
public class ExamQuestion
|
|
{
|
|
[Key]
|
|
[Column("id")]
|
|
public Guid Id { get; set; }
|
|
|
|
[Column("title")]
|
|
[MaxLength(1024)]
|
|
public string? Title { get; set; }
|
|
|
|
[Column("question_id")]
|
|
public Guid? QuestionId { get; set; }
|
|
[ForeignKey(nameof(QuestionId))]
|
|
public virtual Question? Question { get; set; }
|
|
|
|
[Column("description")]
|
|
public Guid? QuestionContextId { get; set; }
|
|
[ForeignKey(nameof(QuestionContextId))]
|
|
public virtual QuestionContext? QuestionContext { get; set; }
|
|
|
|
[Required]
|
|
[Column("question_number")]
|
|
public byte Index { get; set; }
|
|
|
|
[Column("sequence")]
|
|
public string Sequence { get; set; } = string.Empty;
|
|
|
|
[Column("parent_question_group_id")]
|
|
public Guid? ParentExamQuestionId { get; set; }
|
|
[ForeignKey(nameof(ParentExamQuestionId))]
|
|
public virtual ExamQuestion? ParentExamQuestion { get; set; }
|
|
|
|
public Guid QuestionTypeId { get;set; }
|
|
[ForeignKey(nameof(QuestionTypeId))]
|
|
public virtual QuestionType Type { get; set; }
|
|
|
|
[Column("created_at")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[Column("exam_struct_type")]
|
|
public ExamStructType ExamStructType { get; set; }
|
|
|
|
[Column("score")]
|
|
public float? Score { get; set; }
|
|
|
|
[Column("deleted")]
|
|
public bool IsDeleted { get; set; }
|
|
|
|
|
|
public virtual Exam? Exam { get; set; }
|
|
|
|
|
|
[InverseProperty(nameof(SubmissionDetail.ExamQuestion))]
|
|
public virtual ICollection<SubmissionDetail> SubmissionDetails { get; set; }
|
|
[InverseProperty(nameof(ParentExamQuestion))]
|
|
public virtual ICollection<ExamQuestion> ChildExamQuestions { get; set; } = new List<ExamQuestion>();
|
|
|
|
public ExamQuestion()
|
|
{
|
|
Id = Guid.NewGuid();
|
|
SubmissionDetails = new HashSet<SubmissionDetail>();
|
|
}
|
|
}
|
|
}
|