VirtualClass -> Classroom

This commit is contained in:
Sedat ÖZTÜRK 2025-08-26 08:59:39 +03:00
parent 41f972c727
commit 217c68b853
18 changed files with 619 additions and 619 deletions

View file

@ -1,8 +1,8 @@
using System; using System;
namespace Kurs.Platform.VirtualClassrooms; namespace Kurs.Platform.Classrooms;
public class ChatMessageDto public class ClassChatDto
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid SessionId { get; set; } public Guid SessionId { get; set; }

View file

@ -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; }
}

View file

@ -1,9 +1,9 @@
using System; using System;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
namespace Kurs.Platform.VirtualClassrooms; namespace Kurs.Platform.Classrooms;
public class ClassSessionDto : FullAuditedEntityDto<Guid> public class ClassroomDto : FullAuditedEntityDto<Guid>
{ {
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
@ -21,7 +21,7 @@ public class ClassSessionDto : FullAuditedEntityDto<Guid>
public bool CanJoin { get; set; } public bool CanJoin { get; set; }
} }
public class CreateClassSessionDto public class CreateClassroomDto
{ {
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
@ -31,7 +31,7 @@ public class CreateClassSessionDto
public int MaxParticipants { get; set; } = 30; public int MaxParticipants { get; set; } = 30;
} }
public class UpdateClassSessionDto public class UpdateClassroomDto
{ {
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
@ -41,13 +41,13 @@ public class UpdateClassSessionDto
public int MaxParticipants { get; set; } public int MaxParticipants { get; set; }
} }
public class GetClassSessionListDto : PagedAndSortedResultRequestDto public class GetClassroomListDto : PagedAndSortedResultRequestDto
{ {
public bool? IsActive { get; set; } public bool? IsActive { get; set; }
public Guid? TeacherId { get; set; } public Guid? TeacherId { get; set; }
} }
public class AttendanceRecordDto : EntityDto<Guid> public class ClassAttendanceDto : EntityDto<Guid>
{ {
public Guid SessionId { get; set; } public Guid SessionId { get; set; }
public Guid StudentId { get; set; } public Guid StudentId { get; set; }

View file

@ -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<ClassroomDto> CreateAsync(CreateClassroomDto input);
Task<PagedResultDto<ClassroomDto>> GetListAsync(GetClassroomListDto input);
Task<ClassroomDto> GetAsync(Guid id);
Task<ClassroomDto> UpdateAsync(Guid id, UpdateClassroomDto input);
Task DeleteAsync(Guid id);
Task<ClassroomDto> StartClassAsync(Guid id);
Task EndClassAsync(Guid id);
Task<ClassroomDto> JoinClassAsync(Guid id);
Task LeaveClassAsync(Guid id);
Task<List<ClassAttendanceDto>> GetAttendanceAsync(Guid sessionId);
}

View file

@ -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<ClassSessionDto> CreateAsync(CreateClassSessionDto input);
Task<PagedResultDto<ClassSessionDto>> GetListAsync(GetClassSessionListDto input);
Task<ClassSessionDto> GetAsync(Guid id);
Task<ClassSessionDto> UpdateAsync(Guid id, UpdateClassSessionDto input);
Task DeleteAsync(Guid id);
Task<ClassSessionDto> StartClassAsync(Guid id);
Task EndClassAsync(Guid id);
Task<ClassSessionDto> JoinClassAsync(Guid id);
Task LeaveClassAsync(Guid id);
Task<List<AttendanceRecordDto>> GetAttendanceAsync(Guid sessionId);
}

View file

@ -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; }
}

View file

