mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
hot fix
This commit is contained in:
@@ -15,7 +15,7 @@ public class InvitesService : IInvitesService
|
||||
_invitesRepository = invitesRepository;
|
||||
}
|
||||
|
||||
public async Task<string> GetRole(User user)
|
||||
public async Task<string> GetRoleAsync(User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -28,21 +28,28 @@ public class InvitesService : IInvitesService
|
||||
}
|
||||
}
|
||||
|
||||
public Invitation Validate(string inviteCode)
|
||||
public async Task<Invitation> ValidateAsync(string inviteCode)
|
||||
{
|
||||
var invite = _invitesRepository.FindByCodeAsync(inviteCode).Result;
|
||||
|
||||
if (invite.EndDate < DateTime.Now ||
|
||||
invite.MaxParticipants <= invite.Users.Count)
|
||||
try
|
||||
{
|
||||
var invite = await _invitesRepository.FindByCodeAsync(inviteCode);
|
||||
|
||||
if (invite.EndDate < DateTime.Now || invite.MaxParticipants <= invite.Users.Count)
|
||||
{
|
||||
invite.IsActive = false;
|
||||
await _invitesRepository.UpdateAsync(invite);
|
||||
throw new InviteLinkInvalidException(inviteCode);
|
||||
}
|
||||
|
||||
return invite;
|
||||
}
|
||||
catch (NotFoundByKeyException<string>)
|
||||
{
|
||||
invite.IsActive = false;
|
||||
_invitesRepository.UpdateAsync(invite);
|
||||
throw new InviteLinkInvalidException(inviteCode);
|
||||
}
|
||||
|
||||
return invite;
|
||||
}
|
||||
|
||||
|
||||
public string GenerateInvitationLink(Invitation invitation)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user