31 lines
No EOL
779 B
C#
31 lines
No EOL
779 B
C#
using LinqToDB;
|
|
using EllieBot.Db.Models;
|
|
|
|
namespace EllieBot.Modules.Xp;
|
|
|
|
public sealed class XpCleanupService : IXpCleanupService, IEService
|
|
{
|
|
private readonly DbService _db;
|
|
|
|
public XpCleanupService(DbService db)
|
|
{
|
|
_db = db;
|
|
}
|
|
|
|
public async Task DeleteXp()
|
|
{
|
|
await using var uow = _db.GetDbContext();
|
|
await uow.Set<DiscordUser>().UpdateAsync(_ => new DiscordUser()
|
|
{
|
|
ClubId = null,
|
|
// IsClubAdmin = false,
|
|
TotalXp = 0
|
|
});
|
|
|
|
await uow.Set<UserXpStats>().DeleteAsync();
|
|
await uow.Set<ClubApplicants>().DeleteAsync();
|
|
await uow.Set<ClubBans>().DeleteAsync();
|
|
await uow.Set<ClubInfo>().DeleteAsync();
|
|
await uow.SaveChangesAsync();
|
|
}
|
|
} |