@ -7,28 +7,28 @@ using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
namespace Kurs.Platform.VirtualClassrooms; namespace Kurs.Platform.Classrooms;
[Authorize] [Authorize]
public class VirtualClassAppService : PlatformAppService, IVirtualClassAppService public class ClassroomAppService : PlatformAppService, IClassroomAppService
{ {
private readonly IRepository<ClassSession, Guid> _classSessionRepository; private readonly IRepository<Classroom, Guid> _classSessionRepository;
private readonly IRepository<Participant, Guid> _participantRepository; private readonly IRepository<ClassParticipant, Guid> _participantRepository;
private readonly IRepository<AttendanceRecord, Guid> _attendanceRepository; private readonly IRepository<ClassAttandance, Guid> _attendanceRepository;
public VirtualClassAppService( public ClassroomAppService(
IRepository<ClassSession, Guid> classSessionRepository, IRepository<Classroom, Guid> classSessionRepository,
IRepository<Participant, Guid> participantRepository, IRepository<ClassParticipant, Guid> participantRepository,
IRepository<AttendanceRecord, Guid> attendanceRepository) IRepository<ClassAttandance, Guid> attendanceRepository)
{ {
_classSessionRepository = classSessionRepository; _classSessionRepository = classSessionRepository;
_participantRepository = participantRepository; _participantRepository = participantRepository;
_attendanceRepository = attendanceRepository; _attendanceRepository = attendanceRepository;
} }
public async Task<ClassSessionDto> CreateAsync(CreateClassSessionDto input) public async Task<ClassroomDto> CreateAsync(CreateClassroomDto input)
{ {
var classSession = new ClassSession( var classSession = new Classroom(
GuidGenerator.Create(), GuidGenerator.Create(),
input.Name, input.Name,
input.Description, input.Description,
@ -43,10 +43,10 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
await _classSessionRepository.InsertAsync(classSession); await _classSessionRepository.InsertAsync(classSession);
await CurrentUnitOfWork.SaveChangesAsync(); await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<ClassSession, ClassSessionDto>(classSession); return ObjectMapper.Map<Classroom, ClassroomDto>(classSession);
} }
public async Task<PagedResultDto<ClassSessionDto>> GetListAsync(GetClassSessionListDto input) public async Task<PagedResultDto<ClassroomDto>> GetListAsync(GetClassroomListDto input)
{ {
var query = await _classSessionRepository.GetQueryableAsync(); var query = await _classSessionRepository.GetQueryableAsync();
@ -67,19 +67,19 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
.Take(input.MaxResultCount) .Take(input.MaxResultCount)
.ToList(); .ToList();
return new PagedResultDto<ClassSessionDto>( return new PagedResultDto<ClassroomDto>(
totalCount, totalCount,
ObjectMapper.Map<List<ClassSession>, List<ClassSessionDto>>(items) ObjectMapper.Map<List<Classroom>, List<ClassroomDto>>(items)
); );
} }
public async Task<ClassSessionDto> GetAsync(Guid id) public async Task<ClassroomDto> GetAsync(Guid id)
{ {
var classSession = await _classSessionRepository.GetAsync(id); var classSession = await _classSessionRepository.GetAsync(id);
return ObjectMapper.Map<ClassSession, ClassSessionDto>(classSession); return ObjectMapper.Map<Classroom, ClassroomDto>(classSession);
} }
public async Task<ClassSessionDto> UpdateAsync(Guid id, UpdateClassSessionDto input) public async Task<ClassroomDto> UpdateAsync(Guid id, UpdateClassroomDto input)
{ {
var classSession = await _classSessionRepository.GetAsync(id); var classSession = await _classSessionRepository.GetAsync(id);
@ -101,7 +101,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
classSession.MaxParticipants = input.MaxParticipants; classSession.MaxParticipants = input.MaxParticipants;
await _classSessionRepository.UpdateAsync(classSession); await _classSessionRepository.UpdateAsync(classSession);
return ObjectMapper.Map<ClassSession, ClassSessionDto>(classSession); return ObjectMapper.Map<Classroom, ClassroomDto>(classSession);
} }
public async Task DeleteAsync(Guid id) public async Task DeleteAsync(Guid id)
@ -121,7 +121,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
await _classSessionRepository.DeleteAsync(id); await _classSessionRepository.DeleteAsync(id);
} }
public async Task<ClassSessionDto> StartClassAsync(Guid id) public async Task<ClassroomDto> StartClassAsync(Guid id)
{ {
var classSession = await _classSessionRepository.GetAsync(id); var classSession = await _classSessionRepository.GetAsync(id);
@ -138,7 +138,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
classSession.StartClass(); classSession.StartClass();
await _classSessionRepository.UpdateAsync(classSession); await _classSessionRepository.UpdateAsync(classSession);
return ObjectMapper.Map<ClassSession, ClassSessionDto>(classSession); return ObjectMapper.Map<Classroom, ClassroomDto>(classSession);
} }
public async Task EndClassAsync(Guid id) public async Task EndClassAsync(Guid id)
@ -166,7 +166,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
} }
} }
public async Task<ClassSessionDto> JoinClassAsync(Guid id) public async Task<ClassroomDto> JoinClassAsync(Guid id)
{ {
var classSession = await _classSessionRepository.GetAsync(id); var classSession = await _classSessionRepository.GetAsync(id);
@ -188,7 +188,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
if (existingParticipant == null) if (existingParticipant == null)
{ {
// Add participant // Add participant
var participant = new Participant( var participant = new ClassParticipant(
GuidGenerator.Create(), GuidGenerator.Create(),
id, id,
CurrentUser.Id, CurrentUser.Id,
@ -200,7 +200,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
await _participantRepository.InsertAsync(participant); await _participantRepository.InsertAsync(participant);
// Create attendance record // Create attendance record
var attendance = new AttendanceRecord( var attendance = new ClassAttandance(
GuidGenerator.Create(), GuidGenerator.Create(),
id, id,
CurrentUser.Id, CurrentUser.Id,
@ -215,7 +215,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
await _classSessionRepository.UpdateAsync(classSession); await _classSessionRepository.UpdateAsync(classSession);
} }
return ObjectMapper.Map<ClassSession, ClassSessionDto>(classSession); return ObjectMapper.Map<Classroom, ClassroomDto>(classSession);
} }
public async Task LeaveClassAsync(Guid id) public async Task LeaveClassAsync(Guid id)
@ -247,7 +247,7 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
} }
} }
public async Task<List<AttendanceRecordDto>> GetAttendanceAsync(Guid sessionId) public async Task<List<ClassAttendanceDto>> GetAttendanceAsync(Guid sessionId)
{ {
var classSession = await _classSessionRepository.GetAsync(sessionId); var classSession = await _classSessionRepository.GetAsync(sessionId);
@ -260,6 +260,6 @@ public class VirtualClassAppService : PlatformAppService, IVirtualClassAppServic
x => x.SessionId == sessionId x => x.SessionId == sessionId
); );
return ObjectMapper.Map<List<AttendanceRecord>, List<AttendanceRecordDto>>(attendanceRecords); return ObjectMapper.Map<List<ClassAttandance>, List<ClassAttendanceDto>>(attendanceRecords);
} }
} }

