From 8254ce6736088fb42ed833e2b4f83182916410b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?=
<76204082+iamsedatozturk@users.noreply.github.com>
Date: Tue, 28 Oct 2025 15:44:14 +0300
Subject: [PATCH] =?UTF-8?q?Intranet=20SocialPost=20PoolOptions=20d=C3=BCze?=
=?UTF-8?q?nlemesi?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
....cs => 20251028123320_Initial.Designer.cs} | 2 +-
...5_Initial.cs => 20251028123320_Initial.cs} | 0
.../Tenants/Seeds/TenantData.json | 32 +++++++++++++++----
.../Tenants/TenantDataSeeder.cs | 25 +++++++++++++++
.../Tenants/TenantSeederDto.cs | 3 ++
5 files changed, 55 insertions(+), 7 deletions(-)
rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251028102645_Initial.Designer.cs => 20251028123320_Initial.Designer.cs} (99%)
rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20251028102645_Initial.cs => 20251028123320_Initial.cs} (100%)
diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028102645_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028123320_Initial.Designer.cs
similarity index 99%
rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028102645_Initial.Designer.cs
rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028123320_Initial.Designer.cs
index f8d9e35f..86bfa25d 100644
--- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028102645_Initial.Designer.cs
+++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028123320_Initial.Designer.cs
@@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Kurs.Platform.Migrations
{
[DbContext(typeof(PlatformDbContext))]
- [Migration("20251028102645_Initial")]
+ [Migration("20251028123320_Initial")]
partial class Initial
{
///
diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028102645_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028123320_Initial.cs
similarity index 100%
rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028102645_Initial.cs
rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251028123320_Initial.cs
diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json
index 87b6643e..e75abe57 100644
--- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json
+++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json
@@ -3942,12 +3942,6 @@
"postContent": "Bu hafta sprint planlamasını yaptık. Ekibimizle birlikte yeni özellikleri değerlendirdik. Heyecan verici bir hafta olacak!",
"type": "poll",
"pollQuestion": "Hangi özelliği öncelikli olarak geliştirmeliyiz?",
- "pollOptions": [
- { "text": "Kullanıcı profilleri", "votes": 12 },
- { "text": "Bildirim sistemi", "votes": 8 },
- { "text": "Mesajlaşma", "votes": 15 },
- { "text": "Raporlama", "votes": 5 }
- ],
"pollTotalVotes": 40,
"pollEndsAt": "2024-10-20T23:59:59",
"pollUserVoteId": "p3"
@@ -3967,6 +3961,32 @@
"urls": ["https://www.w3schools.com/html/mov_bbb.mp4"]
}
],
+ "SocialPollOptions": [
+ {
+ "postContent": "Bu hafta sprint planlamasını yaptık. Ekibimizle birlikte yeni özellikleri değerlendirdik. Heyecan verici bir hafta olacak!",
+ "pollQuestion": "Hangi özelliği öncelikli olarak geliştirmeliyiz?",
+ "Text": "Kullanıcı profilleri",
+ "Votes": 12
+ },
+ {
+ "postContent": "Bu hafta sprint planlamasını yaptık. Ekibimizle birlikte yeni özellikleri değerlendirdik. Heyecan verici bir hafta olacak!",
+ "pollQuestion": "Hangi özelliği öncelikli olarak geliştirmeliyiz?",
+ "Text": "Bildirim sistemi",
+ "Votes": 8
+ },
+ {
+ "postContent": "Bu hafta sprint planlamasını yaptık. Ekibimizle birlikte yeni özellikleri değerlendirdik. Heyecan verici bir hafta olacak!",
+ "pollQuestion": "Hangi özelliği öncelikli olarak geliştirmeliyiz?",
+ "Text": "Mesajlaşma",
+ "Votes": 15
+ },
+ {
+ "postContent": "Bu hafta sprint planlamasını yaptık. Ekibimizle birlikte yeni özellikleri değerlendirdik. Heyecan verici bir hafta olacak!",
+ "pollQuestion": "Hangi özelliği öncelikli olarak geliştirmeliyiz?",
+ "Text": "Raporlama",
+ "Votes": 5
+ }
+ ],
"SocialComments": [
{
"postContent": "Yeni proje üzerinde çalışıyoruz! React ve TypeScript ile harika bir deneyim oluşturuyoruz. Ekip çalışması harika gidiyor! 🚀",
diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs
index 1f7a315a..5fa06216 100644
--- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs
+++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs
@@ -85,6 +85,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository _socialPostRepository;
private readonly IRepository _socialLocationRepository;
private readonly IRepository _socialMediaRepository;
+ private readonly IRepository _socialPollOptionRepository;
private readonly IRepository _socialCommentRepository;
private readonly IRepository _socialLikeRepository;
@@ -156,6 +157,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
IRepository socialPostRepository,
IRepository socialLocationRepository,
IRepository socialMediaRepository,
+ IRepository socialPollOptionRepository,
IRepository socialCommentRepository,
IRepository socialLikeRepository
)
@@ -228,6 +230,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
_socialPostRepository = socialPostRepository;
_socialLocationRepository = socialLocationRepository;
_socialMediaRepository = socialMediaRepository;
+ _socialPollOptionRepository = socialPollOptionRepository;
_socialCommentRepository = socialCommentRepository;
_socialLikeRepository = socialLikeRepository;
}
@@ -1474,6 +1477,28 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
}, autoSave: true);
}
+ foreach (var item in items.SocialPollOptions)
+ {
+ var post = await _socialPostRepository.FirstOrDefaultAsync(x => x.Content == item.PostContent);
+ if (post == null)
+ continue;
+
+ var media = await _socialMediaRepository.FirstOrDefaultAsync(x => x.SocialPostId == post.Id && x.PollQuestion == item.PollQuestion);
+ if (media == null)
+ continue;
+
+ var exists = await _socialPollOptionRepository.AnyAsync(x => x.SocialMediaId == media.Id && x.Text == item.Text);
+ if (exists)
+ continue;
+
+ await _socialPollOptionRepository.InsertAsync(new SocialPollOption
+ {
+ SocialMediaId = media != null ? media.Id : Guid.Empty,
+ Text = item.Text,
+ Votes = item.Votes
+ }, autoSave: true);
+ }
+
foreach (var item in items.SocialComments)
{
var post = await _socialPostRepository.FirstOrDefaultAsync(x => x.Content == item.PostContent);
diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs
index 9faccd15..d7b93eaf 100644
--- a/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs
+++ b/api/src/Kurs.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs
@@ -74,6 +74,7 @@ public class TenantSeederDto
public List SocialPosts { get; set; }
public List SocialLocations { get; set; }
public List SocialMedias { get; set; }
+ public List SocialPollOptions { get; set; }
public List SocialComments { get; set; }
public List SocialLikes { get; set; }
}
@@ -113,6 +114,8 @@ public class SocialMediaSeedDto
public class SocialPollOptionSeedDto
{
+ public string PostContent { get; set; }
+ public string PollQuestion { get; set; }
public string Text { get; set; }
public int Votes { get; set; }
}