small cleanup in clubs

This commit is contained in:
Toastie (DCS Team) 2024-08-06 22:38:09 +12:00
parent fe7445eefb
commit 7399e8bac1
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
2 changed files with 5 additions and 8 deletions

View file

@ -1,4 +1,3 @@
#nullable disable
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
@ -99,9 +98,9 @@ public class ClubService : IEService, IClubService
return member;
}
public async Task<SetClubIconResult> SetClubIconAsync(ulong ownerUserId, string url)
public async Task<SetClubIconResult> SetClubIconAsync(ulong ownerUserId, string? url)
{
if (url is not null)
if (!string.IsNullOrWhiteSpace(url))
{
using var http = _httpFactory.CreateClient();
using var temp = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
@ -174,7 +173,7 @@ public class ClubService : IEService, IClubService
}
public ClubAcceptResult AcceptApplication(ulong clubOwnerUserId, string userName, out DiscordUser discordUser)
public ClubAcceptResult AcceptApplication(ulong clubOwnerUserId, string userName, out DiscordUser? discordUser)
{
discordUser = null;
using var uow = _db.GetDbContext();
@ -200,7 +199,7 @@ public class ClubService : IEService, IClubService
return ClubAcceptResult.Accepted;
}
public ClubDenyResult RejectApplication(ulong clubOwnerUserId, string userName, out DiscordUser discordUser)
public ClubDenyResult RejectApplication(ulong clubOwnerUserId, string userName, out DiscordUser? discordUser)
{
discordUser = null;
using var uow = _db.GetDbContext();
@ -241,7 +240,7 @@ public class ClubService : IEService, IClubService
return ClubLeaveResult.Success;
}
public bool SetDescription(ulong userId, string desc)
public bool SetDescription(ulong userId, string? desc)
{
using var uow = _db.GetDbContext();
var club = uow.Set<ClubInfo>().GetByOwner(userId);

View file

@ -12,8 +12,6 @@ public interface IClubService
Task<SetClubIconResult> SetClubIconAsync(ulong ownerUserId, string? url);
bool GetClubByName(string clubName, out ClubInfo club);
ClubApplyResult ApplyToClub(IUser user, ClubInfo club);
ClubAcceptResult AcceptApplication(ulong clubOwnerUserId, string userName, out DiscordUser discordUser);
ClubDenyResult RejectApplication(ulong clubOwnerUserId, string userName, out DiscordUser discordUser);
ClubInfo? GetClubWithBansAndApplications(ulong ownerUserId);
ClubLeaveResult LeaveClub(IUser user);
bool SetDescription(ulong userId, string? desc);