View file

@ -0,0 +1,20 @@
using AutoMapper;
using Kurs.Platform.Entities;
namespace Kurs.Platform.Classrooms;
public class ClassroomAutoMapperProfile : Profile
{
public ClassroomAutoMapperProfile()
{
CreateMap<Classroom, ClassroomDto>()
.ForMember(dest => dest.CanJoin, opt => opt.MapFrom(src => src.CanJoin()));
CreateMap<CreateClassroomDto, Classroom>();
CreateMap<UpdateClassroomDto, Classroom>();
CreateMap<ClassAttandance, ClassAttendanceDto>();
CreateMap<ClassParticipant, ClassParticipantDto>();
CreateMap<ClassChat, ClassChatDto>();
}
}

View file

@ -1,20 +0,0 @@
using AutoMapper;
using Kurs.Platform.Entities;
namespace Kurs.Platform.VirtualClassrooms;
public class VirtualClassAutoMapperProfile : Profile
{
public VirtualClassAutoMapperProfile()
{
CreateMap<ClassSession, ClassSessionDto>()
.ForMember(dest => dest.CanJoin, opt => opt.MapFrom(src => src.CanJoin()));
CreateMap<CreateClassSessionDto, ClassSession>();
CreateMap<UpdateClassSessionDto, ClassSession>();
CreateMap<AttendanceRecord, AttendanceRecordDto>();
CreateMap<Participant, ParticipantDto>();
CreateMap<ChatMessage, ChatMessageDto>();
}
}

View file

