Files
TechHelper/Entities/Contracts/Assignment.cs
2025-05-23 19:03:00 +08:00

64 lines
1.5 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("assignments")]
public class Assignment
{
[Key]
[Column("id")]
public Guid Id { get; set; }
[Required]
[Column("title")]
[StringLength(255)]
public string Title { get; set; }
[Column("description")]
public string Description { get; set; }
[Required]
[Column("due_date")]
public DateTime DueDate { get; set; }
[Column("total_points")]
public decimal? TotalPoints { get; set; }
[Column("created_by")]
[ForeignKey("Creator")]
public Guid CreatedBy { 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
public User Creator { get; set; }
public ICollection<AssignmentClass> AssignmentClasses { get; set; }
public ICollection<AssignmentGroup> AssignmentGroups { get; set; }
public ICollection<AssignmentAttachment> AssignmentAttachments { get; set; }
public ICollection<Submission> Submissions { get; set; }
public Assignment()
{
Id = Guid.NewGuid();
Submissions = new HashSet<Submission>();
AssignmentGroups = new HashSet<AssignmentGroup>();
AssignmentClasses = new HashSet<AssignmentClass>();
AssignmentAttachments = new HashSet<AssignmentAttachment>();
}
}
}