Files
TechHelper/Entities/Contracts/User.cs
SpecialX ac900159ba
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
重构项目结构,移除Assignment相关功能,优化Submission模块
2025-10-09 18:57:28 +08:00

60 lines
1.7 KiB
C#

using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations.Schema;
namespace Entities.Contracts
{
public class User : IdentityUser<Guid>
{
public string? RefreshToken { get; set; }
public DateTime? RefreshTokenExpiryTime { get; set; }
public string? HomeAddress { get; set; }
public string? DisplayName { get; set; }
public UserRoles? Role { get; set; }
public Guid? TeachSubjectId { get; set; }
[ForeignKey(nameof(TeachSubjectId))]
public virtual Subject? TeachSubject { get; set; }
[Column("deleted")]
public bool IsDeleted { get; set; }
[InverseProperty(nameof(ClassUser.User))]
public virtual ICollection<ClassUser> UserInjoinedClass { get; set; }
//[InverseProperty(nameof(Question.Creator))]
//public virtual ICollection<Question> CreatedQuestions { get; set; }
[InverseProperty(nameof(Exam.Creator))]
public virtual ICollection<Exam> CreatedExams { get; set; }
[InverseProperty(nameof(SubmissionDetail.Student))]
public virtual ICollection<SubmissionDetail> SubmissionDetails { get; set; }
[InverseProperty(nameof(Submission.Student))]
public virtual ICollection<Submission> StudentSubmissions { get; set; }
[InverseProperty(nameof(Submission.Grader))]
public virtual ICollection<Submission> GradedSubmissions { get; set; }
public User()
{
Id = Guid.NewGuid();
SecurityStamp = Guid.NewGuid().ToString();
//CreatedQuestions = new HashSet<Question>();
UserInjoinedClass = new HashSet<ClassUser>();
CreatedExams = new HashSet<Exam>();
GradedSubmissions = new HashSet<Submission>();
StudentSubmissions = new HashSet<Submission>();
SubmissionDetails = new HashSet<SubmissionDetail>();
}
}
}