86 lines
1.7 KiB
C#
86 lines
1.7 KiB
C#
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;
|
|
|
|
namespace Entities.Contracts
|
|
{
|
|
[Table("questions")]
|
|
public class Question
|
|
{
|
|
[Key]
|
|
[Column("id")]
|
|
public Guid Id { get; set; }
|
|
|
|
[Required]
|
|
[Column("title")]
|
|
[MaxLength(65535)]
|
|
public string Title { get; set; }
|
|
|
|
[Column("answer")]
|
|
[MaxLength(65535)]
|
|
public string? Answer { get; set; }
|
|
|
|
|
|
|
|
[Required]
|
|
[Column("type")]
|
|
[MaxLength(20)]
|
|
public QuestionType Type { get; set; } = QuestionType.Unknown;
|
|
|
|
[Column("difficulty_level")]
|
|
[MaxLength(10)]
|
|
public DifficultyLevel DifficultyLevel { get; set; } = DifficultyLevel.easy;
|
|
|
|
[Column("subject_area")]
|
|
public SubjectAreaEnum SubjectArea { get; set; } = SubjectAreaEnum.Unknown;
|
|
|
|
|
|
[Column("options")]
|
|
public string? Options { get; set; }
|
|
|
|
[Column("key_point")]
|
|
public Guid? KeyPointId { get; set; }
|
|
|
|
[Column("lesson")]
|
|
public Guid? LessonId { get; set; }
|
|
|
|
|
|
[Required]
|
|
[Column("created_by")]
|
|
public Guid CreatorId { get; set; }
|
|
|
|
[Column("created_at")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[Column("updated_at")]
|
|
public DateTime UpdatedAt { get; set; }
|
|
|
|
[Column("deleted")]
|
|
public bool IsDeleted { get; set; }
|
|
|
|
|
|
// Navigation Properties
|
|
[ForeignKey(nameof(CreatorId))]
|
|
public User Creator { get; set; }
|
|
|
|
[ForeignKey(nameof(KeyPointId))]
|
|
public KeyPoint? KeyPoint { get; set; }
|
|
[ForeignKey(nameof(LessonId))]
|
|
public Lesson? Lesson { get; set; }
|
|
|
|
public ICollection<AssignmentQuestion>? AssignmentQuestions { get; set; }
|
|
|
|
public Question()
|
|
{
|
|
Id = Guid.NewGuid();
|
|
AssignmentQuestions = new HashSet<AssignmentQuestion>();
|
|
}
|
|
}
|
|
|
|
|
|
}
|