Intranet SocialPost PoolOptions düzenlemesi
This commit is contained in:
parent
533480cc04
commit
8254ce6736
5 changed files with 55 additions and 7 deletions
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
|||
namespace Kurs.Platform.Migrations
|
||||
{
|
||||
[DbContext(typeof(PlatformDbContext))]
|
||||
[Migration("20251028102645_Initial")]
|
||||
[Migration("20251028123320_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
|
@ -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! 🚀",
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
private readonly IRepository<SocialPost, Guid> _socialPostRepository;
|
||||
private readonly IRepository<SocialLocation, Guid> _socialLocationRepository;
|
||||
private readonly IRepository<SocialMedia, Guid> _socialMediaRepository;
|
||||
private readonly IRepository<SocialPollOption, Guid> _socialPollOptionRepository;
|
||||
private readonly IRepository<SocialComment, Guid> _socialCommentRepository;
|
||||
private readonly IRepository<SocialLike, Guid> _socialLikeRepository;
|
||||
|
||||
|
|
@ -156,6 +157,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
IRepository<SocialPost, Guid> socialPostRepository,
|
||||
IRepository<SocialLocation, Guid> socialLocationRepository,
|
||||
IRepository<SocialMedia, Guid> socialMediaRepository,
|
||||
IRepository<SocialPollOption, Guid> socialPollOptionRepository,
|
||||
IRepository<SocialComment, Guid> socialCommentRepository,
|
||||
IRepository<SocialLike, Guid> 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);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class TenantSeederDto
|
|||
public List<SocialPostSeedDto> SocialPosts { get; set; }
|
||||
public List<SocialLocationSeedDto> SocialLocations { get; set; }
|
||||
public List<SocialMediaSeedDto> SocialMedias { get; set; }
|
||||
public List<SocialPollOptionSeedDto> SocialPollOptions { get; set; }
|
||||
public List<SocialCommentSeedDto> SocialComments { get; set; }
|
||||
public List<SocialLikeSeedDto> 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; }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue