DiscordUser repository removed

This commit is contained in:
Kwoth
2021-06-19 05:07:27 +02:00
parent f34951c81c
commit 51a4499809
13 changed files with 67 additions and 107 deletions

View File

@@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Xp.Services
club = null;
using var uow = _db.GetDbContext();
var du = uow.DiscordUsers.GetOrCreate(user);
var du = uow._context.GetOrCreateUser(user);
uow._context.SaveChanges();
var xp = new LevelStats(du.TotalXp);
@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Xp.Services
using (var uow = _db.GetDbContext())
{
club = uow._context.Clubs.GetByOwner(from.Id);
var newOwnerUser = uow.DiscordUsers.GetOrCreate(newOwner);
var newOwnerUser = uow._context.GetOrCreateUser(newOwner);
if (club == null ||
club.Owner.UserId != from.Id ||
@@ -85,7 +85,7 @@ namespace NadekoBot.Modules.Xp.Services
using (var uow = _db.GetDbContext())
{
var club = uow._context.Clubs.GetByOwner(owner.Id);
var adminUser = uow.DiscordUsers.GetOrCreate(toAdmin);
var adminUser = uow._context.GetOrCreateUser(toAdmin);
if (club == null || club.Owner.UserId != owner.Id ||
!club.Users.Contains(adminUser))
@@ -160,7 +160,7 @@ namespace NadekoBot.Modules.Xp.Services
{
using (var uow = _db.GetDbContext())
{
var du = uow.DiscordUsers.GetOrCreate(user);
var du = uow._context.GetOrCreateUser(user);
uow._context.SaveChanges();
if (du.Club != null
@@ -227,7 +227,7 @@ namespace NadekoBot.Modules.Xp.Services
{
using (var uow = _db.GetDbContext())
{
var du = uow.DiscordUsers.GetOrCreate(user);
var du = uow._context.GetOrCreateUser(user);
if (du.Club == null || du.Club.OwnerId == du.Id)
return false;

View File

@@ -168,7 +168,7 @@ namespace NadekoBot.Modules.Xp.Services
// amounts for every user (in order to give rewards)
var usr = uow._context.GetOrCreateUserXpStats(item.Key.GuildId, item.Key.User.Id);
var du = uow.DiscordUsers.GetOrCreate(item.Key.User);
var du = uow._context.GetOrCreateUser(item.Key.User);
var globalXp = du.TotalXp;
var oldGlobalLevelData = new LevelStats(globalXp);
@@ -425,7 +425,7 @@ namespace NadekoBot.Modules.Xp.Services
{
using (var uow = _db.GetDbContext())
{
return uow.DiscordUsers.GetUsersXpLeaderboardFor(page);
return uow._context.DiscordUser.GetUsersXpLeaderboardFor(page);
}
}
@@ -452,7 +452,7 @@ namespace NadekoBot.Modules.Xp.Services
{
using (var uow = _db.GetDbContext())
{
return uow.DiscordUsers.GetOrCreate(user).NotifyOnLevelUp;
return uow._context.GetOrCreateUser(user).NotifyOnLevelUp;
}
}
@@ -460,7 +460,7 @@ namespace NadekoBot.Modules.Xp.Services
{
using (var uow = _db.GetDbContext())
{
var du = uow.DiscordUsers.GetOrCreate(user);
var du = uow._context.GetOrCreateUser(user);
du.NotifyOnLevelUp = type;
await uow.SaveChangesAsync();
}
@@ -706,9 +706,9 @@ namespace NadekoBot.Modules.Xp.Services
int guildRank;
using (var uow = _db.GetDbContext())
{
du = uow.DiscordUsers.GetOrCreate(user);
du = uow._context.GetOrCreateUser(user);
totalXp = du.TotalXp;
globalRank = uow.DiscordUsers.GetUserGlobalRank(user.Id);
globalRank = uow._context.DiscordUser.GetUserGlobalRank(user.Id);
guildRank = uow._context.UserXpStats.GetUserGuildRanking(user.Id, user.GuildId);
stats = uow._context.GetOrCreateUserXpStats(user.GuildId, user.Id);
await uow.SaveChangesAsync();