mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
ab643c16a4
Added user session models, interfaces, repository, and service for managing user sessions and refresh tokens. Refactored authentication flow to return user objects and open sessions with device info, supporting refresh token generation and validation. Updated JWT configuration to separate access and refresh options, and refactored related tests and API contracts. Improved media upload handling and error logging. Migrated dependency references and DI registrations accordingly.
26 lines
830 B
C#
26 lines
830 B
C#
using Govor.Application.Interfaces;
|
|
using Govor.Core.Models;
|
|
using Govor.Core.Repositories.Invaites;
|
|
|
|
namespace Govor.Application.Infrastructure.AdminsStuff;
|
|
|
|
public class InvitationGenerator(IInvitesRepository repository) : IInvitationGenerator
|
|
{
|
|
public async Task<string> GenerateInvitationCode(DateTime time, int maxUsers, bool isAdmin, string description = "")
|
|
{
|
|
Invitation newInvitation = new Invitation()
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
Description = description,
|
|
MaxParticipants = maxUsers,
|
|
DateCreated = DateTime.UtcNow,
|
|
EndDate = time.ToUniversalTime(),
|
|
Code = Guid.NewGuid().ToString("N"),
|
|
IsAdmin = isAdmin
|
|
};
|
|
|
|
await repository.AddAsync(newInvitation);
|
|
|
|
return newInvitation.Code;
|
|
}
|
|
} |