Добавил домен

This commit is contained in:
2026-04-28 15:52:05 +03:00
parent fd94733873
commit 25d617639c
25 changed files with 349 additions and 0 deletions
@@ -0,0 +1,16 @@
namespace UniVerse.Domain.Entities;
public class Achievement
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public string? IconUrl { get; set; }
public int XpReward { get; set; }
public int CoinReward { get; set; }
public string? Condition { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public ICollection<UserAchievement> UserAchievements { get; set; } = new List<UserAchievement>();
}
@@ -0,0 +1,20 @@
using UniVerse.Domain.Enums;
namespace UniVerse.Domain.Entities;
public class CoinTransaction
{
public int Id { get; set; }
public int UserId { get; set; }
public int Amount { get; set; }
public CoinTransactionType Type { get; set; }
public int? ReviewId { get; set; }
public int? AchievementId { get; set; }
public string? Description { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public User User { get; set; } = null!;
public Review? Review { get; set; }
public Achievement? Achievement { get; set; }
}
@@ -0,0 +1,16 @@
namespace UniVerse.Domain.Entities;
public class Course
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public string? ExternalId { get; set; }
public bool IsSynced { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public ICollection<Lecture> Lectures { get; set; } = new List<Lecture>();
public ICollection<CourseTag> CourseTags { get; set; } = new List<CourseTag>();
}
@@ -0,0 +1,12 @@
namespace UniVerse.Domain.Entities;
public class CourseTag
{
public int Id { get; set; }
public int CourseId { get; set; }
public int TagId { get; set; }
// Navigation properties
public Course Course { get; set; } = null!;
public Tag Tag { get; set; } = null!;
}
@@ -0,0 +1,29 @@
using UniVerse.Domain.Enums;
namespace UniVerse.Domain.Entities;
public class Lecture
{
public int Id { get; set; }
public int CourseId { get; set; }
public int? TeacherId { get; set; }
public int? LocationId { get; set; }
public string Title { get; set; } = string.Empty;
public string? Description { get; set; }
public LectureFormat Format { get; set; } = LectureFormat.Offline;
public DateTime StartsAt { get; set; }
public DateTime EndsAt { get; set; }
public bool IsOpen { get; set; } = true;
public int MaxEnrollments { get; set; }
public string? ExternalId { get; set; }
public string? OnlineUrl { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public Course Course { get; set; } = null!;
public User? Teacher { get; set; }
public Location? Location { get; set; }
public ICollection<LectureEnrollment> Enrollments { get; set; } = new List<LectureEnrollment>();
public ICollection<Review> Reviews { get; set; } = new List<Review>();
}
@@ -0,0 +1,14 @@
namespace UniVerse.Domain.Entities;
public class LectureEnrollment
{
public int Id { get; set; }
public int LectureId { get; set; }
public int UserId { get; set; }
public bool Attended { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public Lecture Lecture { get; set; } = null!;
public User User { get; set; } = null!;
}
@@ -0,0 +1,15 @@
namespace UniVerse.Domain.Entities;
public class Location
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Building { get; set; }
public string? Room { get; set; }
public string? Address { get; set; }
public string? ExternalId { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public ICollection<Lecture> Lectures { get; set; } = new List<Lecture>();
}
@@ -0,0 +1,18 @@
namespace UniVerse.Domain.Entities;
public class RefreshToken
{
public int Id { get; set; }
public int UserId { get; set; }
public string Token { get; set; } = string.Empty;
public DateTime ExpiresAt { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime? RevokedAt { get; set; }
public bool IsExpired => DateTime.UtcNow >= ExpiresAt;
public bool IsRevoked => RevokedAt != null;
public bool IsActive => !IsRevoked && !IsExpired;
// Navigation properties
public User User { get; set; } = null!;
}
@@ -0,0 +1,24 @@
using UniVerse.Domain.Enums;
namespace UniVerse.Domain.Entities;
public class Review
{
public int Id { get; set; }
public int LectureId { get; set; }
public int UserId { get; set; }
public ReviewRating Rating { get; set; }
public string? Text { get; set; }
public ReviewLlmStatus LlmStatus { get; set; } = ReviewLlmStatus.Pending;
public ReviewSentiment? Sentiment { get; set; }
public double? QualityScore { get; set; }
public bool? IsInformative { get; set; }
public string[]? LlmTags { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public Lecture Lecture { get; set; } = null!;
public User User { get; set; } = null!;
public ICollection<CoinTransaction> CoinTransactions { get; set; } = new List<CoinTransaction>();
}
@@ -0,0 +1,15 @@
namespace UniVerse.Domain.Entities;
public class StudentProfile
{
public int Id { get; set; }
public int UserId { get; set; }
public string? StudentId { get; set; }
public string? GroupName { get; set; }
public int? EnrollmentYear { get; set; }
public string? Faculty { get; set; }
public string? Specialty { get; set; }
// Navigation properties
public User User { get; set; } = null!;
}
+17
View File
@@ -0,0 +1,17 @@
using UniVerse.Domain.Enums;
namespace UniVerse.Domain.Entities;
public class Tag
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public TagType Type { get; set; }
public int? ParentId { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public Tag? Parent { get; set; }
public ICollection<Tag> Children { get; set; } = new List<Tag>();
public ICollection<CourseTag> CourseTags { get; set; } = new List<CourseTag>();
}
@@ -0,0 +1,14 @@
namespace UniVerse.Domain.Entities;
public class TeacherProfile
{
public int Id { get; set; }
public int UserId { get; set; }
public string? Department { get; set; }
public string? Title { get; set; }
public string? Bio { get; set; }
public string? ModeusId { get; set; }
// Navigation properties
public User User { get; set; } = null!;
}
+27
View File
@@ -0,0 +1,27 @@
using UniVerse.Domain.Enums;
namespace UniVerse.Domain.Entities;
public class User
{
public int Id { get; set; }
public string Email { get; set; } = string.Empty;
public string? DisplayName { get; set; }
public string? AvatarUrl { get; set; }
public UserRole Role { get; set; } = UserRole.Student;
public bool IsActive { get; set; } = true;
public string? MicrosoftId { get; set; }
public int Xp { get; set; }
public int Coins { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public StudentProfile? StudentProfile { get; set; }
public TeacherProfile? TeacherProfile { get; set; }
public ICollection<LectureEnrollment> Enrollments { get; set; } = new List<LectureEnrollment>();
public ICollection<Review> Reviews { get; set; } = new List<Review>();
public ICollection<UserAchievement> UserAchievements { get; set; } = new List<UserAchievement>();
public ICollection<CoinTransaction> CoinTransactions { get; set; } = new List<CoinTransaction>();
public ICollection<RefreshToken> RefreshTokens { get; set; } = new List<RefreshToken>();
}
@@ -0,0 +1,13 @@
namespace UniVerse.Domain.Entities;
public class UserAchievement
{
public int Id { get; set; }
public int UserId { get; set; }
public int AchievementId { get; set; }
public DateTime AwardedAt { get; set; } = DateTime.UtcNow;
// Navigation properties
public User User { get; set; } = null!;
public Achievement Achievement { get; set; } = null!;
}