@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Kurs.Platform.Entities; namespace Kurs.Platform.Entities;
public class AttendanceRecord : FullAuditedEntity<Guid> public class ClassAttandance : FullAuditedEntity<Guid>
{ {
public Guid SessionId { get; set; } public Guid SessionId { get; set; }
public Guid? StudentId { get; set; } public Guid? StudentId { get; set; }
@ -13,13 +13,13 @@ public class AttendanceRecord : FullAuditedEntity<Guid>
public int TotalDurationMinutes { get; set; } public int TotalDurationMinutes { get; set; }
// Navigation properties // 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 id,
Guid sessionId, Guid sessionId,
Guid? studentId, Guid? studentId,

View file

@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Kurs.Platform.Entities; namespace Kurs.Platform.Entities;
public class ChatMessage : FullAuditedEntity<Guid> public class ClassChat : FullAuditedEntity<Guid>
{ {
public Guid SessionId { get; set; } public Guid SessionId { get; set; }
public Guid SenderId { get; set; } public Guid SenderId { get; set; }
@ -13,13 +13,13 @@ public class ChatMessage : FullAuditedEntity<Guid>
public bool IsTeacher { get; set; } public bool IsTeacher { get; set; }
// Navigation properties // 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 id,
Guid sessionId, Guid sessionId,
Guid senderId, Guid senderId,

View file

@ -3,7 +3,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Kurs.Platform.Entities; namespace Kurs.Platform.Entities;
public class Participant : FullAuditedEntity<Guid> public class ClassParticipant : FullAuditedEntity<Guid>
{ {
public Guid SessionId { get; set; } public Guid SessionId { get; set; }
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
@ -16,13 +16,13 @@ public class Participant : FullAuditedEntity<Guid>
public string ConnectionId { get; set; } public string ConnectionId { get; set; }
// Navigation properties // 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 id,
Guid sessionId, Guid sessionId,
Guid? userId, Guid? userId,

View file

@ -4,7 +4,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Kurs.Platform.Entities; namespace Kurs.Platform.Entities;
public class ClassSession : FullAuditedEntity<Guid> public class Classroom : FullAuditedEntity<Guid>
{ {
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
@ -20,18 +20,18 @@ public class ClassSession : FullAuditedEntity<Guid>
public bool IsScheduled { get; set; } public bool IsScheduled { get; set; }
public int ParticipantCount { get; set; } public int ParticipantCount { get; set; }
public virtual ICollection<Participant> Participants { get; set; } public virtual ICollection<ClassParticipant> Participants { get; set; }
public virtual ICollection<AttendanceRecord> AttendanceRecords { get; set; } public virtual ICollection<ClassAttandance> AttendanceRecords { get; set; }
public virtual ICollection<ChatMessage> ChatMessages { get; set; } public virtual ICollection<ClassChat> ChatMessages { get; set; }
protected ClassSession() protected Classroom()
{ {
Participants = new HashSet<Participant>(); Participants = new HashSet<ClassParticipant>();
AttendanceRecords = new HashSet<AttendanceRecord>(); AttendanceRecords = new HashSet<ClassAttandance>();
ChatMessages = new HashSet<ChatMessage>(); ChatMessages = new HashSet<ClassChat>();
} }
public ClassSession( public Classroom(
Guid id, Guid id,
string name, string name,
string description, string description,
@ -55,9 +55,9 @@ public class ClassSession : FullAuditedEntity<Guid>
IsScheduled = true; IsScheduled = true;
ParticipantCount = 0; ParticipantCount = 0;
Participants = new HashSet<Participant>(); Participants = new HashSet<ClassParticipant>();
AttendanceRecords = new HashSet<AttendanceRecord>(); AttendanceRecords = new HashSet<ClassAttandance>();
ChatMessages = new HashSet<ChatMessage>(); ChatMessages = new HashSet<ClassChat>();
} }
public void StartClass() public void StartClass()

View file

@ -97,10 +97,10 @@ public class PlatformDbContext :
public DbSet<Demo> Demos { get; set; } public DbSet<Demo> Demos { get; set; }
public DbSet<Service> Services { get; set; } public DbSet<Service> Services { get; set; }
public DbSet<ClassSession> ClassSessions { get; set; } public DbSet<Classroom> ClassSessions { get; set; }
public DbSet<Participant> Participants { get; set; } public DbSet<ClassParticipant> Participants { get; set; }
public DbSet<AttendanceRecord> AttendanceRecords { get; set; } public DbSet<ClassAttandance> AttendanceRecords { get; set; }
public DbSet<ChatMessage> ChatMessages { get; set; } public DbSet<ClassChat> ChatMessages { get; set; }
#region Entities from the modules #region Entities from the modules
@ -882,9 +882,9 @@ public class PlatformDbContext :
}); });
// ClassSession // ClassSession
builder.Entity<ClassSession>(b => builder.Entity<Classroom>(b =>
{ {
b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassSession), PlatformConsts.DbSchema); b.ToTable(PlatformConsts.DbTablePrefix + nameof(Classroom), PlatformConsts.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(200); b.Property(x => x.Name).IsRequired().HasMaxLength(200);
@ -914,9 +914,9 @@ public class PlatformDbContext :
}); });
// Participant // Participant
builder.Entity<Participant>(b => builder.Entity<ClassParticipant>(b =>
{ {
b.ToTable(PlatformConsts.DbTablePrefix + nameof(Participant), PlatformConsts.DbSchema); b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassParticipant), PlatformConsts.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.UserName).IsRequired().HasMaxLength(100); b.Property(x => x.UserName).IsRequired().HasMaxLength(100);
@ -929,9 +929,9 @@ public class PlatformDbContext :
}); });
// AttendanceRecord // AttendanceRecord
builder.Entity<AttendanceRecord>(b => builder.Entity<ClassAttandance>(b =>
{ {
b.ToTable(PlatformConsts.DbTablePrefix + nameof(AttendanceRecord), PlatformConsts.DbSchema); b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassAttandance), PlatformConsts.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.StudentName).IsRequired().HasMaxLength(100); b.Property(x => x.StudentName).IsRequired().HasMaxLength(100);
@ -942,9 +942,9 @@ public class PlatformDbContext :
}); });
// ChatMessage // ChatMessage
builder.Entity<ChatMessage>(b => builder.Entity<ClassChat>(b =>
{ {
b.ToTable(PlatformConsts.DbTablePrefix + nameof(ChatMessage), PlatformConsts.DbSchema); b.ToTable(PlatformConsts.DbTablePrefix + nameof(ClassChat), PlatformConsts.DbSchema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.SenderName).IsRequired().HasMaxLength(100); b.Property(x => x.SenderName).IsRequired().HasMaxLength(100);

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Kurs.Platform.Migrations namespace Kurs.Platform.Migrations
{ {
[DbContext(typeof(PlatformDbContext))] [DbContext(typeof(PlatformDbContext))]
[Migration("20250826054655_Initial")] [Migration("20250826055306_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -852,72 +852,6 @@ namespace Kurs.Platform.Migrations
b.ToTable("PApiMigration", (string)null); b.ToTable("PApiMigration", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.AttendanceRecord", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTime?>("LeaveTime")
.HasColumnType("datetime2");
b.Property<Guid>("SessionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("StudentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("StudentName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int>("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 => modelBuilder.Entity("Kurs.Platform.Entities.BackgroundWorker", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -1563,7 +1497,135 @@ namespace Kurs.Platform.Migrations
b.ToTable("PChart", (string)null); b.ToTable("PChart", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.ChatMessage", b => modelBuilder.Entity("Kurs.Platform.Entities.City", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("CountryCode")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTime?>("LeaveTime")
.HasColumnType("datetime2");
b.Property<Guid>("SessionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("StudentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("StudentName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int>("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<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -1628,23 +1690,17 @@ namespace Kurs.Platform.Migrations
b.HasIndex("Timestamp"); 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<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Code") b.Property<string>("ConnectionId")
.IsRequired() .HasMaxLength(100)
.HasMaxLength(16) .HasColumnType("nvarchar(100)");
.HasColumnType("nvarchar(16)");
b.Property<string>("CountryCode")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
@ -1662,12 +1718,24 @@ namespace Kurs.Platform.Migrations
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<bool>("IsAudioMuted")
.HasColumnType("bit");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsTeacher")
.HasColumnType("bit");
b.Property<bool>("IsVideoMuted")
.HasColumnType("bit");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime") b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("LastModificationTime"); .HasColumnName("LastModificationTime");
@ -1676,24 +1744,35 @@ namespace Kurs.Platform.Migrations
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<string>("Name") b.Property<Guid>("SessionId")
.IsRequired() .HasColumnType("uniqueidentifier");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("PlateCode") b.Property<string>("UserEmail")
.HasMaxLength(20) .HasMaxLength(200)
.HasColumnType("nvarchar(20)"); .HasColumnType("nvarchar(200)");
b.Property<Guid?>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CountryCode", "Code") b.HasIndex("SessionId");
.IsUnique();
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<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -1781,7 +1860,7 @@ namespace Kurs.Platform.Migrations
b.HasIndex("TeacherId"); b.HasIndex("TeacherId");
b.ToTable("PClassSession", (string)null); b.ToTable("PClassroom", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Contact", b => modelBuilder.Entity("Kurs.Platform.Entities.Contact", b =>
@ -3277,85 +3356,6 @@ namespace Kurs.Platform.Migrations
b.ToTable("PMenu", (string)null); b.ToTable("PMenu", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Participant", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConnectionId")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsAudioMuted")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsTeacher")
.HasColumnType("bit");
b.Property<bool>("IsVideoMuted")
.HasColumnType("bit");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("SessionId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserEmail")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<Guid?>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("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 => modelBuilder.Entity("Kurs.Platform.Entities.PaymentMethod", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@ -6520,17 +6520,6 @@ namespace Kurs.Platform.Migrations
b.Navigation("Entity"); 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 => modelBuilder.Entity("Kurs.Platform.Entities.BankAccount", b =>
{ {
b.HasOne("Kurs.Platform.Entities.Bank", "Bank") b.HasOne("Kurs.Platform.Entities.Bank", "Bank")
@ -6559,17 +6548,6 @@ namespace Kurs.Platform.Migrations
b.Navigation("Category"); 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 => modelBuilder.Entity("Kurs.Platform.Entities.City", b =>
{ {
b.HasOne("Kurs.Platform.Entities.Country", "Country") b.HasOne("Kurs.Platform.Entities.Country", "Country")
@ -6582,6 +6560,39 @@ namespace Kurs.Platform.Migrations
b.Navigation("Country"); 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 => modelBuilder.Entity("Kurs.Platform.Entities.Country", b =>
{ {
b.HasOne("Kurs.Platform.Entities.CountryGroup", null) b.HasOne("Kurs.Platform.Entities.CountryGroup", null)
@ -6633,17 +6644,6 @@ namespace Kurs.Platform.Migrations
.IsRequired(); .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 => modelBuilder.Entity("Kurs.Platform.Entities.ReportGenerated", b =>
{ {
b.HasOne("Kurs.Platform.Entities.ReportTemplate", "Template") b.HasOne("Kurs.Platform.Entities.ReportTemplate", "Template")
@ -6905,7 +6905,7 @@ namespace Kurs.Platform.Migrations
b.Navigation("Districts"); b.Navigation("Districts");
}); });
modelBuilder.Entity("Kurs.Platform.Entities.ClassSession", b => modelBuilder.Entity("Kurs.Platform.Entities.Classroom", b =>
{ {
b.Navigation("AttendanceRecords"); b.Navigation("AttendanceRecords");

View file

@ -787,7 +787,7 @@ namespace Kurs.Platform.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PClassSession", name: "PClassroom",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
@ -814,7 +814,7 @@ namespace Kurs.Platform.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_PClassSession", x => x.Id); table.PrimaryKey("PK_PClassroom", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -1922,7 +1922,7 @@ namespace Kurs.Platform.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PAttendanceRecord", name: "PClassAttandance",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
@ -1942,17 +1942,17 @@ namespace Kurs.Platform.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_PAttendanceRecord", x => x.Id); table.PrimaryKey("PK_PClassAttandance", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_PAttendanceRecord_PClassSession_SessionId", name: "FK_PClassAttandance_PClassroom_SessionId",
column: x => x.SessionId, column: x => x.SessionId,
principalTable: "PClassSession", principalTable: "PClassroom",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PChatMessage", name: "PClassChat",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
@ -1972,17 +1972,17 @@ namespace Kurs.Platform.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_PChatMessage", x => x.Id); table.PrimaryKey("PK_PClassChat", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_PChatMessage_PClassSession_SessionId", name: "FK_PClassChat_PClassroom_SessionId",
column: x => x.SessionId, column: x => x.SessionId,
principalTable: "PClassSession", principalTable: "PClassroom",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PParticipant", name: "PClassParticipant",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
@ -2005,11 +2005,11 @@ namespace Kurs.Platform.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_PParticipant", x => x.Id); table.PrimaryKey("PK_PClassParticipant", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_PParticipant_PClassSession_SessionId", name: "FK_PClassParticipant_PClassroom_SessionId",
column: x => x.SessionId, column: x => x.SessionId,
principalTable: "PClassSession", principalTable: "PClassroom",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -2954,21 +2954,6 @@ namespace Kurs.Platform.Migrations
table: "PApiMigration", table: "PApiMigration",
column: "EntityId"); 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( migrationBuilder.CreateIndex(
name: "IX_MailQueueTableFormat", name: "IX_MailQueueTableFormat",
table: "PBackgroundWorker_MailQueueTableFormat", table: "PBackgroundWorker_MailQueueTableFormat",
@ -3000,21 +2985,6 @@ namespace Kurs.Platform.Migrations
table: "PBlogPost", table: "PBlogPost",
column: "Slug"); 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( migrationBuilder.CreateIndex(
name: "IX_PCity_CountryCode_Code", name: "IX_PCity_CountryCode_Code",
table: "PCity", table: "PCity",
@ -3022,18 +2992,65 @@ namespace Kurs.Platform.Migrations
unique: true); unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_PClassSession_IsActive", name: "IX_PClassAttandance_JoinTime",
table: "PClassSession", 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"); column: "IsActive");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_PClassSession_ScheduledStartTime", name: "IX_PClassroom_ScheduledStartTime",
table: "PClassSession", table: "PClassroom",
column: "ScheduledStartTime"); column: "ScheduledStartTime");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_PClassSession_TeacherId", name: "IX_PClassroom_TeacherId",
table: "PClassSession", table: "PClassroom",
column: "TeacherId"); column: "TeacherId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
@ -3115,23 +3132,6 @@ namespace Kurs.Platform.Migrations
table: "POrderItem", table: "POrderItem",
column: "OrderId"); 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( migrationBuilder.CreateIndex(
name: "IX_PReportCategory_Name", name: "IX_PReportCategory_Name",
table: "PReportCategory", table: "PReportCategory",
@ -3283,9 +3283,6 @@ namespace Kurs.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PApiMigration"); name: "PApiMigration");
migrationBuilder.DropTable(
name: "PAttendanceRecord");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PBackgroundWorker"); name: "PBackgroundWorker");
@ -3311,7 +3308,13 @@ namespace Kurs.Platform.Migrations
name: "PChart"); name: "PChart");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PChatMessage"); name: "PClassAttandance");
migrationBuilder.DropTable(
name: "PClassChat");
migrationBuilder.DropTable(
name: "PClassParticipant");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PContact"); name: "PContact");
@ -3382,9 +3385,6 @@ namespace Kurs.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "POrderItem"); name: "POrderItem");
migrationBuilder.DropTable(
name: "PParticipant");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PPaymentMethod"); name: "PPaymentMethod");
@ -3445,6 +3445,9 @@ namespace Kurs.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PBlogCategory"); name: "PBlogCategory");
migrationBuilder.DropTable(
name: "PClassroom");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PCustomEntity"); name: "PCustomEntity");
@ -3463,9 +3466,6 @@ namespace Kurs.Platform.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "POrder"); name: "POrder");
migrationBuilder.DropTable(
name: "PClassSession");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PReportTemplate"); name: "PReportTemplate");

View file

@ -849,72 +849,6 @@ namespace Kurs.Platform.Migrations
b.ToTable("PApiMigration", (string)null); b.ToTable("PApiMigration", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.AttendanceRecord", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTime?>("LeaveTime")
.HasColumnType("datetime2");
b.Property<Guid>("SessionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("StudentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("StudentName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int>("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 => modelBuilder.Entity("Kurs.Platform.Entities.BackgroundWorker", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -1560,7 +1494,135 @@ namespace Kurs.Platform.Migrations
b.ToTable("PChart", (string)null); b.ToTable("PChart", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.ChatMessage", b => modelBuilder.Entity("Kurs.Platform.Entities.City", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("CountryCode")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTime?>("LeaveTime")
.HasColumnType("datetime2");
b.Property<Guid>("SessionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("StudentId")
.HasColumnType("uniqueidentifier");
b.Property<string>("StudentName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int>("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<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -1625,23 +1687,17 @@ namespace Kurs.Platform.Migrations
b.HasIndex("Timestamp"); 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<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Code") b.Property<string>("ConnectionId")
.IsRequired() .HasMaxLength(100)
.HasMaxLength(16) .HasColumnType("nvarchar(100)");
.HasColumnType("nvarchar(16)");
b.Property<string>("CountryCode")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
@ -1659,12 +1715,24 @@ namespace Kurs.Platform.Migrations
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<bool>("IsAudioMuted")
.HasColumnType("bit");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsTeacher")
.HasColumnType("bit");
b.Property<bool>("IsVideoMuted")
.HasColumnType("bit");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime") b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("LastModificationTime"); .HasColumnName("LastModificationTime");
@ -1673,24 +1741,35 @@ namespace Kurs.Platform.Migrations
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<string>("Name") b.Property<Guid>("SessionId")
.IsRequired() .HasColumnType("uniqueidentifier");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("PlateCode") b.Property<string>("UserEmail")
.HasMaxLength(20) .HasMaxLength(200)
.HasColumnType("nvarchar(20)"); .HasColumnType("nvarchar(200)");
b.Property<Guid?>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CountryCode", "Code") b.HasIndex("SessionId");
.IsUnique();
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<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -1778,7 +1857,7 @@ namespace Kurs.Platform.Migrations
b.HasIndex("TeacherId"); b.HasIndex("TeacherId");
b.ToTable("PClassSession", (string)null); b.ToTable("PClassroom", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Contact", b => modelBuilder.Entity("Kurs.Platform.Entities.Contact", b =>
@ -3274,85 +3353,6 @@ namespace Kurs.Platform.Migrations
b.ToTable("PMenu", (string)null); b.ToTable("PMenu", (string)null);
}); });
modelBuilder.Entity("Kurs.Platform.Entities.Participant", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConnectionId")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("IsAudioMuted")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsTeacher")
.HasColumnType("bit");
b.Property<bool>("IsVideoMuted")
.HasColumnType("bit");
b.Property<DateTime>("JoinTime")
.HasColumnType("datetime2");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<Guid>("SessionId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserEmail")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<Guid?>("UserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("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 => modelBuilder.Entity("Kurs.Platform.Entities.PaymentMethod", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@ -6517,17 +6517,6 @@ namespace Kurs.Platform.Migrations
b.Navigation("Entity"); 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 => modelBuilder.Entity("Kurs.Platform.Entities.BankAccount", b =>
{ {
b.HasOne("Kurs.Platform.Entities.Bank", "Bank") b.HasOne("Kurs.Platform.Entities.Bank", "Bank")
@ -6556,17 +6545,6 @@ namespace Kurs.Platform.Migrations
b.Navigation("Category"); 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 => modelBuilder.Entity("Kurs.Platform.Entities.City", b =>
{ {
b.HasOne("Kurs.Platform.Entities.Country", "Country") b.HasOne("Kurs.Platform.Entities.Country", "Country")
@ -6579,6 +6557,39 @@ namespace Kurs.Platform.Migrations
b.Navigation("Country"); 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 => modelBuilder.Entity("Kurs.Platform.Entities.Country", b =>
{ {
b.HasOne("Kurs.Platform.Entities.CountryGroup", null) b.HasOne("Kurs.Platform.Entities.CountryGroup", null)
@ -6630,17 +6641,6 @@ namespace Kurs.Platform.Migrations
.IsRequired(); .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 => modelBuilder.Entity("Kurs.Platform.Entities.ReportGenerated", b =>
{ {
b.HasOne("Kurs.Platform.Entities.ReportTemplate", "Template") b.HasOne("Kurs.Platform.Entities.ReportTemplate", "Template")
@ -6902,7 +6902,7 @@ namespace Kurs.Platform.Migrations
b.Navigation("Districts"); b.Navigation("Districts");
}); });
modelBuilder.Entity("Kurs.Platform.Entities.ClassSession", b => modelBuilder.Entity("Kurs.Platform.Entities.Classroom", b =>
{ {
b.Navigation("AttendanceRecords"); b.Navigation("AttendanceRecords");

View file

@ -12,16 +12,16 @@ namespace Kurs.Platform.SignalR.Hubs;
[Authorize] [Authorize]
public class ClassroomHub : Hub public class ClassroomHub : Hub
{ {
private readonly IRepository<ClassSession, Guid> _classSessionRepository; private readonly IRepository<Classroom, Guid> _classSessionRepository;
private readonly IRepository<Participant, Guid> _participantRepository; private readonly IRepository<ClassParticipant, Guid> _participantRepository;
private readonly IRepository<ChatMessage, Guid> _chatMessageRepository; private readonly IRepository<ClassChat, Guid> _chatMessageRepository;
private readonly ILogger<ClassroomHub> _logger; private readonly ILogger<ClassroomHub> _logger;
private readonly IGuidGenerator _guidGenerator; private readonly IGuidGenerator _guidGenerator;
public ClassroomHub( public ClassroomHub(
IRepository<ClassSession, Guid> classSessionRepository, IRepository<Classroom, Guid> classSessionRepository,
IRepository<Participant, Guid> participantRepository, IRepository<ClassParticipant, Guid> participantRepository,
IRepository<ChatMessage, Guid> chatMessageRepository, IRepository<ClassChat, Guid> chatMessageRepository,
ILogger<ClassroomHub> logger, ILogger<ClassroomHub> logger,
IGuidGenerator guidGenerator) IGuidGenerator guidGenerator)
{ {
@ -91,7 +91,7 @@ public class ClassroomHub : Hub
var isTeacher = participant?.IsTeacher ?? false; var isTeacher = participant?.IsTeacher ?? false;
// Save message to database // Save message to database
var chatMessage = new ChatMessage( var chatMessage = new ClassChat(
_guidGenerator.Create(), _guidGenerator.Create(),
sessionId, sessionId,
userId, userId,