Classrooms seeder düzenlemesi

This commit is contained in:
Sedat ÖZTÜRK 2025-08-27 12:07:35 +03:00
parent 87f04ca653
commit 9d88671c3a
4 changed files with 116 additions and 22 deletions

View file

@ -24,7 +24,6 @@ using EFCore.BulkExtensions;
using System.Collections.Generic;
using Kurs.Platform.Contacts;
using static Kurs.Settings.SettingsConsts;
using DocumentFormat.OpenXml.Wordprocessing;
namespace Kurs.Platform.Data.Seeds;
@ -69,6 +68,7 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository<Service, Guid> _servicesRepository;
private readonly IRepository<About, Guid> _aboutRepository;
private readonly IRepository<Contact, Guid> _contactRepository;
private readonly IRepository<Classroom, Guid> _classroomRepository;
public PlatformDataSeeder(
IRepository<Language, Guid> languages,
@ -100,16 +100,17 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
IRepository<BlogPost, Guid> blogPostsRepository,
IRepository<ForumCategory, Guid> forumCategoryRepository,
IRepository<AiBot, Guid> aiBotRepository,
IRepository<Route, Guid> RouteRepository,
IRepository<CustomEndpoint, Guid> CustomEndpointRepository,
IRepository<Product, Guid> ProductRepository,
IRepository<PaymentMethod, String> PaymentMethodRepository,
IRepository<InstallmentOption, Guid> InstallmentOptionRepository,
IRepository<CustomComponent, Guid> CustomComponentRepository,
IRepository<ReportCategory, Guid> ReportCategoriesRepository,
IRepository<Service, Guid> ServicesRepository,
IRepository<About, Guid> AboutRepository,
IRepository<Contact, Guid> ContactRepository
IRepository<Route, Guid> routeRepository,
IRepository<CustomEndpoint, Guid> customEndpointRepository,
IRepository<Product, Guid> productRepository,
IRepository<PaymentMethod, String> paymentMethodRepository,
IRepository<InstallmentOption, Guid> installmentOptionRepository,
IRepository<CustomComponent, Guid> customComponentRepository,
IRepository<ReportCategory, Guid> reportCategoriesRepository,
IRepository<Service, Guid> servicesRepository,
IRepository<About, Guid> aboutRepository,
IRepository<Contact, Guid> contactRepository,
IRepository<Classroom, Guid> classroomRepository
)
{
_languages = languages;
@ -141,16 +142,17 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
_blogPostsRepository = blogPostsRepository;
_forumCategoryRepository = forumCategoryRepository;
_aiBotRepository = aiBotRepository;
_routeRepository = RouteRepository;
_customEndpointRepository = CustomEndpointRepository;
_productRepository = ProductRepository;
_paymentMethodRepository = PaymentMethodRepository;
_installmentOptionRepository = InstallmentOptionRepository;
_customComponentRepository = CustomComponentRepository;
_reportCategoriesRepository = ReportCategoriesRepository;
_servicesRepository = ServicesRepository;
_aboutRepository = AboutRepository;
_contactRepository = ContactRepository;
_routeRepository = routeRepository;
_customEndpointRepository = customEndpointRepository;
_productRepository = productRepository;
_paymentMethodRepository = paymentMethodRepository;
_installmentOptionRepository = installmentOptionRepository;
_customComponentRepository = customComponentRepository;
_reportCategoriesRepository = reportCategoriesRepository;
_servicesRepository = servicesRepository;
_aboutRepository = aboutRepository;
_contactRepository = contactRepository;
_classroomRepository = classroomRepository;
}
private static IConfigurationRoot BuildConfiguration()
@ -1030,6 +1032,29 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
}
}
foreach (var item in items.Classrooms)
{
var exists = await _classroomRepository.AnyAsync(x => x.Name == item.Name);
if (!exists)
{
await _classroomRepository.InsertAsync(new Classroom(
Guid.NewGuid(),
item.Name,
item.Description,
item.Subject,
item.TeacherId,
item.TeacherName,
item.ScheduledStartTime,
item.Duration,
item.MaxParticipants,
item.IsActive,
item.IsScheduled,
item.SettingsJson
));
}
}
await SeedCountyGroupsAsync();
await SeedCountriesAsync();

View file

@ -17674,5 +17674,55 @@
"referrerPolicy": "no-referrer-when-downgrade"
}
}
],
"Classrooms": [
{
"name": "Matematik 101 - Diferansiyel Denklemler",
"description": "İleri matematik konuları ve uygulamaları",
"subject": "Matematik",
"teacherId": "995220ff-2751-afd6-3d99-3a1bfc55f78e",
"teacherName": "Prof. Dr. Mehmet Özkan",
"scheduledStartTime": "2025-08-27T10:00:00Z",
"actualStartTime": "",
"endTime": "",
"duration": 90,
"maxParticipants": 30,
"isActive": false,
"isScheduled": true,
"participantCount": 0,
"settingsJson": null
},
{
"name": "Fizik 201 - Kuantum Mekaniği",
"description": "Modern fizik ve kuantum teorisi temelleri",
"subject": "Fizik",
"teacherId": "995220ff-2751-afd6-3d99-3a1bfc55f78e",
"teacherName": "Dr. Ayşe Kaya",
"scheduledStartTime": "2025-08-26T10:00:00Z",
"actualStartTime": "",
"endTime": "",
"duration": 120,
"maxParticipants": 25,
"isActive": false,
"isScheduled": true,
"participantCount": 0,
"settingsJson": null
},
{
"name": "Kimya 301 - Organik Kimya",
"description": "Organik bileşikler ve reaksiyon mekanizmaları",
"subject": "Kimya",
"teacherId": "995220ff-2751-afd6-3d99-3a1bfc55f78e",
"teacherName": "Dr. Ali Veli",
"scheduledStartTime": "2025-08-28T10:00:00Z",
"actualStartTime": "",
"endTime": "",
"duration": 75,
"maxParticipants": 20,
"isActive": false,
"isScheduled": true,
"participantCount": 0,
"settingsJson": null
}
]
}

View file

@ -46,6 +46,7 @@ public class SeederDto
public List<ServiceSeedDto> Services { get; set; }
public List<AboutSeedDto> Abouts { get; set; }
public List<ContactSeedDto> Contacts { get; set; }
public List<ClassroomSeedDto> Classrooms { get; set; }
}
public class ChartsSeedDto
@ -324,4 +325,22 @@ public class ContactSeedDto
public BankDto Bank { get; set; }
public WorkHoursDto WorkHour { get; set; }
public MapDto Map { get; set; }
}
public class ClassroomSeedDto
{
public string Name { get; set; }
public string Description { get; set; }
public string Subject { get; set; }
public Guid? TeacherId { get; set; }
public string TeacherName { get; set; }
public DateTime ScheduledStartTime { get; set; }
public DateTime? ActualStartTime { get; set; }
public DateTime? EndTime { get; set; }
public int Duration { get; set; }
public int MaxParticipants { get; set; }
public bool IsActive { get; set; }
public bool IsScheduled { get; set; }
public int ParticipantCount { get; set; }
public string SettingsJson { get; set; }
}

View file

@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.8cs01edqoio"
"revision": "0.cb06g8q0ck8"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {