From b5c61e9a6d1499c0b2f7c570231b635272c439af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Tue, 28 Oct 2025 21:59:07 +0300 Subject: [PATCH] Intranet Dashboard Events --- .../Intranet/IntranetAppService.cs | 8 +- .../Entities/Tenant/Hr/Event.cs | 8 +- .../Entities/Tenant/Hr/EventComment.cs | 4 +- .../EntityFrameworkCore/PlatformDbContext.cs | 2 +- ....cs => 20251028185430_Initial.Designer.cs} | 26 ++- ...3_Initial.cs => 20251028185430_Initial.cs} | 205 +++++++++--------- .../PlatformDbContextModelSnapshot.cs | 24 +- .../Tenants/Seeds/TenantData.json | 112 +++++++--- .../Tenants/TenantDataSeeder.cs | 42 +++- .../Tenants/TenantSeederDto.cs | 11 +- 10 files changed, 287 insertions(+), 155 deletions(-) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251028175633_Initial.Designer.cs => 20251028185430_Initial.Designer.cs} (99%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251028175633_Initial.cs => 20251028185430_Initial.cs} (99%) diff --git a/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs b/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs index 6f008e89..36386650 100644 --- a/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs +++ b/api/src/Kurs.Platform.Application/Intranet/IntranetAppService.cs @@ -53,7 +53,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService { var employee = await _employeeRepository .WithDetailsAsync(e => e.JobPosition) - .ContinueWith(t => t.Result.FirstOrDefault(e => e.Id == evt.OrganizerId)); + .ContinueWith(t => t.Result.FirstOrDefault(e => e.Id == evt.EmployeeId)); if (employee != null) { @@ -73,7 +73,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService Avatar = employee.Avatar }, Participants = evt.ParticipantsCount, - Photos = evt.Photos?.Select(p => p.Url).ToList() ?? new List(), + Photos = evt.Photos?.Select(p => p.Url).ToList() ?? [], Comments = [], Likes = evt.Likes, IsPublished = evt.isPublished @@ -86,7 +86,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService { var commentAuthor = await _employeeRepository .WithDetailsAsync(e => e.JobPosition) - .ContinueWith(t => t.Result.FirstOrDefault(e => e.Id == comment.UserId)); + .ContinueWith(t => t.Result.FirstOrDefault(e => e.Id == comment.EmployeeId)); if (commentAuthor != null) { @@ -100,7 +100,7 @@ public class IntranetAppService : PlatformAppService, IIntranetAppService Position = commentAuthor.JobPosition.Name, Avatar = commentAuthor.Avatar }, - Content = comment.Comment, + Content = comment.Content, CreationTime = comment.CreationTime, Likes = comment.Likes }); diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs index 50803349..09c1d6a8 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/Event.cs @@ -17,15 +17,15 @@ public class Event : FullAuditedEntity, IMultiTenant public string Description { get; set; } public string Status { get; set; } - public Guid OrganizerId { get; set; } - // public HrEmployee Organizer { get; set; } + public Guid EmployeeId { get; set; } + public Employee Employee { get; set; } public int ParticipantsCount { get; set; } - // public ICollection Participants { get; set; } = new List(); - // Medya ve etkileşim + // public ICollection Participants { get; set; } = []; public ICollection Photos { get; set; } = []; public ICollection Comments { get; set; } = []; + public int Likes { get; set; } public bool isPublished { get; set; } = false; diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventComment.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventComment.cs index 1127a19e..c613fa62 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventComment.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Hr/EventComment.cs @@ -9,8 +9,8 @@ public class EventComment : FullAuditedEntity, IMultiTenant public Guid? TenantId { get; set; } public Guid EventId { get; set; } - public Guid UserId { get; set; } - public string Comment { get; set; } + public Guid EmployeeId { get; set; } + public string Content { get; set; } public int Likes { get; set; } public Event Event { get; set; } diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index dafad733..2ed2c785 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -1148,7 +1148,7 @@ public class PlatformDbContext : b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.EventComment)), Prefix.DbSchema); b.ConfigureByConvention(); - b.Property(x => x.Comment).HasMaxLength(500); + b.Property(x => x.Content).HasMaxLength(500); b.Property(x => x.Likes).HasDefaultValue(0); // Event -> EventComment (1 - N) diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028175633_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028175633_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.Designer.cs index 1772e12d..e7d9241c 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028175633_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251028175633_Initial")] + [Migration("20251028185430_Initial")] partial class Initial { /// @@ -3740,6 +3740,9 @@ namespace Kurs.Platform.Migrations .HasMaxLength(1000) .HasColumnType("nvarchar(1000)"); + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -3762,9 +3765,6 @@ namespace Kurs.Platform.Migrations .HasMaxLength(200) .HasColumnType("nvarchar(200)"); - b.Property("OrganizerId") - .HasColumnType("uniqueidentifier"); - b.Property("ParticipantsCount") .HasColumnType("int"); @@ -3792,6 +3792,8 @@ namespace Kurs.Platform.Migrations b.HasIndex("CategoryId"); + b.HasIndex("EmployeeId"); + b.HasIndex("TypeId"); b.ToTable("T_Net_Event", (string)null); @@ -3851,7 +3853,7 @@ namespace Kurs.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Comment") + b.Property("Content") .HasMaxLength(500) .HasColumnType("nvarchar(500)"); @@ -3871,6 +3873,9 @@ namespace Kurs.Platform.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + b.Property("EventId") .HasColumnType("uniqueidentifier"); @@ -3897,9 +3902,6 @@ namespace Kurs.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - b.HasKey("Id"); b.HasIndex("EventId"); @@ -11721,6 +11723,12 @@ namespace Kurs.Platform.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("Kurs.Platform.Entities.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Kurs.Platform.Entities.EventType", "Type") .WithMany("Events") .HasForeignKey("TypeId") @@ -11729,6 +11737,8 @@ namespace Kurs.Platform.Migrations b.Navigation("Category"); + b.Navigation("Employee"); + b.Navigation("Type"); }); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028175633_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028175633_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.cs index dead953f..7ad46960 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028175633_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028185430_Initial.cs @@ -3338,47 +3338,6 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "T_Net_Event", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - CategoryId = table.Column(type: "uniqueidentifier", nullable: false), - TypeId = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - Place = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), - Status = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - OrganizerId = table.Column(type: "uniqueidentifier", nullable: false), - ParticipantsCount = table.Column(type: "int", nullable: false), - Likes = table.Column(type: "int", nullable: false), - isPublished = table.Column(type: "bit", nullable: false, defaultValue: false), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_T_Net_Event", x => x.Id); - table.ForeignKey( - name: "FK_T_Net_Event_T_Net_EventCategory_CategoryId", - column: x => x.CategoryId, - principalTable: "T_Net_EventCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_T_Net_Event_T_Net_EventType_TypeId", - column: x => x.TypeId, - principalTable: "T_Net_EventType", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - migrationBuilder.CreateTable( name: "T_Sas_ApiEndpoint", columns: table => new @@ -3806,62 +3765,6 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "T_Net_EventComment", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - EventId = table.Column(type: "uniqueidentifier", nullable: false), - UserId = table.Column(type: "uniqueidentifier", nullable: false), - Comment = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - Likes = table.Column(type: "int", nullable: false, defaultValue: 0), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_T_Net_EventComment", x => x.Id); - table.ForeignKey( - name: "FK_T_Net_EventComment_T_Net_Event_EventId", - column: x => x.EventId, - principalTable: "T_Net_Event", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "T_Net_EventPhoto", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - EventId = table.Column(type: "uniqueidentifier", nullable: false), - Url = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_T_Net_EventPhoto", x => x.Id); - table.ForeignKey( - name: "FK_T_Net_EventPhoto_T_Net_Event_EventId", - column: x => x.EventId, - principalTable: "T_Net_Event", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "T_Sas_ReportGenerated", columns: table => new @@ -4432,6 +4335,53 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "T_Net_Event", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + CategoryId = table.Column(type: "uniqueidentifier", nullable: false), + TypeId = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Place = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), + Status = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), + EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), + ParticipantsCount = table.Column(type: "int", nullable: false), + Likes = table.Column(type: "int", nullable: false), + isPublished = table.Column(type: "bit", nullable: false, defaultValue: false), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Net_Event", x => x.Id); + table.ForeignKey( + name: "FK_T_Net_Event_T_Hr_Employee_EmployeeId", + column: x => x.EmployeeId, + principalTable: "T_Hr_Employee", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_T_Net_Event_T_Net_EventCategory_CategoryId", + column: x => x.CategoryId, + principalTable: "T_Net_EventCategory", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_T_Net_Event_T_Net_EventType_TypeId", + column: x => x.TypeId, + principalTable: "T_Net_EventType", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "T_Net_Reservation", columns: table => new @@ -4565,6 +4515,62 @@ namespace Kurs.Platform.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "T_Net_EventComment", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EventId = table.Column(type: "uniqueidentifier", nullable: false), + EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), + Content = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Likes = table.Column(type: "int", nullable: false, defaultValue: 0), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Net_EventComment", x => x.Id); + table.ForeignKey( + name: "FK_T_Net_EventComment_T_Net_Event_EventId", + column: x => x.EventId, + principalTable: "T_Net_Event", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "T_Net_EventPhoto", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EventId = table.Column(type: "uniqueidentifier", nullable: false), + Url = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_T_Net_EventPhoto", x => x.Id); + table.ForeignKey( + name: "FK_T_Net_EventPhoto_T_Net_Event_EventId", + column: x => x.EventId, + principalTable: "T_Net_Event", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "T_Net_SocialComment", columns: table => new @@ -5420,6 +5426,11 @@ namespace Kurs.Platform.Migrations table: "T_Net_Event", column: "CategoryId"); + migrationBuilder.CreateIndex( + name: "IX_T_Net_Event_EmployeeId", + table: "T_Net_Event", + column: "EmployeeId"); + migrationBuilder.CreateIndex( name: "IX_T_Net_Event_TypeId", table: "T_Net_Event", diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index cb6c435c..e3d77282 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -3737,6 +3737,9 @@ namespace Kurs.Platform.Migrations .HasMaxLength(1000) .HasColumnType("nvarchar(1000)"); + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("bit") @@ -3759,9 +3762,6 @@ namespace Kurs.Platform.Migrations .HasMaxLength(200) .HasColumnType("nvarchar(200)"); - b.Property("OrganizerId") - .HasColumnType("uniqueidentifier"); - b.Property("ParticipantsCount") .HasColumnType("int"); @@ -3789,6 +3789,8 @@ namespace Kurs.Platform.Migrations b.HasIndex("CategoryId"); + b.HasIndex("EmployeeId"); + b.HasIndex("TypeId"); b.ToTable("T_Net_Event", (string)null); @@ -3848,7 +3850,7 @@ namespace Kurs.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); - b.Property("Comment") + b.Property("Content") .HasMaxLength(500) .HasColumnType("nvarchar(500)"); @@ -3868,6 +3870,9 @@ namespace Kurs.Platform.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + b.Property("EventId") .HasColumnType("uniqueidentifier"); @@ -3894,9 +3899,6 @@ namespace Kurs.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("TenantId"); - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - b.HasKey("Id"); b.HasIndex("EventId"); @@ -11718,6 +11720,12 @@ namespace Kurs.Platform.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("Kurs.Platform.Entities.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Kurs.Platform.Entities.EventType", "Type") .WithMany("Events") .HasForeignKey("TypeId") @@ -11726,6 +11734,8 @@ namespace Kurs.Platform.Migrations b.Navigation("Category"); + b.Navigation("Employee"); + b.Navigation("Type"); }); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index ee7b058b..874f7bcb 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -100,7 +100,9 @@ "props": null, "description": null, "isActive": true, - "dependencies": ["AxiosListComponent"] + "dependencies": [ + "AxiosListComponent" + ] } ], "ReportCategories": [ @@ -1548,85 +1550,138 @@ } ], "EventComments": [ - + { + "EventName": "Yaz Futbol Turnuvası 2025", + "EmployeeCode": "EMP-001", + "Content": "Muhteşem bir gündü! Yılın en güzel etkinliği 🎉", + "Likes": 12 + }, + { + "EventName": "Yaz Futbol Turnuvası 2025", + "EmployeeCode": "EMP-002", + "Content": "Voleybol turnuvası harikaydı, gelecek yıl yine yapalım!", + "Likes": 8 + }, + { + "EventName": "Kültür Gezisi: Kapadokya", + "EmployeeCode": "EMP-004", + "Content": "Ekibimiz 2. oldu! Çok gurur duydum herkesle 💪", + "Likes": 15 + }, + { + "EventName": "Kültür Gezisi: Kapadokya", + "EmployeeCode": "EMP-004", + "Content": "Gece boyunca kod yazmak ve pizza yemek priceless! 🍕", + "Likes": 10 + }, + { + "EventName": "Müzik Dinletisi: Jazz Akşamı", + "EmployeeCode": "EMP-001", + "Content": "İT departmanı şampiyon oldu! Gelecek sene kupayı koruyacağız 🏆", + "Likes": 18 + }, + { + "EventName": "Müzik Dinletisi: Jazz Akşamı", + "EmployeeCode": "EMP-002", + "Content": "Yılın en şık gecesi! Organizasyon mükemmeldi 👏", + "Likes": 25 + }, + { + "EventName": "Müzik Dinletisi: Jazz Akşamı", + "EmployeeCode": "EMP-002", + "Content": "Tombala hediyelerim harika, çok teşekkürler! 🎁", + "Likes": 14 + }, + { + "EventName": "Müzik Dinletisi: Jazz Akşamı", + "EmployeeCode": "EMP-006", + "Content": "Müzik grubunuz süperdi, dans pistinden ayrılamadık! 🎵", + "Likes": 19 + }, + { + "EventName": "Müzik Dinletisi: Jazz Akşamı", + "EmployeeCode": "EMP-002", + "Content": "İlk defa ebru yaptım, çok huzurlu bir deneyimdi 🎨", + "Likes": 11 + } ], "EventPhotos": [ { - "Name": "Yaz Futbol Turnuvası 2025", + "EventName": "Yaz Futbol Turnuvası 2025", "Url": "https://images.unsplash.com/photo-1530541930197-ff16ac917b0e?w=800" }, { - "Name": "Yaz Futbol Turnuvası 2025", + "EventName": "Yaz Futbol Turnuvası 2025", "Url": "https://images.unsplash.com/photo-1527529482837-4698179dc6ce?w=800" }, { - "Name": "Yaz Futbol Turnuvası 2025", + "EventName": "Yaz Futbol Turnuvası 2025", "Url": "https://images.unsplash.com/photo-1528605105345-5344ea20e269?w=800" }, { - "Name": "Yaz Futbol Turnuvası 2025", + "EventName": "Yaz Futbol Turnuvası 2025", "Url": "https://images.unsplash.com/photo-1504196606672-aef5c9cefc92?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1504384308090-c894fdcc538d?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1531482615713-2afd69097998?w=800" }, { - "Name": "Müzik Dinletisi: Jazz Akşamı", + "EventName": "Müzik Dinletisi: Jazz Akşamı", "Url": "hhttps://images.unsplash.com/photo-1579952363873-27f3bade9f55?w=800" }, { - "Name": "Müzik Dinletisi: Jazz Akşamı", + "EventName": "Müzik Dinletisi: Jazz Akşamı", "Url": "https://images.unsplash.com/photo-1574629810360-7efbbe195018?w=800" }, { - "Name": "Müzik Dinletisi: Jazz Akşamı", + "EventName": "Müzik Dinletisi: Jazz Akşamı", "Url": "https://images.unsplash.com/photo-1431324155629-1a6deb1dec8d?w=800" }, { - "Name": "Müzik Dinletisi: Jazz Akşamı", + "EventName": "Müzik Dinletisi: Jazz Akşamı", "Url": "https://images.unsplash.com/photo-1553778263-73a83bab9b0c?w=800" }, { - "Name": "Müzik Dinletisi: Jazz Akşamı", + "EventName": "Müzik Dinletisi: Jazz Akşamı", "Url": "https://images.unsplash.com/photo-1511795409834-ef04bbd61622?w=800" }, { - "Name": "Yaz Futbol Turnuvası 2025", + "EventName": "Yaz Futbol Turnuvası 2025", "Url": "https://images.unsplash.com/photo-1519167758481-83f29da8c2b9?w=800" }, { - "Name": "Yaz Futbol Turnuvası 2025", + "EventName": "Yaz Futbol Turnuvası 2025", "Url": "https://images.unsplash.com/photo-1464366400600-7168b8af9bc3?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1478147427282-58a87a120781?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1492684223066-81342ee5ff30?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1513364776144-60967b0f800f?w=800" }, { - "Name": "Kültür Gezisi: Kapadokya", + "EventName": "Kültür Gezisi: Kapadokya", "Url": "https://images.unsplash.com/photo-1515405295579-ba7b45403062?w=800" - } + } ], "MeetingMethods": [ { @@ -2350,7 +2405,12 @@ "minSalary": 80000, "maxSalary": 120000, "currencyCode": "USD", - "requiredSkills": ["JavaScript", "TypeScript", "React", "Node.js"], + "requiredSkills": [ + "JavaScript", + "TypeScript", + "React", + "Node.js" + ], "responsibilities": [ "Develop frontend and backend applications", "Write clean and maintainable code", @@ -4042,7 +4102,9 @@ { "postContent": "CI/CD pipeline güncellememiz tamamlandı! Deployment süremiz %40 azaldı. Otomasyonun gücü 💪", "type": "video", - "urls": ["https://www.w3schools.com/html/mov_bbb.mp4"] + "urls": [ + "https://www.w3schools.com/html/mov_bbb.mp4" + ] } ], "SocialPollOptions": [ @@ -4123,4 +4185,4 @@ "employeeCode": "EMP-003" } ] -} +} \ No newline at end of file diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index c3032158..bbdf4578 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -1513,7 +1513,12 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency if (!exists) { - await _eventCategoryRepository.InsertAsync(new EventCategory { Name = item.Name }, autoSave: true); + await _eventCategoryRepository.InsertAsync( + new EventCategory + { + Name = item.Name + }, autoSave: true + ); } } @@ -1536,28 +1541,53 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency Name = item.Name, Place = item.Place, Description = item.Description, - OrganizerId = employee.Id, + EmployeeId = employee.Id, Status = item.Status, ParticipantsCount = item.ParticipantsCount, Likes = item.Likes, isPublished = item.IsPublished, - }); + }, autoSave: true); } } } - + foreach (var item in items.EventPhotos) { var exists = await _eventPhotoRepository.AnyAsync(x => x.Url == item.Url); if (!exists) { - var eventEntity = await _eventRepository.FirstOrDefaultAsync(x => x.Name == item.Name); + var eventEntity = await _eventRepository.FirstOrDefaultAsync(x => x.Name == item.EventName); await _eventPhotoRepository.InsertAsync(new EventPhoto { EventId = eventEntity.Id, Url = item.Url - }, autoSave: true); + }); + } + } + + foreach (var item in items.EventComments) + { + var eventEntity = await _eventRepository.FirstOrDefaultAsync(x => x.Name == item.EventName); + + if (eventEntity == null) + continue; + + var exists = await _eventCommentRepository.AnyAsync(x => x.Content == item.Content); + if (!exists) + { + var employee = await _employeeRepository.FirstOrDefaultAsync(x => x.Code == item.EmployeeCode); + + if (employee == null) + continue; + + await _eventCommentRepository.InsertAsync(new EventComment + { + EventId = eventEntity.Id, + Content = item.Content, + EmployeeId = employee.Id, + Likes = item.Likes + }); } } } diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index c86ec22d..2019565f 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -47,6 +47,7 @@ public class TenantSeederDto public List EventCategories { get; set; } public List Events { get; set; } public List EventPhotos { get; set; } + public List EventComments { get; set; } public List Sources { get; set; } public List Interesting { get; set; } public List Programs { get; set; } @@ -80,9 +81,17 @@ public class TenantSeederDto public List SocialLikes { get; set; } } +public class EventCommentSeedDto +{ + public string EventName { get; set; } + public string EmployeeCode { get; set; } + public string Content { get; set; } + public int Likes { get; set; } +} + public class EventPhotoSeedDto { - public string Name { get; set; } + public string EventName { get; set; } public string Url { get; set; } }