diff --git a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ChatMessageDto.cs b/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassChatDto.cs similarity index 80% rename from api/src/Kurs.Platform.Application.Contracts/VirtualClass/ChatMessageDto.cs rename to api/src/Kurs.Platform.Application.Contracts/Classroom/ClassChatDto.cs index 9765de1d..4f184df4 100644 --- a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ChatMessageDto.cs +++ b/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassChatDto.cs @@ -1,8 +1,8 @@ using System; -namespace Kurs.Platform.VirtualClassrooms; +namespace Kurs.Platform.Classrooms; -public class ChatMessageDto +public class ClassChatDto { public Guid Id { get; set; } public Guid SessionId { get; set; } diff --git a/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassParticipantDto.cs b/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassParticipantDto.cs new file mode 100644 index 00000000..fbc748a0 --- /dev/null +++ b/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassParticipantDto.cs @@ -0,0 +1,16 @@ +using System; + +namespace Kurs.Platform.Classrooms; + +public class ClassParticipantDto +{ + public Guid Id { get; set; } + public Guid SessionId { get; set; } + public Guid UserId { get; set; } + public string UserName { get; set; } + public string UserEmail { get; set; } + public bool IsTeacher { get; set; } + public bool IsAudioMuted { get; set; } + public bool IsVideoMuted { get; set; } + public DateTime JoinTime { get; set; } +} diff --git a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ClassSessionDto.cs b/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassroomDto.cs similarity index 84% rename from api/src/Kurs.Platform.Application.Contracts/VirtualClass/ClassSessionDto.cs rename to api/src/Kurs.Platform.Application.Contracts/Classroom/ClassroomDto.cs index e79ada9f..82821eb4 100644 --- a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ClassSessionDto.cs +++ b/api/src/Kurs.Platform.Application.Contracts/Classroom/ClassroomDto.cs @@ -1,9 +1,9 @@ using System; using Volo.Abp.Application.Dtos; -namespace Kurs.Platform.VirtualClassrooms; +namespace Kurs.Platform.Classrooms; -public class ClassSessionDto : FullAuditedEntityDto +public class ClassroomDto : FullAuditedEntityDto { public string Name { get; set; } public string Description { get; set; } @@ -21,7 +21,7 @@ public class ClassSessionDto : FullAuditedEntityDto public bool CanJoin { get; set; } } -public class CreateClassSessionDto +public class CreateClassroomDto { public string Name { get; set; } public string Description { get; set; } @@ -31,7 +31,7 @@ public class CreateClassSessionDto public int MaxParticipants { get; set; } = 30; } -public class UpdateClassSessionDto +public class UpdateClassroomDto { public string Name { get; set; } public string Description { get; set; } @@ -41,13 +41,13 @@ public class UpdateClassSessionDto public int MaxParticipants { get; set; } } -public class GetClassSessionListDto : PagedAndSortedResultRequestDto +public class GetClassroomListDto : PagedAndSortedResultRequestDto { public bool? IsActive { get; set; } public Guid? TeacherId { get; set; } } -public class AttendanceRecordDto : EntityDto +public class ClassAttendanceDto : EntityDto { public Guid SessionId { get; set; } public Guid StudentId { get; set; } diff --git a/api/src/Kurs.Platform.Application.Contracts/Classroom/IClassroomAppService.cs b/api/src/Kurs.Platform.Application.Contracts/Classroom/IClassroomAppService.cs new file mode 100644 index 00000000..b41351b0 --- /dev/null +++ b/api/src/Kurs.Platform.Application.Contracts/Classroom/IClassroomAppService.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace Kurs.Platform.Classrooms; + +public interface IClassroomAppService : IApplicationService +{ + Task CreateAsync(CreateClassroomDto input); + Task> GetListAsync(GetClassroomListDto input); + Task GetAsync(Guid id); + Task UpdateAsync(Guid id, UpdateClassroomDto input); + Task DeleteAsync(Guid id); + Task StartClassAsync(Guid id); + Task EndClassAsync(Guid id); + Task JoinClassAsync(Guid id); + Task LeaveClassAsync(Guid id); + Task> GetAttendanceAsync(Guid sessionId); +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/IVirtualClassAppService.cs b/api/src/Kurs.Platform.Application.Contracts/VirtualClass/IVirtualClassAppService.cs deleted file mode 100644 index 9d07fdfa..00000000 --- a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/IVirtualClassAppService.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; - -namespace Kurs.Platform.VirtualClassrooms; - -public interface IVirtualClassAppService : IApplicationService -{ - Task CreateAsync(CreateClassSessionDto input); - Task> GetListAsync(GetClassSessionListDto input); - Task GetAsync(Guid id); - Task UpdateAsync(Guid id, UpdateClassSessionDto input); - Task DeleteAsync(Guid id); - Task StartClassAsync(Guid id); - Task EndClassAsync(Guid id); - Task JoinClassAsync(Guid id); - Task LeaveClassAsync(Guid id); - Task> GetAttendanceAsync(Guid sessionId); -} \ No newline at end of file diff --git a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ParticipantDto.cs b/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ParticipantDto.cs deleted file mode 100644 index 6b7c852e..00000000 --- a/api/src/Kurs.Platform.Application.Contracts/VirtualClass/ParticipantDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace Kurs.Platform.VirtualClassrooms; - -public class ParticipantDto - { - public Guid Id { get; set; } - public Guid SessionId { get; set; } - public Guid UserId { get; set; } - public string UserName { get; set; } - public string UserEmail { get; set; } - public bool IsTeacher { get; set; } - public bool IsAudioMuted { get; set; } - public bool IsVideoMuted { get; set; } - public DateTime JoinTime { get; set; } - } diff --git a/api/src/Kurs.Platform.Application/VirtualClass/VirtualClassAppService.cs b/api/src/Kurs.Platform.Application/Classroom/ClassroomAppService.cs similarity index 78% rename from api/src/Kurs.Platform.Application/VirtualClass/VirtualClassAppService.cs rename to api/src/Kurs.Platform.Application/Classroom/ClassroomAppService.cs index b9328a0f..5171b247 100644 --- a/api/src/Kurs.Platform.Application/VirtualClass/VirtualClassAppService.cs +++ b/api/src/Kurs.Platform.Application/Classroom/ClassroomAppService.cs @@ -7,28 +7,28 @@ using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; -namespace Kurs.Platform.VirtualClassrooms; +namespace Kurs.Platform.Classrooms; [Authorize] -public class VirtualClassAppService : PlatformAppService, IVirtualClassAppService +public class ClassroomAppService : PlatformAppService, IClassroomAppService { - private readonly IRepository _classSessionRepository; - private readonly IRepository _participantRepository; - private readonly IRepository _attendanceRepository; + private readonly IRepository _classSessionRepository; + private readonly IRepository _participantRepository; + private readonly IRepository _attendanceRepository; - public VirtualClassAppService( - IRepository classSessionRepository, - IRepository participantRepository, - IRepository attendanceRepository) + public ClassroomAppService( + IRepository classSessionRepository, + IRepository participantRepository, + IRepository attendanceRepository) { _classSessionRepository = classSessionRepository; _participantRepository = participantRepository; _attendanceRepository = attendanceRepository; } - public async Task CreateAsync(CreateClassSessionDto input) + public async Task CreateAsync(CreateClassroomDto input) { - var classSession = new ClassSession( + var classSession = new Classroom( GuidGenerator.Create(), input.Name, input.Description, @@ -43,10 +43,10 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic await _classSessionRepository.InsertAsync(classSession); await CurrentUnitOfWork.SaveChangesAsync(); - return ObjectMapper.Map(classSession); + return ObjectMapper.Map(classSession); } - public async Task> GetListAsync(GetClassSessionListDto input) + public async Task> GetListAsync(GetClassroomListDto input) { var query = await _classSessionRepository.GetQueryableAsync(); @@ -67,19 +67,19 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic .Take(input.MaxResultCount) .ToList(); - return new PagedResultDto( + return new PagedResultDto( totalCount, - ObjectMapper.Map, List>(items) + ObjectMapper.Map, List>(items) ); } - public async Task GetAsync(Guid id) + public async Task GetAsync(Guid id) { var classSession = await _classSessionRepository.GetAsync(id); - return ObjectMapper.Map(classSession); + return ObjectMapper.Map(classSession); } - public async Task UpdateAsync(Guid id, UpdateClassSessionDto input) + public async Task UpdateAsync(Guid id, UpdateClassroomDto input) { var classSession = await _classSessionRepository.GetAsync(id); @@ -101,7 +101,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic classSession.MaxParticipants = input.MaxParticipants; await _classSessionRepository.UpdateAsync(classSession); - return ObjectMapper.Map(classSession); + return ObjectMapper.Map(classSession); } public async Task DeleteAsync(Guid id) @@ -121,7 +121,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic await _classSessionRepository.DeleteAsync(id); } - public async Task StartClassAsync(Guid id) + public async Task StartClassAsync(Guid id) { var classSession = await _classSessionRepository.GetAsync(id); @@ -138,7 +138,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic classSession.StartClass(); await _classSessionRepository.UpdateAsync(classSession); - return ObjectMapper.Map(classSession); + return ObjectMapper.Map(classSession); } public async Task EndClassAsync(Guid id) @@ -166,7 +166,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic } } - public async Task JoinClassAsync(Guid id) + public async Task JoinClassAsync(Guid id) { var classSession = await _classSessionRepository.GetAsync(id); @@ -188,7 +188,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic if (existingParticipant == null) { // Add participant - var participant = new Participant( + var participant = new ClassParticipant( GuidGenerator.Create(), id, CurrentUser.Id, @@ -200,7 +200,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic await _participantRepository.InsertAsync(participant); // Create attendance record - var attendance = new AttendanceRecord( + var attendance = new ClassAttandance( GuidGenerator.Create(), id, CurrentUser.Id, @@ -215,7 +215,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic await _classSessionRepository.UpdateAsync(classSession); } - return ObjectMapper.Map(classSession); + return ObjectMapper.Map(classSession); } public async Task LeaveClassAsync(Guid id) @@ -247,7 +247,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic } } - public async Task> GetAttendanceAsync(Guid sessionId) + public async Task> GetAttendanceAsync(Guid sessionId) { var classSession = await _classSessionRepository.GetAsync(sessionId); @@ -260,6 +260,6 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic x => x.SessionId == sessionId ); - return ObjectMapper.Map, List>(attendanceRecords); + return ObjectMapper.Map, List>(attendanceRecords); } } \ No newline at end of file diff --git a/api/src/Kurs.Platform.Application/Classroom/ClassroomAutoMapperProfile.cs b/api/src/Kurs.Platform.Application/Classroom/ClassroomAutoMapperProfile.cs new file mode 100644 index 00000000..4c3cfcc6 --- /dev/null +++ b/api/src/Kurs.Platform.Application/Classroom/ClassroomAutoMapperProfile.cs @@ -0,0 +1,20 @@ +using AutoMapper; +using Kurs.Platform.Entities; + +namespace Kurs.Platform.Classrooms; + +public class ClassroomAutoMapperProfile : Profile +{ + public ClassroomAutoMapperProfile() + { + CreateMap() + .ForMember(dest => dest.CanJoin, opt => opt.MapFrom(src => src.CanJoin())); + + CreateMap(); + CreateMap(); + + CreateMap(); + CreateMap(); + CreateMap(); + } +} diff --git a/api/src/Kurs.Platform.Application/VirtualClass/VirtualClassAutoMapperProfile.cs b/api/src/Kurs.Platform.Application/VirtualClass/VirtualClassAutoMapperProfile.cs deleted file mode 100644 index b0c2a7ab..00000000 --- a/api/src/Kurs.Platform.Application/VirtualClass/VirtualClassAutoMapperProfile.cs +++ /dev/null @@ -1,20 +0,0 @@ -using AutoMapper; -using Kurs.Platform.Entities; - -namespace Kurs.Platform.VirtualClassrooms; - -public class VirtualClassAutoMapperProfile : Profile -{ - public VirtualClassAutoMapperProfile() - { - CreateMap() - .ForMember(dest => dest.CanJoin, opt => opt.MapFrom(src => src.CanJoin())); - - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - } -} diff --git a/api/src/Kurs.Platform.Domain/VirtualClass/AttendanceRecord.cs b/api/src/Kurs.Platform.Domain/Classroom/ClassAttandance.cs similarity index 86% rename from api/src/Kurs.Platform.Domain/VirtualClass/AttendanceRecord.cs rename to api/src/Kurs.Platform.Domain/Classroom/ClassAttandance.cs index 430f99d2..4dc50c63 100644 --- a/api/src/Kurs.Platform.Domain/VirtualClass/AttendanceRecord.cs +++ b/api/src/Kurs.Platform.Domain/Classroom/ClassAttandance.cs @@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing; namespace Kurs.Platform.Entities; -public class AttendanceRecord : FullAuditedEntity +public class ClassAttandance : FullAuditedEntity { public Guid SessionId { get; set; } public Guid? StudentId { get; set; } @@ -13,13 +13,13 @@ public class AttendanceRecord : FullAuditedEntity public int TotalDurationMinutes { get; set; } // Navigation properties - public virtual ClassSession Session { get; set; } + public virtual Classroom Session { get; set; } - protected AttendanceRecord() + protected ClassAttandance() { } - public AttendanceRecord( + public ClassAttandance( Guid id, Guid sessionId, Guid? studentId, diff --git a/api/src/Kurs.Platform.Domain/VirtualClass/ChatMessage.cs b/api/src/Kurs.Platform.Domain/Classroom/ClassChat.cs similarity index 82% rename from api/src/Kurs.Platform.Domain/VirtualClass/ChatMessage.cs rename to api/src/Kurs.Platform.Domain/Classroom/ClassChat.cs index df2a9331..b6e07c6f 100644 --- a/api/src/Kurs.Platform.Domain/VirtualClass/ChatMessage.cs +++ b/api/src/Kurs.Platform.Domain/Classroom/ClassChat.cs @@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing; namespace Kurs.Platform.Entities; -public class ChatMessage : FullAuditedEntity +public class ClassChat : FullAuditedEntity { public Guid SessionId { get; set; } public Guid SenderId { get; set; } @@ -13,13 +13,13 @@ public class ChatMessage : FullAuditedEntity public bool IsTeacher { get; set; } // Navigation properties - public virtual ClassSession Session { get; set; } + public virtual Classroom Session { get; set; } - protected ChatMessage() + protected ClassChat() { } - public ChatMessage( + public ClassChat( Guid id, Guid sessionId, Guid senderId, diff --git a/api/src/Kurs.Platform.Domain/VirtualClass/Participant.cs b/api/src/Kurs.Platform.Domain/Classroom/ClassParticipant.cs similarity index 88% rename from api/src/Kurs.Platform.Domain/VirtualClass/Participant.cs rename to api/src/Kurs.Platform.Domain/Classroom/ClassParticipant.cs index 7f424e9f..54847285 100644 --- a/api/src/Kurs.Platform.Domain/VirtualClass/Participant.cs +++ b/api/src/Kurs.Platform.Domain/Classroom/ClassParticipant.cs @@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing; namespace Kurs.Platform.Entities; -public class Participant : FullAuditedEntity +public class ClassParticipant : FullAuditedEntity { public Guid SessionId { get; set; } public Guid? UserId { get; set; } @@ -16,13 +16,13 @@ public class Participant : FullAuditedEntity public string ConnectionId { get; set; } // Navigation properties - public virtual ClassSession Session { get; set; } + public virtual Classroom Session { get; set; } - protected Participant() + protected ClassParticipant() { } - public Participant( + public ClassParticipant( Guid id, Guid sessionId, Guid? userId, diff --git a/api/src/Kurs.Platform.Domain/VirtualClass/ClassSession.cs b/api/src/Kurs.Platform.Domain/Classroom/Classroom.cs similarity index 75% rename from api/src/Kurs.Platform.Domain/VirtualClass/ClassSession.cs rename to api/src/Kurs.Platform.Domain/Classroom/Classroom.cs index b5848b9d..5692c7a7 100644 --- a/api/src/Kurs.Platform.Domain/VirtualClass/ClassSession.cs +++ b/api/src/Kurs.Platform.Domain/Classroom/Classroom.cs @@ -4,7 +4,7 @@ using Volo.Abp.Domain.Entities.Auditing; namespace Kurs.Platform.Entities; -public class ClassSession : FullAuditedEntity +public class Classroom : FullAuditedEntity { public string Name { get; set; } public string Description { get; set; } @@ -20,18 +20,18 @@ public class ClassSession : FullAuditedEntity public bool IsScheduled { get; set; } public int ParticipantCount { get; set; } - public virtual ICollection Participants { get; set; } - public virtual ICollection AttendanceRecords { get; set; } - public virtual ICollection ChatMessages { get; set; } + public virtual ICollection Participants { get; set; } + public virtual ICollection AttendanceRecords { get; set; } + public virtual ICollection ChatMessages { get; set; } - protected ClassSession() + protected Classroom() { - Participants = new HashSet(); - AttendanceRecords = new HashSet(); - ChatMessages = new HashSet(); + Participants = new HashSet(); + AttendanceRecords = new HashSet(); + ChatMessages = new HashSet(); } - public ClassSession( + public Classroom( Guid id, string name, string description, @@ -55,9 +55,9 @@ public class ClassSession : FullAuditedEntity IsScheduled = true; ParticipantCount = 0; - Participants = new HashSet(); - AttendanceRecords = new HashSet(); - ChatMessages = new HashSet(); + Participants = new HashSet(); + AttendanceRecords = new HashSet(); + ChatMessages = new HashSet(); } public void StartClass() diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 06464469..53decdc3 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -97,10 +97,10 @@ public class PlatformDbContext : public DbSet Demos { get; set; } public DbSet Services { get; set; } - public DbSet ClassSessions { get; set; } - public DbSet Participants { get; set; } - public DbSet AttendanceRecords { get; set; } - public DbSet ChatMessages { get; set; } + public DbSet ClassSessions { get; set; } + public DbSet Participants { get; set; } + public DbSet AttendanceRecords { get; set; } + public DbSet ChatMessages { get; set; } #region Entities from the modules @@ -882,9 +882,9 @@ public class PlatformDbContext : }); // ClassSession - builder.Entity(b => + builder.Entity(b => { - b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassSession), PlatformConsts.DbSchema); + b.ToTable(PlatformConsts.DbTablePrefix + nameof(Classroom), PlatformConsts.DbSchema); b.ConfigureByConvention(); b.Property(x => x.Name).IsRequired().HasMaxLength(200); @@ -914,9 +914,9 @@ public class PlatformDbContext : }); // Participant - builder.Entity(b => + builder.Entity(b => { - b.ToTable(PlatformConsts.DbTablePrefix + nameof(Participant), PlatformConsts.DbSchema); + b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassParticipant), PlatformConsts.DbSchema); b.ConfigureByConvention(); b.Property(x => x.UserName).IsRequired().HasMaxLength(100); @@ -929,9 +929,9 @@ public class PlatformDbContext : }); // AttendanceRecord - builder.Entity(b => + builder.Entity(b => { - b.ToTable(PlatformConsts.DbTablePrefix + nameof(AttendanceRecord), PlatformConsts.DbSchema); + b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassAttandance), PlatformConsts.DbSchema); b.ConfigureByConvention(); b.Property(x => x.StudentName).IsRequired().HasMaxLength(100); @@ -942,9 +942,9 @@ public class PlatformDbContext : }); // ChatMessage - builder.Entity(b => + builder.Entity(b => { - b.ToTable(PlatformConsts.DbTablePrefix + nameof(ChatMessage), PlatformConsts.DbSchema); + b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassChat), PlatformConsts.DbSchema); b.ConfigureByConvention(); b.Property(x => x.SenderName).IsRequired().HasMaxLength(100); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826054655_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826055306_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826054655_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826055306_Initial.Designer.cs index 3680a9ad..57f8d063 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826054655_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826055306_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20250826054655_Initial")] + [Migration("20250826055306_Initial")] partial class Initial { /// @@ -852,72 +852,6 @@ namespace Kurs.Platform.Migrations b.ToTable("PApiMigration", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.AttendanceRecord", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnType("datetime2") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("uniqueidentifier") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("uniqueidentifier") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime2") - .HasColumnName("DeletionTime"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("JoinTime") - .HasColumnType("datetime2"); - - b.Property("LastModificationTime") - .HasColumnType("datetime2") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("uniqueidentifier") - .HasColumnName("LastModifierId"); - - b.Property("LeaveTime") - .HasColumnType("datetime2"); - - b.Property("SessionId") - .HasColumnType("uniqueidentifier"); - - b.Property("StudentId") - .HasColumnType("uniqueidentifier"); - - b.Property("StudentName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TotalDurationMinutes") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("JoinTime"); - - b.HasIndex("SessionId"); - - b.HasIndex("StudentId"); - - b.ToTable("PAttendanceRecord", (string)null); - }); - modelBuilder.Entity("Kurs.Platform.Entities.BackgroundWorker", b => { b.Property("Id") @@ -1563,7 +1497,135 @@ namespace Kurs.Platform.Migrations b.ToTable("PChart", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.ChatMessage", b => + modelBuilder.Entity("Kurs.Platform.Entities.City", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("CountryCode") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PlateCode") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("CountryCode", "Code") + .IsUnique(); + + b.ToTable("PCity", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassAttandance", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LeaveTime") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDurationMinutes") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("JoinTime"); + + b.HasIndex("SessionId"); + + b.HasIndex("StudentId"); + + b.ToTable("PClassAttandance", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassChat", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -1628,23 +1690,17 @@ namespace Kurs.Platform.Migrations b.HasIndex("Timestamp"); - b.ToTable("PChatMessage", (string)null); + b.ToTable("PClassChat", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.City", b => + modelBuilder.Entity("Kurs.Platform.Entities.ClassParticipant", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Code") - .IsRequired() - .HasMaxLength(16) - .HasColumnType("nvarchar(16)"); - - b.Property("CountryCode") - .IsRequired() - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + b.Property("ConnectionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -1662,12 +1718,24 @@ namespace Kurs.Platform.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("IsAudioMuted") + .HasColumnType("bit"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("bit") .HasDefaultValue(false) .HasColumnName("IsDeleted"); + b.Property("IsTeacher") + .HasColumnType("bit"); + + b.Property("IsVideoMuted") + .HasColumnType("bit"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + b.Property("LastModificationTime") .HasColumnType("datetime2") .HasColumnName("LastModificationTime"); @@ -1676,24 +1744,35 @@ namespace Kurs.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); + b.Property("SessionId") + .HasColumnType("uniqueidentifier"); - b.Property("PlateCode") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); + b.Property("UserEmail") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); - b.HasIndex("CountryCode", "Code") - .IsUnique(); + b.HasIndex("SessionId"); - b.ToTable("PCity", (string)null); + b.HasIndex("UserId"); + + b.HasIndex("SessionId", "UserId") + .IsUnique() + .HasFilter("[UserId] IS NOT NULL"); + + b.ToTable("PClassParticipant", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.ClassSession", b => + modelBuilder.Entity("Kurs.Platform.Entities.Classroom", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -1781,7 +1860,7 @@ namespace Kurs.Platform.Migrations b.HasIndex("TeacherId"); - b.ToTable("PClassSession", (string)null); + b.ToTable("PClassroom", (string)null); }); modelBuilder.Entity("Kurs.Platform.Entities.Contact", b => @@ -3277,85 +3356,6 @@ namespace Kurs.Platform.Migrations b.ToTable("PMenu", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.Participant", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ConnectionId") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CreationTime") - .HasColumnType("datetime2") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("uniqueidentifier") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("uniqueidentifier") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime2") - .HasColumnName("DeletionTime"); - - b.Property("IsAudioMuted") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("IsTeacher") - .HasColumnType("bit"); - - b.Property("IsVideoMuted") - .HasColumnType("bit"); - - b.Property("JoinTime") - .HasColumnType("datetime2"); - - b.Property("LastModificationTime") - .HasColumnType("datetime2") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("uniqueidentifier") - .HasColumnName("LastModifierId"); - - b.Property("SessionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserEmail") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("SessionId"); - - b.HasIndex("UserId"); - - b.HasIndex("SessionId", "UserId") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("PParticipant", (string)null); - }); - modelBuilder.Entity("Kurs.Platform.Entities.PaymentMethod", b => { b.Property("Id") @@ -6520,17 +6520,6 @@ namespace Kurs.Platform.Migrations b.Navigation("Entity"); }); - modelBuilder.Entity("Kurs.Platform.Entities.AttendanceRecord", b => - { - b.HasOne("Kurs.Platform.Entities.ClassSession", "Session") - .WithMany("AttendanceRecords") - .HasForeignKey("SessionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Session"); - }); - modelBuilder.Entity("Kurs.Platform.Entities.BankAccount", b => { b.HasOne("Kurs.Platform.Entities.Bank", "Bank") @@ -6559,17 +6548,6 @@ namespace Kurs.Platform.Migrations b.Navigation("Category"); }); - modelBuilder.Entity("Kurs.Platform.Entities.ChatMessage", b => - { - b.HasOne("Kurs.Platform.Entities.ClassSession", "Session") - .WithMany("ChatMessages") - .HasForeignKey("SessionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Session"); - }); - modelBuilder.Entity("Kurs.Platform.Entities.City", b => { b.HasOne("Kurs.Platform.Entities.Country", "Country") @@ -6582,6 +6560,39 @@ namespace Kurs.Platform.Migrations b.Navigation("Country"); }); + modelBuilder.Entity("Kurs.Platform.Entities.ClassAttandance", b => + { + b.HasOne("Kurs.Platform.Entities.Classroom", "Session") + .WithMany("AttendanceRecords") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassChat", b => + { + b.HasOne("Kurs.Platform.Entities.Classroom", "Session") + .WithMany("ChatMessages") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassParticipant", b => + { + b.HasOne("Kurs.Platform.Entities.Classroom", "Session") + .WithMany("Participants") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Country", b => { b.HasOne("Kurs.Platform.Entities.CountryGroup", null) @@ -6633,17 +6644,6 @@ namespace Kurs.Platform.Migrations .IsRequired(); }); - modelBuilder.Entity("Kurs.Platform.Entities.Participant", b => - { - b.HasOne("Kurs.Platform.Entities.ClassSession", "Session") - .WithMany("Participants") - .HasForeignKey("SessionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Session"); - }); - modelBuilder.Entity("Kurs.Platform.Entities.ReportGenerated", b => { b.HasOne("Kurs.Platform.Entities.ReportTemplate", "Template") @@ -6905,7 +6905,7 @@ namespace Kurs.Platform.Migrations b.Navigation("Districts"); }); - modelBuilder.Entity("Kurs.Platform.Entities.ClassSession", b => + modelBuilder.Entity("Kurs.Platform.Entities.Classroom", b => { b.Navigation("AttendanceRecords"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826054655_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826055306_Initial.cs similarity index 98% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826054655_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826055306_Initial.cs index 977ed0c1..b76f329f 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826054655_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250826055306_Initial.cs @@ -787,7 +787,7 @@ namespace Kurs.Platform.Migrations }); migrationBuilder.CreateTable( - name: "PClassSession", + name: "PClassroom", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -814,7 +814,7 @@ namespace Kurs.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_PClassSession", x => x.Id); + table.PrimaryKey("PK_PClassroom", x => x.Id); }); migrationBuilder.CreateTable( @@ -1922,7 +1922,7 @@ namespace Kurs.Platform.Migrations }); migrationBuilder.CreateTable( - name: "PAttendanceRecord", + name: "PClassAttandance", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -1942,17 +1942,17 @@ namespace Kurs.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_PAttendanceRecord", x => x.Id); + table.PrimaryKey("PK_PClassAttandance", x => x.Id); table.ForeignKey( - name: "FK_PAttendanceRecord_PClassSession_SessionId", + name: "FK_PClassAttandance_PClassroom_SessionId", column: x => x.SessionId, - principalTable: "PClassSession", + principalTable: "PClassroom", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( - name: "PChatMessage", + name: "PClassChat", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -1972,17 +1972,17 @@ namespace Kurs.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_PChatMessage", x => x.Id); + table.PrimaryKey("PK_PClassChat", x => x.Id); table.ForeignKey( - name: "FK_PChatMessage_PClassSession_SessionId", + name: "FK_PClassChat_PClassroom_SessionId", column: x => x.SessionId, - principalTable: "PClassSession", + principalTable: "PClassroom", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( - name: "PParticipant", + name: "PClassParticipant", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), @@ -2005,11 +2005,11 @@ namespace Kurs.Platform.Migrations }, constraints: table => { - table.PrimaryKey("PK_PParticipant", x => x.Id); + table.PrimaryKey("PK_PClassParticipant", x => x.Id); table.ForeignKey( - name: "FK_PParticipant_PClassSession_SessionId", + name: "FK_PClassParticipant_PClassroom_SessionId", column: x => x.SessionId, - principalTable: "PClassSession", + principalTable: "PClassroom", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -2954,21 +2954,6 @@ namespace Kurs.Platform.Migrations table: "PApiMigration", column: "EntityId"); - migrationBuilder.CreateIndex( - name: "IX_PAttendanceRecord_JoinTime", - table: "PAttendanceRecord", - column: "JoinTime"); - - migrationBuilder.CreateIndex( - name: "IX_PAttendanceRecord_SessionId", - table: "PAttendanceRecord", - column: "SessionId"); - - migrationBuilder.CreateIndex( - name: "IX_PAttendanceRecord_StudentId", - table: "PAttendanceRecord", - column: "StudentId"); - migrationBuilder.CreateIndex( name: "IX_MailQueueTableFormat", table: "PBackgroundWorker_MailQueueTableFormat", @@ -3000,21 +2985,6 @@ namespace Kurs.Platform.Migrations table: "PBlogPost", column: "Slug"); - migrationBuilder.CreateIndex( - name: "IX_PChatMessage_SenderId", - table: "PChatMessage", - column: "SenderId"); - - migrationBuilder.CreateIndex( - name: "IX_PChatMessage_SessionId", - table: "PChatMessage", - column: "SessionId"); - - migrationBuilder.CreateIndex( - name: "IX_PChatMessage_Timestamp", - table: "PChatMessage", - column: "Timestamp"); - migrationBuilder.CreateIndex( name: "IX_PCity_CountryCode_Code", table: "PCity", @@ -3022,18 +2992,65 @@ namespace Kurs.Platform.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_PClassSession_IsActive", - table: "PClassSession", + name: "IX_PClassAttandance_JoinTime", + table: "PClassAttandance", + column: "JoinTime"); + + migrationBuilder.CreateIndex( + name: "IX_PClassAttandance_SessionId", + table: "PClassAttandance", + column: "SessionId"); + + migrationBuilder.CreateIndex( + name: "IX_PClassAttandance_StudentId", + table: "PClassAttandance", + column: "StudentId"); + + migrationBuilder.CreateIndex( + name: "IX_PClassChat_SenderId", + table: "PClassChat", + column: "SenderId"); + + migrationBuilder.CreateIndex( + name: "IX_PClassChat_SessionId", + table: "PClassChat", + column: "SessionId"); + + migrationBuilder.CreateIndex( + name: "IX_PClassChat_Timestamp", + table: "PClassChat", + column: "Timestamp"); + + migrationBuilder.CreateIndex( + name: "IX_PClassParticipant_SessionId", + table: "PClassParticipant", + column: "SessionId"); + + migrationBuilder.CreateIndex( + name: "IX_PClassParticipant_SessionId_UserId", + table: "PClassParticipant", + columns: new[] { "SessionId", "UserId" }, + unique: true, + filter: "[UserId] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_PClassParticipant_UserId", + table: "PClassParticipant", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_PClassroom_IsActive", + table: "PClassroom", column: "IsActive"); migrationBuilder.CreateIndex( - name: "IX_PClassSession_ScheduledStartTime", - table: "PClassSession", + name: "IX_PClassroom_ScheduledStartTime", + table: "PClassroom", column: "ScheduledStartTime"); migrationBuilder.CreateIndex( - name: "IX_PClassSession_TeacherId", - table: "PClassSession", + name: "IX_PClassroom_TeacherId", + table: "PClassroom", column: "TeacherId"); migrationBuilder.CreateIndex( @@ -3115,23 +3132,6 @@ namespace Kurs.Platform.Migrations table: "POrderItem", column: "OrderId"); - migrationBuilder.CreateIndex( - name: "IX_PParticipant_SessionId", - table: "PParticipant", - column: "SessionId"); - - migrationBuilder.CreateIndex( - name: "IX_PParticipant_SessionId_UserId", - table: "PParticipant", - columns: new[] { "SessionId", "UserId" }, - unique: true, - filter: "[UserId] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_PParticipant_UserId", - table: "PParticipant", - column: "UserId"); - migrationBuilder.CreateIndex( name: "IX_PReportCategory_Name", table: "PReportCategory", @@ -3283,9 +3283,6 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "PApiMigration"); - migrationBuilder.DropTable( - name: "PAttendanceRecord"); - migrationBuilder.DropTable( name: "PBackgroundWorker"); @@ -3311,7 +3308,13 @@ namespace Kurs.Platform.Migrations name: "PChart"); migrationBuilder.DropTable( - name: "PChatMessage"); + name: "PClassAttandance"); + + migrationBuilder.DropTable( + name: "PClassChat"); + + migrationBuilder.DropTable( + name: "PClassParticipant"); migrationBuilder.DropTable( name: "PContact"); @@ -3382,9 +3385,6 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "POrderItem"); - migrationBuilder.DropTable( - name: "PParticipant"); - migrationBuilder.DropTable( name: "PPaymentMethod"); @@ -3445,6 +3445,9 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "PBlogCategory"); + migrationBuilder.DropTable( + name: "PClassroom"); + migrationBuilder.DropTable( name: "PCustomEntity"); @@ -3463,9 +3466,6 @@ namespace Kurs.Platform.Migrations migrationBuilder.DropTable( name: "POrder"); - migrationBuilder.DropTable( - name: "PClassSession"); - migrationBuilder.DropTable( name: "PReportTemplate"); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 836b9ba1..c4d0e0f8 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -849,72 +849,6 @@ namespace Kurs.Platform.Migrations b.ToTable("PApiMigration", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.AttendanceRecord", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationTime") - .HasColumnType("datetime2") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("uniqueidentifier") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("uniqueidentifier") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime2") - .HasColumnName("DeletionTime"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("JoinTime") - .HasColumnType("datetime2"); - - b.Property("LastModificationTime") - .HasColumnType("datetime2") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("uniqueidentifier") - .HasColumnName("LastModifierId"); - - b.Property("LeaveTime") - .HasColumnType("datetime2"); - - b.Property("SessionId") - .HasColumnType("uniqueidentifier"); - - b.Property("StudentId") - .HasColumnType("uniqueidentifier"); - - b.Property("StudentName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TotalDurationMinutes") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("JoinTime"); - - b.HasIndex("SessionId"); - - b.HasIndex("StudentId"); - - b.ToTable("PAttendanceRecord", (string)null); - }); - modelBuilder.Entity("Kurs.Platform.Entities.BackgroundWorker", b => { b.Property("Id") @@ -1560,7 +1494,135 @@ namespace Kurs.Platform.Migrations b.ToTable("PChart", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.ChatMessage", b => + modelBuilder.Entity("Kurs.Platform.Entities.City", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("CountryCode") + .IsRequired() + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PlateCode") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("CountryCode", "Code") + .IsUnique(); + + b.ToTable("PCity", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassAttandance", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LeaveTime") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDurationMinutes") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("JoinTime"); + + b.HasIndex("SessionId"); + + b.HasIndex("StudentId"); + + b.ToTable("PClassAttandance", (string)null); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassChat", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -1625,23 +1687,17 @@ namespace Kurs.Platform.Migrations b.HasIndex("Timestamp"); - b.ToTable("PChatMessage", (string)null); + b.ToTable("PClassChat", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.City", b => + modelBuilder.Entity("Kurs.Platform.Entities.ClassParticipant", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Code") - .IsRequired() - .HasMaxLength(16) - .HasColumnType("nvarchar(16)"); - - b.Property("CountryCode") - .IsRequired() - .HasMaxLength(8) - .HasColumnType("nvarchar(8)"); + b.Property("ConnectionId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CreationTime") .HasColumnType("datetime2") @@ -1659,12 +1715,24 @@ namespace Kurs.Platform.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("IsAudioMuted") + .HasColumnType("bit"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("bit") .HasDefaultValue(false) .HasColumnName("IsDeleted"); + b.Property("IsTeacher") + .HasColumnType("bit"); + + b.Property("IsVideoMuted") + .HasColumnType("bit"); + + b.Property("JoinTime") + .HasColumnType("datetime2"); + b.Property("LastModificationTime") .HasColumnType("datetime2") .HasColumnName("LastModificationTime"); @@ -1673,24 +1741,35 @@ namespace Kurs.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); + b.Property("SessionId") + .HasColumnType("uniqueidentifier"); - b.Property("PlateCode") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); + b.Property("UserEmail") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); - b.HasIndex("CountryCode", "Code") - .IsUnique(); + b.HasIndex("SessionId"); - b.ToTable("PCity", (string)null); + b.HasIndex("UserId"); + + b.HasIndex("SessionId", "UserId") + .IsUnique() + .HasFilter("[UserId] IS NOT NULL"); + + b.ToTable("PClassParticipant", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.ClassSession", b => + modelBuilder.Entity("Kurs.Platform.Entities.Classroom", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -1778,7 +1857,7 @@ namespace Kurs.Platform.Migrations b.HasIndex("TeacherId"); - b.ToTable("PClassSession", (string)null); + b.ToTable("PClassroom", (string)null); }); modelBuilder.Entity("Kurs.Platform.Entities.Contact", b => @@ -3274,85 +3353,6 @@ namespace Kurs.Platform.Migrations b.ToTable("PMenu", (string)null); }); - modelBuilder.Entity("Kurs.Platform.Entities.Participant", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ConnectionId") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CreationTime") - .HasColumnType("datetime2") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("uniqueidentifier") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("uniqueidentifier") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime2") - .HasColumnName("DeletionTime"); - - b.Property("IsAudioMuted") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("IsTeacher") - .HasColumnType("bit"); - - b.Property("IsVideoMuted") - .HasColumnType("bit"); - - b.Property("JoinTime") - .HasColumnType("datetime2"); - - b.Property("LastModificationTime") - .HasColumnType("datetime2") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("uniqueidentifier") - .HasColumnName("LastModifierId"); - - b.Property("SessionId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserEmail") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("SessionId"); - - b.HasIndex("UserId"); - - b.HasIndex("SessionId", "UserId") - .IsUnique() - .HasFilter("[UserId] IS NOT NULL"); - - b.ToTable("PParticipant", (string)null); - }); - modelBuilder.Entity("Kurs.Platform.Entities.PaymentMethod", b => { b.Property("Id") @@ -6517,17 +6517,6 @@ namespace Kurs.Platform.Migrations b.Navigation("Entity"); }); - modelBuilder.Entity("Kurs.Platform.Entities.AttendanceRecord", b => - { - b.HasOne("Kurs.Platform.Entities.ClassSession", "Session") - .WithMany("AttendanceRecords") - .HasForeignKey("SessionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Session"); - }); - modelBuilder.Entity("Kurs.Platform.Entities.BankAccount", b => { b.HasOne("Kurs.Platform.Entities.Bank", "Bank") @@ -6556,17 +6545,6 @@ namespace Kurs.Platform.Migrations b.Navigation("Category"); }); - modelBuilder.Entity("Kurs.Platform.Entities.ChatMessage", b => - { - b.HasOne("Kurs.Platform.Entities.ClassSession", "Session") - .WithMany("ChatMessages") - .HasForeignKey("SessionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Session"); - }); - modelBuilder.Entity("Kurs.Platform.Entities.City", b => { b.HasOne("Kurs.Platform.Entities.Country", "Country") @@ -6579,6 +6557,39 @@ namespace Kurs.Platform.Migrations b.Navigation("Country"); }); + modelBuilder.Entity("Kurs.Platform.Entities.ClassAttandance", b => + { + b.HasOne("Kurs.Platform.Entities.Classroom", "Session") + .WithMany("AttendanceRecords") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassChat", b => + { + b.HasOne("Kurs.Platform.Entities.Classroom", "Session") + .WithMany("ChatMessages") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + + modelBuilder.Entity("Kurs.Platform.Entities.ClassParticipant", b => + { + b.HasOne("Kurs.Platform.Entities.Classroom", "Session") + .WithMany("Participants") + .HasForeignKey("SessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Session"); + }); + modelBuilder.Entity("Kurs.Platform.Entities.Country", b => { b.HasOne("Kurs.Platform.Entities.CountryGroup", null) @@ -6630,17 +6641,6 @@ namespace Kurs.Platform.Migrations .IsRequired(); }); - modelBuilder.Entity("Kurs.Platform.Entities.Participant", b => - { - b.HasOne("Kurs.Platform.Entities.ClassSession", "Session") - .WithMany("Participants") - .HasForeignKey("SessionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Session"); - }); - modelBuilder.Entity("Kurs.Platform.Entities.ReportGenerated", b => { b.HasOne("Kurs.Platform.Entities.ReportTemplate", "Template") @@ -6902,7 +6902,7 @@ namespace Kurs.Platform.Migrations b.Navigation("Districts"); }); - modelBuilder.Entity("Kurs.Platform.Entities.ClassSession", b => + modelBuilder.Entity("Kurs.Platform.Entities.Classroom", b => { b.Navigation("AttendanceRecords"); diff --git a/api/src/Kurs.Platform.HttpApi.Host/VirtualClass/ClassroomHub.cs b/api/src/Kurs.Platform.HttpApi.Host/VirtualClass/ClassroomHub.cs index ee1487bd..d2337deb 100644 --- a/api/src/Kurs.Platform.HttpApi.Host/VirtualClass/ClassroomHub.cs +++ b/api/src/Kurs.Platform.HttpApi.Host/VirtualClass/ClassroomHub.cs @@ -12,16 +12,16 @@ namespace Kurs.Platform.SignalR.Hubs; [Authorize] public class ClassroomHub : Hub { - private readonly IRepository _classSessionRepository; - private readonly IRepository _participantRepository; - private readonly IRepository _chatMessageRepository; + private readonly IRepository _classSessionRepository; + private readonly IRepository _participantRepository; + private readonly IRepository _chatMessageRepository; private readonly ILogger _logger; private readonly IGuidGenerator _guidGenerator; public ClassroomHub( - IRepository classSessionRepository, - IRepository participantRepository, - IRepository chatMessageRepository, + IRepository classSessionRepository, + IRepository participantRepository, + IRepository chatMessageRepository, ILogger logger, IGuidGenerator guidGenerator) { @@ -91,7 +91,7 @@ public class ClassroomHub : Hub var isTeacher = participant?.IsTeacher ?? false; // Save message to database - var chatMessage = new ChatMessage( + var chatMessage = new ClassChat( _guidGenerator.Create(), sessionId, userId,