diff --git a/YeProfspilka.Backend/Dockerfile b/YeProfspilka.Backend/Dockerfile deleted file mode 100644 index ad1c9eb..0000000 --- a/YeProfspilka.Backend/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0 as base -WORKDIR /app -EXPOSE 80 - -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build -WORKDIR /YeProfspilka.Backend - -COPY . . - -RUN dotnet restore "./YeProfspilka.API/YeProfspilka.API.csproj" -COPY . . -WORKDIR "/YeProfspilka.Backend/YeProfspilka.API" -RUN dotnet build "YeProfspilka.API.csproj" -c Release -o /app - -FROM build as publish -RUN dotnet publish "YeProfspilka.API.csproj" -c Release -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . - -ENV ASPNETCORE_URLS=http://*:5001 - -EXPOSE 5001 -ENTRYPOINT ["dotnet", "YeProfspilka.API.dll"] \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/EventController.cs b/YeProfspilka.Backend/YeProfspilka.API/Controllers/EventController.cs deleted file mode 100644 index 685a4b0..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/EventController.cs +++ /dev/null @@ -1,108 +0,0 @@ -using AutoMapper; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Controllers; - -[ApiController] -[Route("event")] -//[Authorize(Policy = PolicyNames.ModeratorAndAdminPolicyName)] -public class EventController : ControllerBase -{ - private readonly IEventService _eventService; - private readonly IMapper _mapper; - private ILogger _logger; - - public EventController(IEventService eventService, IMapper mapper, ILogger logger) - { - _eventService = eventService; - _mapper = mapper; - _logger = logger; - } - - [HttpPost] - public async Task Create([FromBody] EventViewModel eventViewModel) - { - try - { - var eventDto = await _eventService.Create(_mapper.Map(eventViewModel)); - - return StatusCode(StatusCodes.Status201Created, eventDto); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpGet] - [AllowAnonymous] - public async Task Get() - { - try - { - return Ok(await _eventService.Get()); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpGet("{id}")] - [AllowAnonymous] - public async Task>> Get(Guid id) - { - try - { - return Ok(await _eventService.Get(id)); - } - catch (NotFoundException e) - { - return NotFound(new ErrorResponseModel(e.Message)); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpDelete("{id}")] - public async Task Delete(Guid id) - { - try - { - await _eventService.Delete(id); - return NoContent(); - } - catch (NotFoundException e) - { - return NotFound(new ErrorResponseModel(e.Message)); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpPut] - public async Task Update(EventDto eventDto) - { - try - { - return Ok(await _eventService.Update(eventDto)); - } - catch (NotFoundException e) - { - return NotFound(new ErrorResponseModel(e.Message)); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/PartnersController.cs b/YeProfspilka.Backend/YeProfspilka.API/Controllers/PartnersController.cs deleted file mode 100644 index 35dcb01..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/PartnersController.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Controllers; - -[ApiController] -[Route("partners")] -public class PartnersController : ControllerBase -{ - private readonly IPartnersService _partnersService; - - public PartnersController(IPartnersService partnersService) - { - _partnersService = partnersService; - } - - [HttpGet] - public async Task GetQuestions() - { - try - { - return Ok(await _partnersService.GetAllAsync()); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpPost] - // TODO Uncomment this lines - //[Authorize(Policy = PolicyNames.ModeratorAndAdminPolicyName)] - public async Task CreateQuestion([FromBody] PartnerViewModel partnerViewModel) - { - try - { - var res = await _partnersService.CreateAsync(new PartnerDto - { - SubText = partnerViewModel.SubText, - SubTextLink = partnerViewModel.SubTextLink, - Image = partnerViewModel.Image, - MainText = partnerViewModel.MainText - }); - return Ok(res); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpPut] - public async Task Update(PartnerDto partnerDto) - { - try - { - return Ok(await _partnersService.UpdateAsync(partnerDto)); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpDelete("{id}")] - //[Authorize(Policy = PolicyNames.ModeratorAndAdminPolicyName)] - public async Task Delete(Guid id) - { - try - { - await _partnersService.DeleteAsync(id); - return Ok(); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/QuestionController.cs b/YeProfspilka.Backend/YeProfspilka.API/Controllers/QuestionController.cs deleted file mode 100644 index 925af0f..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/QuestionController.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Backend.Policies; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Controllers; - -[ApiController] -[Route("question")] -public class QuestionController : ControllerBase -{ - private readonly IQuestionService _questionService; - - public QuestionController(IQuestionService questionService) - { - _questionService = questionService; - } - - [HttpGet] - public async Task GetQuestions() - { - try - { - return Ok(await _questionService.GetAllAsync()); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpPost] - [Authorize] - public async Task CreateQuestion([FromBody] QuestionViewModel questionViewModel) - { - try - { - var res = await _questionService.CreateAsync(new QuestionDto - { - Answer = questionViewModel.Answer, - QuestionText = questionViewModel.QuestionText - }); - return Ok(res); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpPut] - [Authorize] - public async Task Update(QuestionDto questionDto) - { - try - { - return Ok(await _questionService.UpdateAsync(questionDto)); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } - - [HttpDelete("{id}")] - [Authorize] - public async Task Delete(Guid id) - { - try - { - await _questionService.DeleteAsync(id); - return Ok(); - } - catch (Exception e) - { - return BadRequest(new ErrorResponseModel(e.Message)); - } - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Extension/CookiesExtension.cs b/YeProfspilka.Backend/YeProfspilka.API/Extension/CookiesExtension.cs deleted file mode 100644 index da833c4..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Extension/CookiesExtension.cs +++ /dev/null @@ -1,26 +0,0 @@ -using YeProfspilka.Backend.Utils; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Extension; - -public static class CookieExtension -{ - public static void SetTokenCookie(this HttpContext context, AuthenticateResponseModel model) - { - var cookieOptions = new CookieOptions - { - HttpOnly = true, - Expires = DateTime.Now.AddDays(7), - Secure = true, - SameSite = SameSiteMode.None, - }; - - //context.Response.Cookies.Delete("yeProfspilkaRefreshToken"); - context.Response.Cookies.Append(CookieConstants.RefreshTokenKey, model.RefreshToken, cookieOptions); - } - - public static void DeleteRefreshToken(this HttpContext context) - { - context.Response.Cookies.Delete(CookieConstants.RefreshTokenKey); - } -} diff --git a/YeProfspilka.Backend/YeProfspilka.API/Mappers/EventsMapper.cs b/YeProfspilka.Backend/YeProfspilka.API/Mappers/EventsMapper.cs deleted file mode 100644 index ee8aa80..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Mappers/EventsMapper.cs +++ /dev/null @@ -1,24 +0,0 @@ -using AutoMapper; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Enumerations; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Mappers; - -public class EventsMapper : Profile -{ - public EventsMapper() - { - CreateMap(); - CreateMap(); - CreateMap() - .ForMember(x => x.IsPassed, opts => opts.MapFrom(x => x.Date > DateTime.Now)) - .ForMember(x => x.Images, opts => opts.MapFrom(x=> MapEventsImages(x.EventImages))); - } - - private static IEnumerable MapEventsImages(IEnumerable eventImages) - { - return eventImages.Select(x => x.Image.ImageUrl); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Mappers/PartnerMapper.cs b/YeProfspilka.Backend/YeProfspilka.API/Mappers/PartnerMapper.cs deleted file mode 100644 index affba23..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Mappers/PartnerMapper.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AutoMapper; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Mappers; - -public class PartnerMapper : Profile -{ - public PartnerMapper() - { - CreateMap() - .ForMember(x => x.Image, opts => opts.MapFrom(x=> x.Image.ImageUrl)); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Mappers/QuestionMapper.cs b/YeProfspilka.Backend/YeProfspilka.API/Mappers/QuestionMapper.cs deleted file mode 100644 index ef139e7..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Mappers/QuestionMapper.cs +++ /dev/null @@ -1,14 +0,0 @@ -using AutoMapper; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Backend.Mappers; - -public class QuestionMapper : Profile -{ - public QuestionMapper() - { - CreateMap(); - CreateMap(); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Mappers/UserMapper.cs b/YeProfspilka.Backend/YeProfspilka.API/Mappers/UserMapper.cs deleted file mode 100644 index ffe6e27..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Mappers/UserMapper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using AutoMapper; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Models; -using Role = YeProfspilka.Core.Enumerations.Role; - -namespace YeProfspilka.Backend.Mappers; - -public class UserMapper : Profile -{ - public UserMapper() - { - CreateMap(); - - CreateMap() - .ForMember(x => x.Role, opts => opts.MapFrom(x => RoleResolver(x.UserRoles))) - .ForMember(x => x.Email, opts => opts.MapFrom(x => x.Email)) - .ForMember(x => x.Avatar, opts => opts.MapFrom(src => src.Image.ImageUrl)); - } - - private Role RoleResolver(IEnumerable userRoles) - { - var userRolesEnum = userRoles.Select(x => x.RoleId).ToList(); - - if (userRolesEnum.Contains(Role.Admin)) - return Role.Admin; - - if (userRolesEnum.Contains(Role.Moderator)) - return Role.Moderator; - - if (userRolesEnum.Contains(Role.MemberProfspilka)) - return Role.MemberProfspilka; - - return userRolesEnum.Contains(Role.Student) ? Role.Student : Role.NotVerified; - } - -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Policies/PolicyNames.cs b/YeProfspilka.Backend/YeProfspilka.API/Policies/PolicyNames.cs deleted file mode 100644 index e223c70..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Policies/PolicyNames.cs +++ /dev/null @@ -1,38 +0,0 @@ -namespace YeProfspilka.Backend.Policies; - -public class PolicyNames -{ - // Policy names - public const string AdminPolicyName = "AdminPolicy"; - - public const string StudentPolicyName = "StudentPolicy"; - - public const string MemberProfspilkaPolicyName = "MemberProfspilkaPolicy"; - - public const string NotVerifiedPolicyName = "NotVerifiedPolicy"; - - public const string ModeratorPolicyName = "ModeratorPolicy"; - - public const string HeadOfUnitPolicyName = "HeadOfUnitPolicy"; - - public const string ModeratorAndAdminPolicyName = "ModeratorAndAdminPolicy"; - - public const string AllRolesPolicyName = "ModeratorAndAdminAndStudentPolicy"; - - // Roles - public const string AdminRole = "Admin"; - - public const string StudentRole = "Student"; - - public const string MemberProfspilkaRole = "MemberProfspilka"; - - public const string NotVerifiedRole = "NotVerified"; - - public const string ModeratorRole = "Moderator"; - - public const string HeadOfUnitRole = "HeadOfUnit"; - - public const string ModeratorAndAdminRole = "ModeratorAndAdmin"; - - public const string AllRoles = "ModeratorAndAdminAndStudent"; -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Policies/RoleHandler.cs b/YeProfspilka.Backend/YeProfspilka.API/Policies/RoleHandler.cs deleted file mode 100644 index 0fa3dbc..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Policies/RoleHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Authorization; - -namespace YeProfspilka.Backend.Policies; - -public class RoleHandler : AuthorizationHandler -{ - protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, RoleRequirement requirement) - { - if (context.User.IsInRole(requirement.Role)) - { - context.Succeed(requirement); - } - - return Task.CompletedTask; - } -} diff --git a/YeProfspilka.Backend/YeProfspilka.API/Policies/RoleRequirement.cs b/YeProfspilka.Backend/YeProfspilka.API/Policies/RoleRequirement.cs deleted file mode 100644 index dff6311..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/Policies/RoleRequirement.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Authorization; - -namespace YeProfspilka.Backend.Policies; - -public class RoleRequirement : IAuthorizationRequirement -{ - public RoleRequirement(string role) - { - Role = role; - } - - public string Role { get; set; } -} diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/EmailViewModel.cs b/YeProfspilka.Backend/YeProfspilka.API/ViewModels/EmailViewModel.cs deleted file mode 100644 index 775707e..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/EmailViewModel.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace YeProfspilka.Backend.ViewModels; - -public class EmailViewModel -{ - public EmailViewModel(string email) - { - Email = email; - } - - public string Email { get; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/EventViewModel.cs b/YeProfspilka.Backend/YeProfspilka.API/ViewModels/EventViewModel.cs deleted file mode 100644 index 5406ee6..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/EventViewModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace YeProfspilka.Backend.ViewModels; - -public class EventViewModel -{ - public string Title { get; set; } - - public string Description { get; set; } - - public DateTime? Date { get; set; } - - public IEnumerable Images { get; set; } - - public string ShortDescription { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/GoogleViewModel.cs b/YeProfspilka.Backend/YeProfspilka.API/ViewModels/GoogleViewModel.cs deleted file mode 100644 index 1c4bc93..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/GoogleViewModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace YeProfspilka.Backend.ViewModels; - -public class GoogleViewModel -{ - public string Email { get; set; } - - public string Hd { get; set; } - - public string FullName { get; set; } - - public string Avatar { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/RegistrationViewModel.cs b/YeProfspilka.Backend/YeProfspilka.API/ViewModels/RegistrationViewModel.cs deleted file mode 100644 index b0834b7..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/RegistrationViewModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace YeProfspilka.Backend.ViewModels; - -public class RegistrationViewModel -{ - public string FullName { get; set; } - - public string Email { get; set; } - - public string Image { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/RoleViewModel.cs b/YeProfspilka.Backend/YeProfspilka.API/ViewModels/RoleViewModel.cs deleted file mode 100644 index 89869e7..0000000 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/RoleViewModel.cs +++ /dev/null @@ -1,5 +0,0 @@ -using YeProfspilka.Core.Enumerations; - -namespace YeProfspilka.Backend.ViewModels; - -public record RoleViewModel(Guid Id, Role Role); \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/AddImportCommandHandler.cs b/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/AddImportCommandHandler.cs deleted file mode 100644 index 22a444f..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/AddImportCommandHandler.cs +++ /dev/null @@ -1,32 +0,0 @@ -using MediatR; -using Microsoft.Extensions.Logging; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Application.CommandHandlers; - -public class AddImportCommand : IImportCommand -{ - public AddImportCommand(string filePath) - { - FilePath = filePath; - } - - public string FilePath { get; set; } -} - -public class AddImportCommandHandler : IRequestHandler -{ - private readonly ILogger _logger; - - public AddImportCommandHandler(ILogger logger) - { - _logger = logger; - } - - public async Task Handle(AddImportCommand request, CancellationToken cancellationToken) - { - _logger.LogInformation("Add import executed"); - throw new NotImplementedException(); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetSiteSettingsCommandHandler.cs b/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetSiteSettingsCommandHandler.cs deleted file mode 100644 index 12596ac..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetSiteSettingsCommandHandler.cs +++ /dev/null @@ -1,24 +0,0 @@ -using MediatR; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; - -namespace YeProfspilka.Application.CommandHandlers; - -public class GetSiteSettingsCommand : IRequest -{ -} - -public class GetSiteSettingsCommandHandler : IRequestHandler -{ - private readonly YeProfspilkaContext _db; - - public GetSiteSettingsCommandHandler(YeProfspilkaContext db) - { - _db = db; - } - - public Task Handle(GetSiteSettingsCommand request, CancellationToken cancellationToken) - { - throw new NotImplementedException(); - } -} diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetStudentUserByIdCommandHandler.cs b/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetStudentUserByIdCommandHandler.cs deleted file mode 100644 index ce5da05..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetStudentUserByIdCommandHandler.cs +++ /dev/null @@ -1,73 +0,0 @@ -using MediatR; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; - -namespace YeProfspilka.Application.CommandHandlers; - -public class GetStudentUserByIdCommand : IRequest -{ - public GetStudentUserByIdCommand(Guid id) - { - Id = id; - } - - public Guid Id { get; set; } -} - -public class GetStudentUserByIdCommandHandler - : IRequestHandler -{ - private const string DefaultImage = - "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460__340.png"; - private readonly YeProfspilkaContext _db; - private readonly IRoleService _roleService; - private readonly ILogger _logger; - - public GetStudentUserByIdCommandHandler( - YeProfspilkaContext db, - ILogger logger, - IRoleService roleService) - { - _db = db; - _logger = logger; - _roleService = roleService; - } - - public async Task Handle(GetStudentUserByIdCommand request, CancellationToken cancellationToken) - { - var storeUser = await _db.StudentsStore.SingleOrDefaultAsync(u => u.Id == request.Id, cancellationToken); - - if (storeUser is null) - { - _logger.LogWarning("Student store user was not found with id = {id}", request.Id); - throw new NotFoundException(nameof(StudentStore), request.Id); - } - - var user = await _db.Users - .Include(u => u.Image) - .Include(u => u.UserRoles) - .SingleOrDefaultAsync(u => u.Email == storeUser.Email, cancellationToken); - - if (user is null) - { - _logger.LogInformation("User not found with email = {email}, so user is not activated", storeUser.Email); - } - - return new UserMatchingStoreModel() - { - Email = storeUser.Email, - FullName = storeUser.FullName, - Avatar = user?.Image.ImageUrl ?? DefaultImage, - IsMemberProf = storeUser.IsMemberProf, - Course = user?.Course ?? storeUser.Course, - Facultet = user?.Facultet ?? storeUser.Facultet, - Role = user == null ? null : _roleService.RoleResolver(user.UserRoles), - Id = user?.Id ?? storeUser.Id, - }; - } -} diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Configurations/AppConfiguration.cs b/YeProfspilka.Backend/YeProfspilka.Application/Configurations/AppConfiguration.cs deleted file mode 100644 index 664183b..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Configurations/AppConfiguration.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace YeProfspilka.Application.Configurations; - -public class AppConfiguration -{ - public string DomainEmail { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Configurations/JwtConfiguration.cs b/YeProfspilka.Backend/YeProfspilka.Application/Configurations/JwtConfiguration.cs deleted file mode 100644 index 080f68c..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Configurations/JwtConfiguration.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace YeProfspilka.Application.Configurations; - -public class JwtConfiguration -{ - public string Key { get; set; } - - public string Issuer { get; set; } - - public string Audience { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Factories/ImportCommandFactory.cs b/YeProfspilka.Backend/YeProfspilka.Application/Factories/ImportCommandFactory.cs deleted file mode 100644 index 737f2e4..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Factories/ImportCommandFactory.cs +++ /dev/null @@ -1,21 +0,0 @@ -using YeProfspilka.Application.CommandHandlers; -using YeProfspilka.Core.Interfaces; - -namespace YeProfspilka.Application.Factories; - -public interface IImportCommandFactory -{ - IImportCommand? Create(string importType, string filePath); -} - -public class ImportCommandFactory : IImportCommandFactory -{ - public IImportCommand? Create(string importType, string filePath) - => importType switch - { - "add" => new AddImportCommand(filePath), - "replace" => new ReplaceImportCommand(filePath), - _ => null, - }; - -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/AdvantageService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/AdvantageService.cs deleted file mode 100644 index 5e1c616..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/AdvantageService.cs +++ /dev/null @@ -1,84 +0,0 @@ -using AutoMapper; -using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; - -namespace YeProfspilka.Application.Services; - -public class AdvantageService : IAdvantageService -{ - private readonly IMapper _mapper; - private readonly YeProfspilkaContext _dbContext; - - public AdvantageService(IMapper mapper, YeProfspilkaContext dbContext) - { - _mapper = mapper; - _dbContext = dbContext; - } - - public async Task Update(AdvantageDto advantageDto) - { - var entity = await _dbContext.Advantage.FirstOrDefaultAsync(x => x.Id == advantageDto.Id); - - if (entity == null) - { - throw new NotFoundException(nameof(Advantage), advantageDto.Id); - } - - entity.MainText = advantageDto.MainText; - entity.SubText = advantageDto.SubText; - - _dbContext.Advantage.Update(entity); - await _dbContext.SaveChangesAsync(); - - return advantageDto; - } - - public async Task GetAll() - { - return _mapper.Map(await _dbContext.Advantage.ToListAsync()); - } - - public async Task GetById(Guid id) - { - var entity = await _dbContext.Advantage.FirstOrDefaultAsync(x => x.Id == id); - - if (entity == null) - { - throw new NotFoundException(nameof(Advantage), id); - } - - return _mapper.Map(entity); - } - - public async Task Delete(Guid id) - { - var entity = await _dbContext.Advantage.FirstOrDefaultAsync(x => x.Id == id); - - if (entity == null) - { - throw new NotFoundException(nameof(Advantage), id); - } - - _dbContext.Advantage.Remove(entity); - await _dbContext.SaveChangesAsync(); - } - - public async Task Create(AdvantageDto advantageDto) - { - var entry = await _dbContext.Advantage.AddAsync(new Advantage - { - MainText = advantageDto.MainText, - SubText = advantageDto.SubText, - }); - - await _dbContext.SaveChangesAsync(); - - advantageDto.Id = entry.Entity.Id; - - return advantageDto; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/AuthenticationService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/AuthenticationService.cs deleted file mode 100644 index 38f65d6..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/AuthenticationService.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -using Role = YeProfspilka.Core.Enumerations.Role; - -namespace YeProfspilka.Application.Services; - -public class AuthenticationService : IAuthenticationService -{ - private readonly YeProfspilkaContext _context; - private readonly IStudentStoreService _studentStore; - private readonly ITokenService _tokenService; - - public AuthenticationService(YeProfspilkaContext context, IStudentStoreService studentStore, ITokenService tokenService) - { - _context = context; - _studentStore = studentStore; - _tokenService = tokenService; - } - - public async Task Authenticate(string email) - { - var user = _context.Users - .Include(x => x.UserTokens) - .Include(x => x.UserRoles) - .FirstOrDefault(x => x.Email == email); - - if (user == null) - { - throw new AuthenticateException($"Користувача з емеллом {email} не існує!"); - } - - var jwtToken = _tokenService.GenerateAccessToken(user); - var refreshToken = _tokenService.GenerateRefreshToken(); - - user.UserTokens.Add(refreshToken); - await _context.SaveChangesAsync(); - - return new AuthenticateResponseModel(jwtToken, refreshToken.Token); - } - - public async Task Authenticate(string email, string password) - { - throw new NotImplementedException(); - } - - public async Task Registration(string email, string fullName, string image) - { - var user = await CreateUser(email, fullName, image); - - var jwtToken = _tokenService.GenerateAccessToken(user); - var refreshToken = _tokenService.GenerateRefreshToken(); - - user.UserTokens.Add(refreshToken); - - await _context.Users.AddAsync(user); - await _context.SaveChangesAsync(); - - return new AuthenticateResponseModel(jwtToken, refreshToken.Token); - } - - private async Task CreateUser(string email, string fullName, string image) - { - var user = new User - { - Id = Guid.NewGuid(), - Email = email, - FullName = fullName, - Image = new Image(image), - UserRoles = new List(), - UserTokens = new List(), - }; - - user.UserRoles.Add(new UserRole { RoleId = Role.Student, UserId = user.Id }); - - if (!await _studentStore.IsStudent(email)) - { - user.UserRoles.Add(new UserRole - { - RoleId = Role.NotVerified, - UserId = user.Id, - }); - } - else - { - await _studentStore.MappingUser(user); - } - - return user; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/EventService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/EventService.cs deleted file mode 100644 index 4fb6b9a..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/EventService.cs +++ /dev/null @@ -1,126 +0,0 @@ -using AutoMapper; -using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Enumerations; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; - -namespace YeProfspilka.Application.Services; - -public class EventService : IEventService -{ - private readonly YeProfspilkaContext _dbContext; - private readonly IMapper _mapper; - - public EventService(YeProfspilkaContext dbContext, IMapper mapper) - { - _dbContext = dbContext; - _mapper = mapper; - } - - public async Task Create(EventDto eventDto) - { - var newEvent = new Event - { - Id = Guid.NewGuid(), - Date = DateTime.Now, - Title = eventDto.Title, - Status = Status.Draft, - Description = eventDto.Description, - EventImages = new List() - }; - - foreach (var image in eventDto.Images) - { - newEvent.EventImages.Add(new EventImage() - { - Image = new Image(image), - EventId = newEvent.Id - }); - } - - var entry = await _dbContext.Events.AddAsync(newEvent); - await _dbContext.SaveChangesAsync(); - - eventDto.Id = entry.Entity.Id; - - return eventDto; - } - - public async Task Delete(Guid id) - { - var ev = await _dbContext.Events.FirstOrDefaultAsync(x => x.Id == id); - if (ev == null) - { - throw new NotFoundException(nameof(Event), id); - } - - _dbContext.Events.Remove(ev); - await _dbContext.SaveChangesAsync(); - } - - public async Task Update(EventDto eventDto) - { - var ev = await _dbContext.Events - .Include(x => x.EventImages) - .ThenInclude(x => x.Image) - .FirstOrDefaultAsync(x => x.Id == eventDto.Id); - - if (ev == null) - { - throw new NotFoundException(nameof(Event), eventDto.Id); - } - - ev.Date = eventDto.Date ?? DateTime.Now; - ev.Description = eventDto.Description; - ev.Title = eventDto.Title; - ev.ShortDescription = eventDto.ShortDescription; - ev.EventImages.Clear(); - - foreach (var url in eventDto.Images.Distinct()) - { - ev.EventImages.Add(new EventImage() - { - EventId = ev.Id, - Image = new Image(url) - }); - } - - _dbContext.Events.Update(ev); - await _dbContext.SaveChangesAsync(); - - return _mapper.Map(ev); - } - - public async Task> Get() - { - var listEvents = await _dbContext.Events - .Include(x => x.EventImages) - .ThenInclude(x => x.Image) - .ToListAsync(); - - return _mapper.Map>(listEvents) ?? ArraySegment.Empty; - } - - public async Task Get(Guid id) - { - return _mapper.Map(await GetEvent(id)); - } - - private async Task GetEvent(Guid id) - { - var ev = await _dbContext.Events - .Include(x => x.EventImages) - .ThenInclude(x => x.Image) - .SingleOrDefaultAsync(x => x.Id == id); - - if (ev == null) - { - throw new NotFoundException(nameof(Event), id); - } - - return ev; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/PartnersService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/PartnersService.cs deleted file mode 100644 index 0cbf28f..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/PartnersService.cs +++ /dev/null @@ -1,76 +0,0 @@ -using AutoMapper; -using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; - -namespace YeProfspilka.Application.Services; - -public class PartnersService : IPartnersService -{ - private readonly YeProfspilkaContext _db; - private readonly IMapper _mapper; - - public PartnersService(YeProfspilkaContext db, IMapper mapper) - { - _db = db; - _mapper = mapper; - } - public async Task CreateAsync(PartnerDto partner) - { - var entry = await _db.AddAsync(new Partner - { - SubText = partner.SubText, - SubTextLink = partner.SubTextLink, - MainText = partner.MainText, - Image = new Image(partner.Image) - }); - - await _db.SaveChangesAsync(); - - return _mapper.Map(entry.Entity); - } - - public async Task DeleteAsync(Guid id) - { - var partner = _db.Partners.FirstOrDefault(x => x.Id == id); - - if (partner == null) - { - throw new NotFoundException(nameof(Partner), id); - } - - _db.Partners.Remove(partner); - await _db.SaveChangesAsync(); - } - - public async Task> GetAllAsync() - { - return _mapper.Map>( - await _db.Partners.Include(x => x.Image).ToListAsync()); - } - - public async Task UpdateAsync(PartnerDto partner) - { - var entity = _db.Partners - .Include(x => x.Image) - .FirstOrDefault(x => x.Id == partner.Id); - - if (entity == null) - { - throw new NotFoundException(nameof(Partner), partner.Id); - } - - entity.Image.ImageUrl = partner.Image; - entity.MainText = partner.MainText; - entity.SubText = partner.SubText; - entity.SubTextLink = partner.SubTextLink; - - _db.Update(entity); - await _db.SaveChangesAsync(); - - return _mapper.Map(partner); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/QuestionService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/QuestionService.cs deleted file mode 100644 index e0ae0ad..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/QuestionService.cs +++ /dev/null @@ -1,70 +0,0 @@ -using AutoMapper; -using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; - -namespace YeProfspilka.Application.Services; - -public class QuestionService : IQuestionService -{ - private readonly YeProfspilkaContext _dbContext; - private readonly IMapper _mapper; - - public QuestionService(YeProfspilkaContext dbContext, IMapper mapper) - { - _dbContext = dbContext; - _mapper = mapper; - } - - public async Task> GetAllAsync() - { - return _mapper.Map>(await _dbContext.Questions.ToListAsync()); - } - - public async Task CreateAsync(QuestionDto questionDto) - { - var entity = await _dbContext.Questions.AddAsync(new Question() - { - QuestionText = questionDto.QuestionText, - Answer = questionDto.Answer - }); - - await _dbContext.SaveChangesAsync(); - - return _mapper.Map(entity.Entity); - } - - public async Task UpdateAsync(QuestionDto questionDto) - { - var entity = await _dbContext.Questions.FirstOrDefaultAsync(x => x.Id == questionDto.Id); - - if (entity == null) - { - throw new NotFoundException(nameof(Question), questionDto.Id); - } - - entity.Answer = questionDto.Answer; - entity.QuestionText = questionDto.QuestionText; - - _dbContext.Update(entity); - await _dbContext.SaveChangesAsync(); - - return _mapper.Map(entity); - } - - public async Task DeleteAsync(Guid id) - { - var question = await _dbContext.Questions.FirstOrDefaultAsync(x => x.Id == id); - - if (question == null) - { - throw new NotFoundException(nameof(Question), id); - } - - _dbContext.Remove(question); - await _dbContext.SaveChangesAsync(); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/RoleService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/RoleService.cs deleted file mode 100644 index 85961bf..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/RoleService.cs +++ /dev/null @@ -1,25 +0,0 @@ -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Interfaces; - -namespace YeProfspilka.Application.Services; - -public class RoleService : IRoleService -{ - public Core.Enumerations.Role RoleResolver(IEnumerable userRoles) - { - var userRolesEnum = userRoles.Select(x => x.RoleId).ToList(); - - if (userRolesEnum.Contains(Core.Enumerations.Role.Admin)) - return Core.Enumerations.Role.Admin; - - if (userRolesEnum.Contains(Core.Enumerations.Role.Moderator)) - return Core.Enumerations.Role.Moderator; - - if (userRolesEnum.Contains(Core.Enumerations.Role.MemberProfspilka)) - return Core.Enumerations.Role.MemberProfspilka; - - return userRolesEnum.Contains(Core.Enumerations.Role.Student) - ? Core.Enumerations.Role.Student - : Core.Enumerations.Role.NotVerified; - } -} diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/SecurityContext.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/SecurityContext.cs deleted file mode 100644 index 707d56b..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/SecurityContext.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Logging; -using System.Security.Claims; -using YeProfspilka.Core.Interfaces; - -namespace YeProfspilka.Application.Services; - -public class SecurityContext : ISecurityContext -{ - private readonly IHttpContextAccessor _httpContextAccessor; - private readonly ILogger _logger; - - public SecurityContext(IHttpContextAccessor httpContextAccessor, ILogger logger) - { - _httpContextAccessor = httpContextAccessor; - _logger = logger; - } - - public Guid GetCurrentUserId() - { - var guidClaim = _httpContextAccessor.HttpContext?.User.FindFirst(ClaimTypes.Name); - - if (guidClaim == null || !Guid.TryParse(guidClaim.Value, out var result)) - { - _logger.LogError("guidClaim for User token not found"); - throw new Exception("User not found"); - } - - return result; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/TokenService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/TokenService.cs deleted file mode 100644 index c6e4496..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/TokenService.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using System.Security.Cryptography; -using System.Text; -using Microsoft.IdentityModel.Tokens; -using YeProfspilka.Application.Configurations; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Interfaces; - -namespace YeProfspilka.Application.Services; - -public class TokenService : ITokenService -{ - private readonly JwtConfiguration _jwtConfiguration; - - public TokenService(JwtConfiguration jwtConfiguration) - { - _jwtConfiguration = jwtConfiguration; - } - - public string GenerateAccessToken(User user) - { - var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtConfiguration.Key)); - var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256); - var claims = GetClaims(user); - var token = new JwtSecurityToken( - _jwtConfiguration.Issuer, - _jwtConfiguration.Audience, - claims, - expires: DateTime.Now.AddHours(6), - signingCredentials: credentials); - - return new JwtSecurityTokenHandler().WriteToken(token); - } - - public UserToken GenerateRefreshToken() - { - var randomNumber = new byte[32]; - using var rng = RandomNumberGenerator.Create(); - rng.GetBytes(randomNumber); - - return new UserToken - { - Token = Convert.ToBase64String(randomNumber), - Expires = DateTime.Now.AddDays(7), - Created = DateTime.Now, - }; - } - - private static IEnumerable GetClaims(User user) - { - var claims = new List(); - - claims.Add(new Claim(ClaimTypes.Name, $"{user.Id}")); - claims.AddRange(user.UserRoles.Select(ur => new Claim(ClaimTypes.Role, ur.RoleId.ToString()))); - - return claims; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/UserService.cs b/YeProfspilka.Backend/YeProfspilka.Application/Services/UserService.cs deleted file mode 100644 index b2b2f65..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/UserService.cs +++ /dev/null @@ -1,130 +0,0 @@ -using AutoMapper; -using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -using Role = YeProfspilka.Core.Enumerations.Role; - -namespace YeProfspilka.Application.Services; - -public class UserService : IUserServices -{ - private readonly YeProfspilkaContext _dbContext; - private readonly ISecurityContext _securityContext; - private readonly IMapper _mapper; - - public UserService(YeProfspilkaContext dbContext, ISecurityContext securityContext, IMapper mapper) - { - _dbContext = dbContext; - _securityContext = securityContext; - _mapper = mapper; - } - - public async Task GetCurrentUser() - { - var userId = _securityContext.GetCurrentUserId(); - - var user = await _dbContext.Users - .Include(x => x.Image) - .Include(x => x.UserRoles) - .ThenInclude(x => x.Role) - .SingleOrDefaultAsync(x => x.Id == userId); - - return _mapper.Map(user); - } - - public async Task> GetUsers() - { - var users = await _dbContext.Users - .Include(x => x.UserRoles) - .Include(x => x.Image) - .ToListAsync(); - - return _mapper.Map>(users); - } - - public async Task UserIsExist(string email) - { - return await _dbContext.Users.AnyAsync(x => x.Email == email); - } - - public async Task UpdateUser(Guid id, string facultet, int course, Role role) - { - var user = await _dbContext.Users - .Include(x => x.UserRoles) - .ThenInclude(x => x.Role) - .FirstOrDefaultAsync(x => x.Id == id); - - if (user is null) - { - throw new NotFoundException(nameof(User), id); - } - - user.Facultet = facultet; - user.Course = course; - - var student = await _dbContext.StudentsStore.SingleAsync(x => x.Email == user.Email); - - student.Course = course; - student.Facultet = facultet; - - - if (user.UserRoles.Select(x => x.RoleId).Contains(role)) - { - var roles = user.UserRoles.Select(x => x.RoleId).ToList(); - // Sort list by value of enum - roles.Sort(); - var maxRole = roles.Max(); - - if(role < maxRole) - { - for (var i = roles.IndexOf(maxRole); i < roles.Count; i++) - { - user.UserRoles.Remove(user.UserRoles.Single(x => x.RoleId == roles[i])); - } - } - - await _dbContext.SaveChangesAsync(); - return _mapper.Map(user); - } - - - - if (role == Role.NotVerified) - { - user.UserRoles.Clear(); - user.UserRoles.Add(new UserRole - { - RoleId = Role.NotVerified - }); - - _dbContext.Users.Update(user); - _dbContext.StudentsStore.Update(student); - - await _dbContext.SaveChangesAsync(); - - return _mapper.Map(user); - } - - if (user.UserRoles.Select(x => x.RoleId).Contains(Role.NotVerified)) - { - var notVerified = - await _dbContext.UserRoles.FirstAsync(x => x.UserId == user.Id && x.RoleId == Role.NotVerified); - user.UserRoles.Remove(notVerified); - } - - user.UserRoles.Add(new UserRole - { - RoleId = role - }); - - _dbContext.Users.Update(user); - _dbContext.StudentsStore.Update(student); - - await _dbContext.SaveChangesAsync(); - - return _mapper.Map(user); - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/YeProfspilka.Application.csproj b/YeProfspilka.Backend/YeProfspilka.Application/YeProfspilka.Application.csproj deleted file mode 100644 index c43371b..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Application/YeProfspilka.Application.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - - - - - - - - - - ..\..\..\..\..\..\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\6.0.15\ref\net6.0\Microsoft.AspNetCore.Http.Abstractions.dll - - - - diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Advantage.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Advantage.cs deleted file mode 100644 index de0189d..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Advantage.cs +++ /dev/null @@ -1,10 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class Advantage : BaseEntity -{ - public string MainText { get; set; } - - public string SubText { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Base/BaseEntity.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Base/BaseEntity.cs deleted file mode 100644 index 48e3f68..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Base/BaseEntity.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace YeProfspilka.Core.Entities.Base; - -public abstract class BaseEntity -{ - public Guid Id { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Event.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Event.cs deleted file mode 100644 index 8b07146..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Event.cs +++ /dev/null @@ -1,19 +0,0 @@ -using YeProfspilka.Core.Entities.Base; -using YeProfspilka.Core.Enumerations; - -namespace YeProfspilka.Core.Entities; - -public class Event : BaseEntity -{ - public string Title { get; set; } - - public DateTime Date { get; set; } - - public Status Status { get; set; } - - public ICollection EventImages { get; set; } - - public string Description { get; set; } - - public string ShortDescription { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/EventImage.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/EventImage.cs deleted file mode 100644 index a86b92c..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/EventImage.cs +++ /dev/null @@ -1,14 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class EventImage : BaseEntity -{ - public Guid EventId { get; set; } - - public Event Event { get; set; } - - public Guid ImageId { get; set; } - - public Image Image { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Image.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Image.cs deleted file mode 100644 index d35c043..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Image.cs +++ /dev/null @@ -1,15 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class Image : BaseEntity -{ - public string? ImageUrl { get; set; } - - public Image() { } - - public Image(string imageUrl) - { - ImageUrl = imageUrl; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Mark.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Mark.cs deleted file mode 100644 index 39481fb..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Mark.cs +++ /dev/null @@ -1,12 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class Mark : BaseEntity -{ - public string Name { get; set; } - - public string Text { get; set; } - - public string SubText { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Partner.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Partner.cs deleted file mode 100644 index f99e599..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Partner.cs +++ /dev/null @@ -1,14 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class Partner : BaseEntity -{ - public string MainText { get; set; } - - public string SubText { get; set; } - - public string SubTextLink { get; set; } - - public Image Image { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Question.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Question.cs deleted file mode 100644 index 9a76c75..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Question.cs +++ /dev/null @@ -1,10 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class Question : BaseEntity -{ - public string QuestionText { get; set; } - - public string Answer { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Role.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/Role.cs deleted file mode 100644 index 086f461..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Role.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace YeProfspilka.Core.Entities; - -public class Role -{ - public Enumerations.Role Id { get; set; } - - public string Name { get; set; } - - public ICollection UserRoles { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/StudentStore.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/StudentStore.cs deleted file mode 100644 index 13f04d7..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/StudentStore.cs +++ /dev/null @@ -1,16 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class StudentStore : BaseEntity -{ - public string FullName { get; set; } - - public string Email { get; set; } - - public string Facultet { get; set; } - - public int Course { get; set; } - - public bool IsMemberProf { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/User.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/User.cs deleted file mode 100644 index de5c8c5..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/User.cs +++ /dev/null @@ -1,20 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class User : BaseEntity -{ - public string Email { get; set; } - - public string FullName { get; set; } - - public Image Image { get; set; } - - public string? Facultet { get; set; } - - public int? Course { get; set; } - - public ICollection UserRoles { get; set; } - - public ICollection UserTokens { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/UserRole.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/UserRole.cs deleted file mode 100644 index 21a070a..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/UserRole.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace YeProfspilka.Core.Entities; - -public class UserRole -{ - [Key] - public Enumerations.Role RoleId { get; set; } - - public Guid UserId { get; set; } - - public virtual User User { get; set; } - - public virtual Role Role { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/UserTokens.cs b/YeProfspilka.Backend/YeProfspilka.Core/Entities/UserTokens.cs deleted file mode 100644 index c730fc2..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/UserTokens.cs +++ /dev/null @@ -1,20 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Entities; - -public class UserToken : BaseEntity -{ - public Guid UserId { get; set; } - - public User User { get; set; } - - public string Token { get; set; } - - public DateTime Expires { get; set; } - - public DateTime Created { get; set; } - - public DateTime? Revoked { get; set; } - - public string ReplacedByToken { get; set; } = string.Empty; -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/Role.cs b/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/Role.cs deleted file mode 100644 index 9dc4184..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/Role.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace YeProfspilka.Core.Enumerations; - -public enum Role -{ - NotVerified = 0, - Student = 1, - MemberProfspilka = 2, - Moderator = 3, - // Head of unit. This persistent add Admin - HeadOfUnit = 4, - Admin = 5, -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/AuthenticateException.cs b/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/AuthenticateException.cs deleted file mode 100644 index b42bf16..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/AuthenticateException.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace YeProfspilka.Core.Exceptions; - -public class AuthenticateException : Exception -{ - public AuthenticateException(string message) - : base(message) - { } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/NotFoundException.cs b/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/NotFoundException.cs deleted file mode 100644 index c5b59d8..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/NotFoundException.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace YeProfspilka.Core.Exceptions; - -public class NotFoundException : Exception -{ - public NotFoundException(string name, object key) - : base($"Entity \"{name}\" ({key}) not found.") { } -} diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/RefreshTokenException.cs b/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/RefreshTokenException.cs deleted file mode 100644 index 39c5e6c..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/RefreshTokenException.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace YeProfspilka.Core.Exceptions; - -public class RefreshTokenException : Exception -{ - public RefreshTokenException(string message) : base(message) { } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/StudentsReadingException.cs b/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/StudentsReadingException.cs deleted file mode 100644 index 70bd55b..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Exceptions/StudentsReadingException.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace YeProfspilka.Core.Exceptions; - -public class StudentsReadingException : Exception -{ - public StudentsReadingException(string message) : base(message) { } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IAuthenticationService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IAuthenticationService.cs deleted file mode 100644 index be328d7..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IAuthenticationService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Core.Interfaces; - -public interface IAuthenticationService -{ - Task Authenticate(string email); - - Task Authenticate(string email, string password); - - Task Registration(string email, string fullName, string image); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ICrudService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ICrudService.cs deleted file mode 100644 index b733c61..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ICrudService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using YeProfspilka.Core.Entities.Base; - -namespace YeProfspilka.Core.Interfaces; - -public interface ICrudService where T: BaseEntity -{ - Task Create(T entity); - - void Update(T entity); - - Task Delete(Guid id); - - Task GetById(Guid id); - - Task> Get(); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IEventService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IEventService.cs deleted file mode 100644 index 1c4575a..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IEventService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Core.Interfaces; - -public interface IEventService -{ - Task Create(EventDto eventDto); - - Task Delete(Guid id); - - Task Update(EventDto eventDto); - - Task> Get(); - - Task Get(Guid id); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IPartnersService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IPartnersService.cs deleted file mode 100644 index b0c55fa..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IPartnersService.cs +++ /dev/null @@ -1,14 +0,0 @@ -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Core.Interfaces; - -public interface IPartnersService -{ - Task> GetAllAsync(); - - Task UpdateAsync(PartnerDto partner); - - Task CreateAsync(PartnerDto partner); - - Task DeleteAsync(Guid id); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IQuestionService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IQuestionService.cs deleted file mode 100644 index f648b37..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IQuestionService.cs +++ /dev/null @@ -1,14 +0,0 @@ -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Core.Interfaces; - -public interface IQuestionService -{ - Task> GetAllAsync(); - - Task CreateAsync(QuestionDto questionDto); - - Task UpdateAsync(QuestionDto questionDto); - - Task DeleteAsync(Guid id); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ISecurityContext.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ISecurityContext.cs deleted file mode 100644 index ca403be..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ISecurityContext.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace YeProfspilka.Core.Interfaces; - -public interface ISecurityContext -{ - Guid GetCurrentUserId(); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IStudentStoreService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IStudentStoreService.cs deleted file mode 100644 index 7505de1..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IStudentStoreService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Core.Interfaces; - -public interface IStudentStoreService -{ - Task IsStudent(string email); - - Task UploadUsers(string filePath, bool IsOverrideMethod); - - Task MappingUser(User user); - - Task> GetAllUsers(); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IUserService.cs b/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IUserService.cs deleted file mode 100644 index c1898c5..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IUserService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using YeProfspilka.Core.Enumerations; -using YeProfspilka.Core.Models; - -namespace YeProfspilka.Core.Interfaces; - -public interface IUserServices -{ - Task GetCurrentUser(); - - Task> GetUsers(); - - Task UserIsExist(string email); - - Task UpdateUser(Guid id, string facultet, int course, Role role); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/AuthenticateResponseModel.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/AuthenticateResponseModel.cs deleted file mode 100644 index 4e6753b..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/AuthenticateResponseModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace YeProfspilka.Core.Models; - -public class AuthenticateResponseModel -{ - public AuthenticateResponseModel(string jwtToken, string refreshToken) - { - JwtToken = jwtToken; - RefreshToken = refreshToken; - } - - public string JwtToken { get; set; } - - public string RefreshToken { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/DiscountDto.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/DiscountDto.cs deleted file mode 100644 index d70fcd8..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/DiscountDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using YeProfspilka.Core.Enumerations; - -namespace YeProfspilka.Core.Models; - -public class DiscountDto -{ - public Guid Id { get; set; } - - public string Name { get; set; } - - public bool? WithBarCode { get; set; } - - public bool? WithQrCode { get; set; } - - public string? BarCodeImage { get; set; } - - public string? Description { get; set; } - - public DiscountType DiscountType { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/ErrorResponseModel.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/ErrorResponseModel.cs deleted file mode 100644 index b67b2b9..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/ErrorResponseModel.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace YeProfspilka.Core.Models; - -public class ErrorResponseModel -{ - public string Message { get; set; } - - public ErrorResponseModel(string message) - { - Message = message; - } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/EventDto.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/EventDto.cs deleted file mode 100644 index ad90ef7..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/EventDto.cs +++ /dev/null @@ -1,22 +0,0 @@ -using YeProfspilka.Core.Enumerations; - -namespace YeProfspilka.Core.Models; - -public class EventDto -{ - public Guid Id { get; set; } - - public string Title { get; set; } - - public string Description { get; set; } - - public DateTime? Date { get; set; } - - public Status Status { get; set; } - - public bool IsPassed { get; set; } - - public string ShortDescription { get; set; } - - public IEnumerable Images { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/QuestionDto.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/QuestionDto.cs deleted file mode 100644 index 3a788ba..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/QuestionDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace YeProfspilka.Core.Models; - -public class QuestionDto -{ - public Guid Id { get; set; } - - public string QuestionText { get; set; } - - public string Answer { get; set; } -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/SiteSettingsDto.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/SiteSettingsDto.cs deleted file mode 100644 index a2282a3..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/SiteSettingsDto.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace YeProfspilka.Core.Models; - -public class SiteSettingsDto -{ - -} diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/UserDto.cs b/YeProfspilka.Backend/YeProfspilka.Core/Models/UserDto.cs deleted file mode 100644 index d338b2b..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/UserDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using YeProfspilka.Core.Enumerations; - -namespace YeProfspilka.Core.Models; - -public class UserDto -{ - public Guid Id { get; set; } - - public string FullName { get; set; } - - public string Email { get; set; } - - public string Status { get; set; } - - public string Avatar { get; set; } - - public string Facultet { get; set; } - - public int Course { get; set; } - - public Role Role { get; set; } - - public IEnumerable Discounts { get; set; } = Enumerable.Empty(); -} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Configurations/RoleConfiguration.cs b/YeProfspilka.Backend/YeProfspilka.Db/Configurations/RoleConfiguration.cs deleted file mode 100644 index be7e371..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Db/Configurations/RoleConfiguration.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using YeProfspilka.Core.Entities; - -namespace YeProfspilka.Db.Configurations; - -public class RoleConfiguration : IEntityTypeConfiguration -{ - public void Configure(EntityTypeBuilder builder) - { - builder.HasData(new[] - { - new Role { Id = Core.Enumerations.Role.Student, Name = "Student" }, - new Role { Id = Core.Enumerations.Role.Admin, Name = "Admin" }, - new Role { Id = Core.Enumerations.Role.Moderator, Name = "Moderator" }, - new Role { Id = Core.Enumerations.Role.NotVerified, Name = "NotVerified" }, - new Role { Id = Core.Enumerations.Role.MemberProfspilka, Name = "MemberProfspilka" }, - new Role { Id = Core.Enumerations.Role.HeadOfUnit, Name = "HeadOfUnit" }, - }); - } -} diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Configurations/UserRoleConfiguration.cs b/YeProfspilka.Backend/YeProfspilka.Db/Configurations/UserRoleConfiguration.cs deleted file mode 100644 index acb2800..0000000 --- a/YeProfspilka.Backend/YeProfspilka.Db/Configurations/UserRoleConfiguration.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using YeProfspilka.Core.Entities; - -namespace YeProfspilka.Db.Configurations; - -public class UserRoleConfiguration : IEntityTypeConfiguration -{ - public void Configure(EntityTypeBuilder builder) - { - builder.HasKey(a => new { a.UserId, a.RoleId }); - builder.HasOne(a => a.User).WithMany(a => a.UserRoles).HasForeignKey(a => a.UserId); - builder.HasOne(a => a.Role).WithMany(r => r.UserRoles).HasForeignKey(a => a.RoleId); - } -} \ No newline at end of file diff --git a/YeProfspilka.Admin/.browserslistrc b/src/admin-panel/.browserslistrc similarity index 100% rename from YeProfspilka.Admin/.browserslistrc rename to src/admin-panel/.browserslistrc diff --git a/YeProfspilka.Admin/.editorconfig b/src/admin-panel/.editorconfig similarity index 100% rename from YeProfspilka.Admin/.editorconfig rename to src/admin-panel/.editorconfig diff --git a/YeProfspilka.Admin/.gitignore b/src/admin-panel/.gitignore similarity index 100% rename from YeProfspilka.Admin/.gitignore rename to src/admin-panel/.gitignore diff --git a/YeProfspilka.Admin/.vscode/extensions.json b/src/admin-panel/.vscode/extensions.json similarity index 100% rename from YeProfspilka.Admin/.vscode/extensions.json rename to src/admin-panel/.vscode/extensions.json diff --git a/YeProfspilka.Admin/.vscode/launch.json b/src/admin-panel/.vscode/launch.json similarity index 100% rename from YeProfspilka.Admin/.vscode/launch.json rename to src/admin-panel/.vscode/launch.json diff --git a/YeProfspilka.Admin/.vscode/settings.json b/src/admin-panel/.vscode/settings.json similarity index 100% rename from YeProfspilka.Admin/.vscode/settings.json rename to src/admin-panel/.vscode/settings.json diff --git a/YeProfspilka.Admin/.vscode/tasks.json b/src/admin-panel/.vscode/tasks.json similarity index 100% rename from YeProfspilka.Admin/.vscode/tasks.json rename to src/admin-panel/.vscode/tasks.json diff --git a/YeProfspilka.Admin/Dockerfile b/src/admin-panel/Dockerfile similarity index 100% rename from YeProfspilka.Admin/Dockerfile rename to src/admin-panel/Dockerfile diff --git a/YeProfspilka.Admin/README.md b/src/admin-panel/README.md similarity index 100% rename from YeProfspilka.Admin/README.md rename to src/admin-panel/README.md diff --git a/YeProfspilka.Admin/angular.json b/src/admin-panel/angular.json similarity index 100% rename from YeProfspilka.Admin/angular.json rename to src/admin-panel/angular.json diff --git a/YeProfspilka.Admin/karma.conf.js b/src/admin-panel/karma.conf.js similarity index 100% rename from YeProfspilka.Admin/karma.conf.js rename to src/admin-panel/karma.conf.js diff --git a/YeProfspilka.Admin/nginx.conf b/src/admin-panel/nginx.conf similarity index 100% rename from YeProfspilka.Admin/nginx.conf rename to src/admin-panel/nginx.conf diff --git a/YeProfspilka.Admin/package-lock.json b/src/admin-panel/package-lock.json similarity index 100% rename from YeProfspilka.Admin/package-lock.json rename to src/admin-panel/package-lock.json diff --git a/YeProfspilka.Admin/package.json b/src/admin-panel/package.json similarity index 100% rename from YeProfspilka.Admin/package.json rename to src/admin-panel/package.json diff --git a/YeProfspilka.Admin/src/app/app-routing.module.ts b/src/admin-panel/src/app/app-routing.module.ts similarity index 100% rename from YeProfspilka.Admin/src/app/app-routing.module.ts rename to src/admin-panel/src/app/app-routing.module.ts diff --git a/YeProfspilka.Admin/src/app/app.component.css b/src/admin-panel/src/app/app.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/app.component.css rename to src/admin-panel/src/app/app.component.css diff --git a/YeProfspilka.Admin/src/app/app.component.html b/src/admin-panel/src/app/app.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/app.component.html rename to src/admin-panel/src/app/app.component.html diff --git a/YeProfspilka.Admin/src/app/app.component.ts b/src/admin-panel/src/app/app.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/app.component.ts rename to src/admin-panel/src/app/app.component.ts diff --git a/YeProfspilka.Admin/src/app/app.module.ts b/src/admin-panel/src/app/app.module.ts similarity index 100% rename from YeProfspilka.Admin/src/app/app.module.ts rename to src/admin-panel/src/app/app.module.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/create-discount/create-discount.component.html b/src/admin-panel/src/app/components/administration-components/create-discount/create-discount.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/create-discount/create-discount.component.html rename to src/admin-panel/src/app/components/administration-components/create-discount/create-discount.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/create-discount/create-discount.component.ts b/src/admin-panel/src/app/components/administration-components/create-discount/create-discount.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/create-discount/create-discount.component.ts rename to src/admin-panel/src/app/components/administration-components/create-discount/create-discount.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/dashboard/dashboard.component.html b/src/admin-panel/src/app/components/administration-components/dashboard/dashboard.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/dashboard/dashboard.component.html rename to src/admin-panel/src/app/components/administration-components/dashboard/dashboard.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/dashboard/dashboard.component.ts b/src/admin-panel/src/app/components/administration-components/dashboard/dashboard.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/dashboard/dashboard.component.ts rename to src/admin-panel/src/app/components/administration-components/dashboard/dashboard.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/discounts/discounts.component.html b/src/admin-panel/src/app/components/administration-components/discounts/discounts.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/discounts/discounts.component.html rename to src/admin-panel/src/app/components/administration-components/discounts/discounts.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/discounts/discounts.component.ts b/src/admin-panel/src/app/components/administration-components/discounts/discounts.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/discounts/discounts.component.ts rename to src/admin-panel/src/app/components/administration-components/discounts/discounts.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/import-report/import-report.component.css b/src/admin-panel/src/app/components/administration-components/import-report/import-report.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/import-report/import-report.component.css rename to src/admin-panel/src/app/components/administration-components/import-report/import-report.component.css diff --git a/YeProfspilka.Admin/src/app/components/administration-components/import-report/import-report.component.html b/src/admin-panel/src/app/components/administration-components/import-report/import-report.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/import-report/import-report.component.html rename to src/admin-panel/src/app/components/administration-components/import-report/import-report.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/import-report/import-report.component.ts b/src/admin-panel/src/app/components/administration-components/import-report/import-report.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/import-report/import-report.component.ts rename to src/admin-panel/src/app/components/administration-components/import-report/import-report.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/main-discounts/main-discounts.component.html b/src/admin-panel/src/app/components/administration-components/main-discounts/main-discounts.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/main-discounts/main-discounts.component.html rename to src/admin-panel/src/app/components/administration-components/main-discounts/main-discounts.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/main-discounts/main-discounts.component.ts b/src/admin-panel/src/app/components/administration-components/main-discounts/main-discounts.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/main-discounts/main-discounts.component.ts rename to src/admin-panel/src/app/components/administration-components/main-discounts/main-discounts.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/settings/settings.component.css b/src/admin-panel/src/app/components/administration-components/settings/settings.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/settings/settings.component.css rename to src/admin-panel/src/app/components/administration-components/settings/settings.component.css diff --git a/YeProfspilka.Admin/src/app/components/administration-components/settings/settings.component.html b/src/admin-panel/src/app/components/administration-components/settings/settings.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/settings/settings.component.html rename to src/admin-panel/src/app/components/administration-components/settings/settings.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/settings/settings.component.ts b/src/admin-panel/src/app/components/administration-components/settings/settings.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/settings/settings.component.ts rename to src/admin-panel/src/app/components/administration-components/settings/settings.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/update-discount/update-discount.component.html b/src/admin-panel/src/app/components/administration-components/update-discount/update-discount.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/update-discount/update-discount.component.html rename to src/admin-panel/src/app/components/administration-components/update-discount/update-discount.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/update-discount/update-discount.component.ts b/src/admin-panel/src/app/components/administration-components/update-discount/update-discount.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/update-discount/update-discount.component.ts rename to src/admin-panel/src/app/components/administration-components/update-discount/update-discount.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.html b/src/admin-panel/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.html rename to src/admin-panel/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.ts b/src/admin-panel/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.ts rename to src/admin-panel/src/app/components/administration-components/users-manager-panel/users-manager-panel.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/main/main.component.html b/src/admin-panel/src/app/components/administration-components/users/main/main.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/main/main.component.html rename to src/admin-panel/src/app/components/administration-components/users/main/main.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/main/main.component.ts b/src/admin-panel/src/app/components/administration-components/users/main/main.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/main/main.component.ts rename to src/admin-panel/src/app/components/administration-components/users/main/main.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/user-card/user-card.component.html b/src/admin-panel/src/app/components/administration-components/users/user-card/user-card.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/user-card/user-card.component.html rename to src/admin-panel/src/app/components/administration-components/users/user-card/user-card.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/user-card/user-card.component.ts b/src/admin-panel/src/app/components/administration-components/users/user-card/user-card.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/user-card/user-card.component.ts rename to src/admin-panel/src/app/components/administration-components/users/user-card/user-card.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/users-table/users-table.component.html b/src/admin-panel/src/app/components/administration-components/users/users-table/users-table.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/users-table/users-table.component.html rename to src/admin-panel/src/app/components/administration-components/users/users-table/users-table.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/users-table/users-table.component.ts b/src/admin-panel/src/app/components/administration-components/users/users-table/users-table.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/users-table/users-table.component.ts rename to src/admin-panel/src/app/components/administration-components/users/users-table/users-table.component.ts diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/users.component.html b/src/admin-panel/src/app/components/administration-components/users/users.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/users.component.html rename to src/admin-panel/src/app/components/administration-components/users/users.component.html diff --git a/YeProfspilka.Admin/src/app/components/administration-components/users/users.component.ts b/src/admin-panel/src/app/components/administration-components/users/users.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/administration-components/users/users.component.ts rename to src/admin-panel/src/app/components/administration-components/users/users.component.ts diff --git a/YeProfspilka.Admin/src/app/components/advantage/advantage.component.html b/src/admin-panel/src/app/components/advantage/advantage.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/advantage/advantage.component.html rename to src/admin-panel/src/app/components/advantage/advantage.component.html diff --git a/YeProfspilka.Admin/src/app/components/advantage/advantage.component.ts b/src/admin-panel/src/app/components/advantage/advantage.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/advantage/advantage.component.ts rename to src/admin-panel/src/app/components/advantage/advantage.component.ts diff --git a/YeProfspilka.Admin/src/app/components/alert/alert.component.html b/src/admin-panel/src/app/components/alert/alert.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/alert/alert.component.html rename to src/admin-panel/src/app/components/alert/alert.component.html diff --git a/YeProfspilka.Admin/src/app/components/alert/alert.component.ts b/src/admin-panel/src/app/components/alert/alert.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/alert/alert.component.ts rename to src/admin-panel/src/app/components/alert/alert.component.ts diff --git a/YeProfspilka.Admin/src/app/components/alert/alert.model.ts b/src/admin-panel/src/app/components/alert/alert.model.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/alert/alert.model.ts rename to src/admin-panel/src/app/components/alert/alert.model.ts diff --git a/YeProfspilka.Admin/src/app/components/event-card/event-card.component.html b/src/admin-panel/src/app/components/event-card/event-card.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/event-card/event-card.component.html rename to src/admin-panel/src/app/components/event-card/event-card.component.html diff --git a/YeProfspilka.Admin/src/app/components/event-card/event-card.component.ts b/src/admin-panel/src/app/components/event-card/event-card.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/event-card/event-card.component.ts rename to src/admin-panel/src/app/components/event-card/event-card.component.ts diff --git a/YeProfspilka.Admin/src/app/components/loader/loader.component.html b/src/admin-panel/src/app/components/loader/loader.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/loader/loader.component.html rename to src/admin-panel/src/app/components/loader/loader.component.html diff --git a/YeProfspilka.Admin/src/app/components/loader/loader.component.ts b/src/admin-panel/src/app/components/loader/loader.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/loader/loader.component.ts rename to src/admin-panel/src/app/components/loader/loader.component.ts diff --git a/YeProfspilka.Admin/src/app/components/menu-item/menu-item.component.html b/src/admin-panel/src/app/components/menu-item/menu-item.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/menu-item/menu-item.component.html rename to src/admin-panel/src/app/components/menu-item/menu-item.component.html diff --git a/YeProfspilka.Admin/src/app/components/menu-item/menu-item.component.ts b/src/admin-panel/src/app/components/menu-item/menu-item.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/menu-item/menu-item.component.ts rename to src/admin-panel/src/app/components/menu-item/menu-item.component.ts diff --git a/YeProfspilka.Admin/src/app/components/modal/modal.component.html b/src/admin-panel/src/app/components/modal/modal.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/modal/modal.component.html rename to src/admin-panel/src/app/components/modal/modal.component.html diff --git a/YeProfspilka.Admin/src/app/components/modal/modal.component.ts b/src/admin-panel/src/app/components/modal/modal.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/modal/modal.component.ts rename to src/admin-panel/src/app/components/modal/modal.component.ts diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/advantages/advantages.component.html b/src/admin-panel/src/app/components/moderation-components/advantages/advantages.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/advantages/advantages.component.html rename to src/admin-panel/src/app/components/moderation-components/advantages/advantages.component.html diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/advantages/advantages.component.ts b/src/admin-panel/src/app/components/moderation-components/advantages/advantages.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/advantages/advantages.component.ts rename to src/admin-panel/src/app/components/moderation-components/advantages/advantages.component.ts diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/event-update/event-update.component.html b/src/admin-panel/src/app/components/moderation-components/event-update/event-update.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/event-update/event-update.component.html rename to src/admin-panel/src/app/components/moderation-components/event-update/event-update.component.html diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/event-update/event-update.component.ts b/src/admin-panel/src/app/components/moderation-components/event-update/event-update.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/event-update/event-update.component.ts rename to src/admin-panel/src/app/components/moderation-components/event-update/event-update.component.ts diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/events/events.component.html b/src/admin-panel/src/app/components/moderation-components/events/events.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/events/events.component.html rename to src/admin-panel/src/app/components/moderation-components/events/events.component.html diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/events/events.component.ts b/src/admin-panel/src/app/components/moderation-components/events/events.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/events/events.component.ts rename to src/admin-panel/src/app/components/moderation-components/events/events.component.ts diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.html b/src/admin-panel/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.html rename to src/admin-panel/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.html diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.ts b/src/admin-panel/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.ts rename to src/admin-panel/src/app/components/moderation-components/moderation-sidebar/moderation-sidebar.component.ts diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/partners/partners.component.html b/src/admin-panel/src/app/components/moderation-components/partners/partners.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/partners/partners.component.html rename to src/admin-panel/src/app/components/moderation-components/partners/partners.component.html diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/partners/partners.component.ts b/src/admin-panel/src/app/components/moderation-components/partners/partners.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/partners/partners.component.ts rename to src/admin-panel/src/app/components/moderation-components/partners/partners.component.ts diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/questions/questions.component.html b/src/admin-panel/src/app/components/moderation-components/questions/questions.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/questions/questions.component.html rename to src/admin-panel/src/app/components/moderation-components/questions/questions.component.html diff --git a/YeProfspilka.Admin/src/app/components/moderation-components/questions/questions.component.ts b/src/admin-panel/src/app/components/moderation-components/questions/questions.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/moderation-components/questions/questions.component.ts rename to src/admin-panel/src/app/components/moderation-components/questions/questions.component.ts diff --git a/YeProfspilka.Admin/src/app/components/partner/partner.component.html b/src/admin-panel/src/app/components/partner/partner.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/partner/partner.component.html rename to src/admin-panel/src/app/components/partner/partner.component.html diff --git a/YeProfspilka.Admin/src/app/components/partner/partner.component.ts b/src/admin-panel/src/app/components/partner/partner.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/partner/partner.component.ts rename to src/admin-panel/src/app/components/partner/partner.component.ts diff --git a/YeProfspilka.Admin/src/app/components/question/question.component.html b/src/admin-panel/src/app/components/question/question.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/question/question.component.html rename to src/admin-panel/src/app/components/question/question.component.html diff --git a/YeProfspilka.Admin/src/app/components/question/question.component.ts b/src/admin-panel/src/app/components/question/question.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/question/question.component.ts rename to src/admin-panel/src/app/components/question/question.component.ts diff --git a/YeProfspilka.Admin/src/app/components/sidebar/sidebar.component.css b/src/admin-panel/src/app/components/sidebar/sidebar.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidebar/sidebar.component.css rename to src/admin-panel/src/app/components/sidebar/sidebar.component.css diff --git a/YeProfspilka.Admin/src/app/components/sidebar/sidebar.component.html b/src/admin-panel/src/app/components/sidebar/sidebar.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidebar/sidebar.component.html rename to src/admin-panel/src/app/components/sidebar/sidebar.component.html diff --git a/YeProfspilka.Admin/src/app/components/sidebar/sidebar.component.ts b/src/admin-panel/src/app/components/sidebar/sidebar.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidebar/sidebar.component.ts rename to src/admin-panel/src/app/components/sidebar/sidebar.component.ts diff --git a/YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.css b/src/admin-panel/src/app/components/sidenav/sidenav.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.css rename to src/admin-panel/src/app/components/sidenav/sidenav.component.css diff --git a/YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.html b/src/admin-panel/src/app/components/sidenav/sidenav.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.html rename to src/admin-panel/src/app/components/sidenav/sidenav.component.html diff --git a/YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.spec.ts b/src/admin-panel/src/app/components/sidenav/sidenav.component.spec.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.spec.ts rename to src/admin-panel/src/app/components/sidenav/sidenav.component.spec.ts diff --git a/YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.ts b/src/admin-panel/src/app/components/sidenav/sidenav.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/components/sidenav/sidenav.component.ts rename to src/admin-panel/src/app/components/sidenav/sidenav.component.ts diff --git a/YeProfspilka.Admin/src/app/directives/drag-drop.directive.ts b/src/admin-panel/src/app/directives/drag-drop.directive.ts similarity index 100% rename from YeProfspilka.Admin/src/app/directives/drag-drop.directive.ts rename to src/admin-panel/src/app/directives/drag-drop.directive.ts diff --git a/YeProfspilka.Admin/src/app/guards/admin-guard.service.ts b/src/admin-panel/src/app/guards/admin-guard.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/guards/admin-guard.service.ts rename to src/admin-panel/src/app/guards/admin-guard.service.ts diff --git a/YeProfspilka.Admin/src/app/guards/auth-guard.service.ts b/src/admin-panel/src/app/guards/auth-guard.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/guards/auth-guard.service.ts rename to src/admin-panel/src/app/guards/auth-guard.service.ts diff --git a/YeProfspilka.Admin/src/app/guards/moderator-guard.service.ts b/src/admin-panel/src/app/guards/moderator-guard.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/guards/moderator-guard.service.ts rename to src/admin-panel/src/app/guards/moderator-guard.service.ts diff --git a/YeProfspilka.Admin/src/app/models/Advantage.ts b/src/admin-panel/src/app/models/Advantage.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Advantage.ts rename to src/admin-panel/src/app/models/Advantage.ts diff --git a/YeProfspilka.Admin/src/app/models/Alert.ts b/src/admin-panel/src/app/models/Alert.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Alert.ts rename to src/admin-panel/src/app/models/Alert.ts diff --git a/YeProfspilka.Admin/src/app/models/AuhenticateModel.ts b/src/admin-panel/src/app/models/AuhenticateModel.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/AuhenticateModel.ts rename to src/admin-panel/src/app/models/AuhenticateModel.ts diff --git a/YeProfspilka.Admin/src/app/models/Discount.ts b/src/admin-panel/src/app/models/Discount.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Discount.ts rename to src/admin-panel/src/app/models/Discount.ts diff --git a/YeProfspilka.Admin/src/app/models/DiscountType.ts b/src/admin-panel/src/app/models/DiscountType.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/DiscountType.ts rename to src/admin-panel/src/app/models/DiscountType.ts diff --git a/YeProfspilka.Admin/src/app/models/Event.ts b/src/admin-panel/src/app/models/Event.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Event.ts rename to src/admin-panel/src/app/models/Event.ts diff --git a/YeProfspilka.Admin/src/app/models/GoogleUserInfo.ts b/src/admin-panel/src/app/models/GoogleUserInfo.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/GoogleUserInfo.ts rename to src/admin-panel/src/app/models/GoogleUserInfo.ts diff --git a/YeProfspilka.Admin/src/app/models/ImportResult.ts b/src/admin-panel/src/app/models/ImportResult.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/ImportResult.ts rename to src/admin-panel/src/app/models/ImportResult.ts diff --git a/YeProfspilka.Admin/src/app/models/ImportType.ts b/src/admin-panel/src/app/models/ImportType.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/ImportType.ts rename to src/admin-panel/src/app/models/ImportType.ts diff --git a/YeProfspilka.Admin/src/app/models/Partners.ts b/src/admin-panel/src/app/models/Partners.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Partners.ts rename to src/admin-panel/src/app/models/Partners.ts diff --git a/YeProfspilka.Admin/src/app/models/Question.ts b/src/admin-panel/src/app/models/Question.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Question.ts rename to src/admin-panel/src/app/models/Question.ts diff --git a/YeProfspilka.Admin/src/app/models/Status.ts b/src/admin-panel/src/app/models/Status.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/Status.ts rename to src/admin-panel/src/app/models/Status.ts diff --git a/YeProfspilka.Admin/src/app/models/UploadFileResults.ts b/src/admin-panel/src/app/models/UploadFileResults.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/UploadFileResults.ts rename to src/admin-panel/src/app/models/UploadFileResults.ts diff --git a/YeProfspilka.Admin/src/app/models/User.ts b/src/admin-panel/src/app/models/User.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/User.ts rename to src/admin-panel/src/app/models/User.ts diff --git a/YeProfspilka.Admin/src/app/models/roles.ts b/src/admin-panel/src/app/models/roles.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/roles.ts rename to src/admin-panel/src/app/models/roles.ts diff --git a/YeProfspilka.Admin/src/app/models/ui-models/MenuItem.ts b/src/admin-panel/src/app/models/ui-models/MenuItem.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/ui-models/MenuItem.ts rename to src/admin-panel/src/app/models/ui-models/MenuItem.ts diff --git a/YeProfspilka.Admin/src/app/models/ui-models/Option.ts b/src/admin-panel/src/app/models/ui-models/Option.ts similarity index 100% rename from YeProfspilka.Admin/src/app/models/ui-models/Option.ts rename to src/admin-panel/src/app/models/ui-models/Option.ts diff --git a/YeProfspilka.Admin/src/app/pages/administrator-page/administrator-page.component.html b/src/admin-panel/src/app/pages/administrator-page/administrator-page.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/pages/administrator-page/administrator-page.component.html rename to src/admin-panel/src/app/pages/administrator-page/administrator-page.component.html diff --git a/YeProfspilka.Admin/src/app/pages/administrator-page/administrator-page.component.ts b/src/admin-panel/src/app/pages/administrator-page/administrator-page.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/pages/administrator-page/administrator-page.component.ts rename to src/admin-panel/src/app/pages/administrator-page/administrator-page.component.ts diff --git a/YeProfspilka.Admin/src/app/pages/login-page/login-page.component.html b/src/admin-panel/src/app/pages/login-page/login-page.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/pages/login-page/login-page.component.html rename to src/admin-panel/src/app/pages/login-page/login-page.component.html diff --git a/YeProfspilka.Admin/src/app/pages/login-page/login-page.component.ts b/src/admin-panel/src/app/pages/login-page/login-page.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/pages/login-page/login-page.component.ts rename to src/admin-panel/src/app/pages/login-page/login-page.component.ts diff --git a/YeProfspilka.Admin/src/app/pages/main-page/main-page.component.html b/src/admin-panel/src/app/pages/main-page/main-page.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/pages/main-page/main-page.component.html rename to src/admin-panel/src/app/pages/main-page/main-page.component.html diff --git a/YeProfspilka.Admin/src/app/pages/main-page/main-page.component.ts b/src/admin-panel/src/app/pages/main-page/main-page.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/pages/main-page/main-page.component.ts rename to src/admin-panel/src/app/pages/main-page/main-page.component.ts diff --git a/YeProfspilka.Admin/src/app/pages/moderation/moderation-page.component.html b/src/admin-panel/src/app/pages/moderation/moderation-page.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/pages/moderation/moderation-page.component.html rename to src/admin-panel/src/app/pages/moderation/moderation-page.component.html diff --git a/YeProfspilka.Admin/src/app/pages/moderation/moderation-page.component.ts b/src/admin-panel/src/app/pages/moderation/moderation-page.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/pages/moderation/moderation-page.component.ts rename to src/admin-panel/src/app/pages/moderation/moderation-page.component.ts diff --git a/YeProfspilka.Admin/src/app/pages/routes.ts b/src/admin-panel/src/app/pages/routes.ts similarity index 100% rename from YeProfspilka.Admin/src/app/pages/routes.ts rename to src/admin-panel/src/app/pages/routes.ts diff --git a/YeProfspilka.Admin/src/app/services/advantage.service.ts b/src/admin-panel/src/app/services/advantage.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/advantage.service.ts rename to src/admin-panel/src/app/services/advantage.service.ts diff --git a/YeProfspilka.Admin/src/app/services/authenticate.service.ts b/src/admin-panel/src/app/services/authenticate.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/authenticate.service.ts rename to src/admin-panel/src/app/services/authenticate.service.ts diff --git a/YeProfspilka.Admin/src/app/services/discount.service.ts b/src/admin-panel/src/app/services/discount.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/discount.service.ts rename to src/admin-panel/src/app/services/discount.service.ts diff --git a/YeProfspilka.Admin/src/app/services/download.service.ts b/src/admin-panel/src/app/services/download.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/download.service.ts rename to src/admin-panel/src/app/services/download.service.ts diff --git a/YeProfspilka.Admin/src/app/services/error-interceptor.service.ts b/src/admin-panel/src/app/services/error-interceptor.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/error-interceptor.service.ts rename to src/admin-panel/src/app/services/error-interceptor.service.ts diff --git a/YeProfspilka.Admin/src/app/services/events.service.ts b/src/admin-panel/src/app/services/events.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/events.service.ts rename to src/admin-panel/src/app/services/events.service.ts diff --git a/YeProfspilka.Admin/src/app/services/file-uploader.service.ts b/src/admin-panel/src/app/services/file-uploader.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/file-uploader.service.ts rename to src/admin-panel/src/app/services/file-uploader.service.ts diff --git a/YeProfspilka.Admin/src/app/services/import.service.ts b/src/admin-panel/src/app/services/import.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/import.service.ts rename to src/admin-panel/src/app/services/import.service.ts diff --git a/YeProfspilka.Admin/src/app/services/partners.service.ts b/src/admin-panel/src/app/services/partners.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/partners.service.ts rename to src/admin-panel/src/app/services/partners.service.ts diff --git a/YeProfspilka.Admin/src/app/services/question.service.ts b/src/admin-panel/src/app/services/question.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/question.service.ts rename to src/admin-panel/src/app/services/question.service.ts diff --git a/YeProfspilka.Admin/src/app/services/rest.service.ts b/src/admin-panel/src/app/services/rest.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/rest.service.ts rename to src/admin-panel/src/app/services/rest.service.ts diff --git a/YeProfspilka.Admin/src/app/services/student-store.service.ts b/src/admin-panel/src/app/services/student-store.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/student-store.service.ts rename to src/admin-panel/src/app/services/student-store.service.ts diff --git a/YeProfspilka.Admin/src/app/services/token.service.ts b/src/admin-panel/src/app/services/token.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/token.service.ts rename to src/admin-panel/src/app/services/token.service.ts diff --git a/YeProfspilka.Admin/src/app/services/user.service.ts b/src/admin-panel/src/app/services/user.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/services/user.service.ts rename to src/admin-panel/src/app/services/user.service.ts diff --git a/YeProfspilka.Admin/src/app/shared/container/container.component.html b/src/admin-panel/src/app/shared/container/container.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/shared/container/container.component.html rename to src/admin-panel/src/app/shared/container/container.component.html diff --git a/YeProfspilka.Admin/src/app/shared/container/container.component.ts b/src/admin-panel/src/app/shared/container/container.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/shared/container/container.component.ts rename to src/admin-panel/src/app/shared/container/container.component.ts diff --git a/YeProfspilka.Admin/src/app/shared/header/header.component.html b/src/admin-panel/src/app/shared/header/header.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/shared/header/header.component.html rename to src/admin-panel/src/app/shared/header/header.component.html diff --git a/YeProfspilka.Admin/src/app/shared/header/header.component.ts b/src/admin-panel/src/app/shared/header/header.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/shared/header/header.component.ts rename to src/admin-panel/src/app/shared/header/header.component.ts diff --git a/YeProfspilka.Admin/src/app/shared/moderation-header/moderation-header.component.css b/src/admin-panel/src/app/shared/moderation-header/moderation-header.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/shared/moderation-header/moderation-header.component.css rename to src/admin-panel/src/app/shared/moderation-header/moderation-header.component.css diff --git a/YeProfspilka.Admin/src/app/shared/moderation-header/moderation-header.component.html b/src/admin-panel/src/app/shared/moderation-header/moderation-header.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/shared/moderation-header/moderation-header.component.html rename to src/admin-panel/src/app/shared/moderation-header/moderation-header.component.html diff --git a/YeProfspilka.Admin/src/app/shared/moderation-header/moderation-header.component.ts b/src/admin-panel/src/app/shared/moderation-header/moderation-header.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/shared/moderation-header/moderation-header.component.ts rename to src/admin-panel/src/app/shared/moderation-header/moderation-header.component.ts diff --git a/YeProfspilka.Admin/src/app/shared/role/role.component.html b/src/admin-panel/src/app/shared/role/role.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/shared/role/role.component.html rename to src/admin-panel/src/app/shared/role/role.component.html diff --git a/YeProfspilka.Admin/src/app/shared/role/role.component.ts b/src/admin-panel/src/app/shared/role/role.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/shared/role/role.component.ts rename to src/admin-panel/src/app/shared/role/role.component.ts diff --git a/YeProfspilka.Admin/src/app/shared/svg/svg.component.html b/src/admin-panel/src/app/shared/svg/svg.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/shared/svg/svg.component.html rename to src/admin-panel/src/app/shared/svg/svg.component.html diff --git a/YeProfspilka.Admin/src/app/shared/svg/svg.component.ts b/src/admin-panel/src/app/shared/svg/svg.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/shared/svg/svg.component.ts rename to src/admin-panel/src/app/shared/svg/svg.component.ts diff --git a/YeProfspilka.Admin/src/app/shared/svg/svg.service.ts b/src/admin-panel/src/app/shared/svg/svg.service.ts similarity index 100% rename from YeProfspilka.Admin/src/app/shared/svg/svg.service.ts rename to src/admin-panel/src/app/shared/svg/svg.service.ts diff --git a/YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.css b/src/admin-panel/src/app/spinner-button/spinner-button.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.css rename to src/admin-panel/src/app/spinner-button/spinner-button.component.css diff --git a/YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.html b/src/admin-panel/src/app/spinner-button/spinner-button.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.html rename to src/admin-panel/src/app/spinner-button/spinner-button.component.html diff --git a/YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.spec.ts b/src/admin-panel/src/app/spinner-button/spinner-button.component.spec.ts similarity index 100% rename from YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.spec.ts rename to src/admin-panel/src/app/spinner-button/spinner-button.component.spec.ts diff --git a/YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.ts b/src/admin-panel/src/app/spinner-button/spinner-button.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/spinner-button/spinner-button.component.ts rename to src/admin-panel/src/app/spinner-button/spinner-button.component.ts diff --git a/YeProfspilka.Admin/src/app/store/AppState.ts b/src/admin-panel/src/app/store/AppState.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/AppState.ts rename to src/admin-panel/src/app/store/AppState.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/advantage.action.ts b/src/admin-panel/src/app/store/actions/advantage.action.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/advantage.action.ts rename to src/admin-panel/src/app/store/actions/advantage.action.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/alert.action.ts b/src/admin-panel/src/app/store/actions/alert.action.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/alert.action.ts rename to src/admin-panel/src/app/store/actions/alert.action.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/discounts.actions.ts b/src/admin-panel/src/app/store/actions/discounts.actions.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/discounts.actions.ts rename to src/admin-panel/src/app/store/actions/discounts.actions.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/events.action.ts b/src/admin-panel/src/app/store/actions/events.action.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/events.action.ts rename to src/admin-panel/src/app/store/actions/events.action.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/partners.action.ts b/src/admin-panel/src/app/store/actions/partners.action.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/partners.action.ts rename to src/admin-panel/src/app/store/actions/partners.action.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/questions.action.ts b/src/admin-panel/src/app/store/actions/questions.action.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/questions.action.ts rename to src/admin-panel/src/app/store/actions/questions.action.ts diff --git a/YeProfspilka.Admin/src/app/store/actions/user.action.ts b/src/admin-panel/src/app/store/actions/user.action.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/actions/user.action.ts rename to src/admin-panel/src/app/store/actions/user.action.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/advantages.effect.ts b/src/admin-panel/src/app/store/effects/advantages.effect.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/advantages.effect.ts rename to src/admin-panel/src/app/store/effects/advantages.effect.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/discounts.effect.ts b/src/admin-panel/src/app/store/effects/discounts.effect.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/discounts.effect.ts rename to src/admin-panel/src/app/store/effects/discounts.effect.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/events.effect.ts b/src/admin-panel/src/app/store/effects/events.effect.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/events.effect.ts rename to src/admin-panel/src/app/store/effects/events.effect.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/index.ts b/src/admin-panel/src/app/store/effects/index.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/index.ts rename to src/admin-panel/src/app/store/effects/index.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/partners.effect.ts b/src/admin-panel/src/app/store/effects/partners.effect.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/partners.effect.ts rename to src/admin-panel/src/app/store/effects/partners.effect.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/question.effect.ts b/src/admin-panel/src/app/store/effects/question.effect.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/question.effect.ts rename to src/admin-panel/src/app/store/effects/question.effect.ts diff --git a/YeProfspilka.Admin/src/app/store/effects/user.effect.ts b/src/admin-panel/src/app/store/effects/user.effect.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/effects/user.effect.ts rename to src/admin-panel/src/app/store/effects/user.effect.ts diff --git a/YeProfspilka.Admin/src/app/store/index.ts b/src/admin-panel/src/app/store/index.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/index.ts rename to src/admin-panel/src/app/store/index.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/advantage.reducer.ts b/src/admin-panel/src/app/store/reducers/advantage.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/advantage.reducer.ts rename to src/admin-panel/src/app/store/reducers/advantage.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/alert.reducer.ts b/src/admin-panel/src/app/store/reducers/alert.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/alert.reducer.ts rename to src/admin-panel/src/app/store/reducers/alert.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/discounts.reducer.ts b/src/admin-panel/src/app/store/reducers/discounts.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/discounts.reducer.ts rename to src/admin-panel/src/app/store/reducers/discounts.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/events.reducer.ts b/src/admin-panel/src/app/store/reducers/events.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/events.reducer.ts rename to src/admin-panel/src/app/store/reducers/events.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/index.ts b/src/admin-panel/src/app/store/reducers/index.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/index.ts rename to src/admin-panel/src/app/store/reducers/index.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/partners.reducer.ts b/src/admin-panel/src/app/store/reducers/partners.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/partners.reducer.ts rename to src/admin-panel/src/app/store/reducers/partners.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/question.reducer.ts b/src/admin-panel/src/app/store/reducers/question.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/question.reducer.ts rename to src/admin-panel/src/app/store/reducers/question.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/reducers/user.reducer.ts b/src/admin-panel/src/app/store/reducers/user.reducer.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/reducers/user.reducer.ts rename to src/admin-panel/src/app/store/reducers/user.reducer.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/advantage.selector.ts b/src/admin-panel/src/app/store/selectors/advantage.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/advantage.selector.ts rename to src/admin-panel/src/app/store/selectors/advantage.selector.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/alert.selector.ts b/src/admin-panel/src/app/store/selectors/alert.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/alert.selector.ts rename to src/admin-panel/src/app/store/selectors/alert.selector.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/discounts.selector.ts b/src/admin-panel/src/app/store/selectors/discounts.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/discounts.selector.ts rename to src/admin-panel/src/app/store/selectors/discounts.selector.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/events.selector.ts b/src/admin-panel/src/app/store/selectors/events.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/events.selector.ts rename to src/admin-panel/src/app/store/selectors/events.selector.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/partners.selector.ts b/src/admin-panel/src/app/store/selectors/partners.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/partners.selector.ts rename to src/admin-panel/src/app/store/selectors/partners.selector.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/question.selector.ts b/src/admin-panel/src/app/store/selectors/question.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/question.selector.ts rename to src/admin-panel/src/app/store/selectors/question.selector.ts diff --git a/YeProfspilka.Admin/src/app/store/selectors/user.selector.ts b/src/admin-panel/src/app/store/selectors/user.selector.ts similarity index 100% rename from YeProfspilka.Admin/src/app/store/selectors/user.selector.ts rename to src/admin-panel/src/app/store/selectors/user.selector.ts diff --git a/YeProfspilka.Admin/src/app/ui/button/button.component.html b/src/admin-panel/src/app/ui/button/button.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/button/button.component.html rename to src/admin-panel/src/app/ui/button/button.component.html diff --git a/YeProfspilka.Admin/src/app/ui/button/button.component.ts b/src/admin-panel/src/app/ui/button/button.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/button/button.component.ts rename to src/admin-panel/src/app/ui/button/button.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/discount-type/discount-type.component.html b/src/admin-panel/src/app/ui/discount-type/discount-type.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/discount-type/discount-type.component.html rename to src/admin-panel/src/app/ui/discount-type/discount-type.component.html diff --git a/YeProfspilka.Admin/src/app/ui/discount-type/discount-type.component.ts b/src/admin-panel/src/app/ui/discount-type/discount-type.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/discount-type/discount-type.component.ts rename to src/admin-panel/src/app/ui/discount-type/discount-type.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/editor/editor.component.html b/src/admin-panel/src/app/ui/editor/editor.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/editor/editor.component.html rename to src/admin-panel/src/app/ui/editor/editor.component.html diff --git a/YeProfspilka.Admin/src/app/ui/editor/editor.component.ts b/src/admin-panel/src/app/ui/editor/editor.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/editor/editor.component.ts rename to src/admin-panel/src/app/ui/editor/editor.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/feedback/feedback.component.css b/src/admin-panel/src/app/ui/feedback/feedback.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/ui/feedback/feedback.component.css rename to src/admin-panel/src/app/ui/feedback/feedback.component.css diff --git a/YeProfspilka.Admin/src/app/ui/feedback/feedback.component.html b/src/admin-panel/src/app/ui/feedback/feedback.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/feedback/feedback.component.html rename to src/admin-panel/src/app/ui/feedback/feedback.component.html diff --git a/YeProfspilka.Admin/src/app/ui/feedback/feedback.component.spec.ts b/src/admin-panel/src/app/ui/feedback/feedback.component.spec.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/feedback/feedback.component.spec.ts rename to src/admin-panel/src/app/ui/feedback/feedback.component.spec.ts diff --git a/YeProfspilka.Admin/src/app/ui/feedback/feedback.component.ts b/src/admin-panel/src/app/ui/feedback/feedback.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/feedback/feedback.component.ts rename to src/admin-panel/src/app/ui/feedback/feedback.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/file-input-field/file-input-field.component.html b/src/admin-panel/src/app/ui/file-input-field/file-input-field.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/file-input-field/file-input-field.component.html rename to src/admin-panel/src/app/ui/file-input-field/file-input-field.component.html diff --git a/YeProfspilka.Admin/src/app/ui/file-input-field/file-input-field.component.ts b/src/admin-panel/src/app/ui/file-input-field/file-input-field.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/file-input-field/file-input-field.component.ts rename to src/admin-panel/src/app/ui/file-input-field/file-input-field.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/form-text-field/form-text-field.component.html b/src/admin-panel/src/app/ui/form-text-field/form-text-field.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/form-text-field/form-text-field.component.html rename to src/admin-panel/src/app/ui/form-text-field/form-text-field.component.html diff --git a/YeProfspilka.Admin/src/app/ui/form-text-field/form-text-field.component.ts b/src/admin-panel/src/app/ui/form-text-field/form-text-field.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/form-text-field/form-text-field.component.ts rename to src/admin-panel/src/app/ui/form-text-field/form-text-field.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/google-button/google-button.component.html b/src/admin-panel/src/app/ui/google-button/google-button.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/google-button/google-button.component.html rename to src/admin-panel/src/app/ui/google-button/google-button.component.html diff --git a/YeProfspilka.Admin/src/app/ui/google-button/google-button.component.ts b/src/admin-panel/src/app/ui/google-button/google-button.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/google-button/google-button.component.ts rename to src/admin-panel/src/app/ui/google-button/google-button.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/icon-button/icon-button.component.html b/src/admin-panel/src/app/ui/icon-button/icon-button.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/icon-button/icon-button.component.html rename to src/admin-panel/src/app/ui/icon-button/icon-button.component.html diff --git a/YeProfspilka.Admin/src/app/ui/icon-button/icon-button.component.ts b/src/admin-panel/src/app/ui/icon-button/icon-button.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/icon-button/icon-button.component.ts rename to src/admin-panel/src/app/ui/icon-button/icon-button.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/question-tooltip/question-tooltip.component.css b/src/admin-panel/src/app/ui/question-tooltip/question-tooltip.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/ui/question-tooltip/question-tooltip.component.css rename to src/admin-panel/src/app/ui/question-tooltip/question-tooltip.component.css diff --git a/YeProfspilka.Admin/src/app/ui/question-tooltip/question-tooltip.component.html b/src/admin-panel/src/app/ui/question-tooltip/question-tooltip.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/question-tooltip/question-tooltip.component.html rename to src/admin-panel/src/app/ui/question-tooltip/question-tooltip.component.html diff --git a/YeProfspilka.Admin/src/app/ui/question-tooltip/question-tooltip.component.ts b/src/admin-panel/src/app/ui/question-tooltip/question-tooltip.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/question-tooltip/question-tooltip.component.ts rename to src/admin-panel/src/app/ui/question-tooltip/question-tooltip.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/select/select.component.css b/src/admin-panel/src/app/ui/select/select.component.css similarity index 100% rename from YeProfspilka.Admin/src/app/ui/select/select.component.css rename to src/admin-panel/src/app/ui/select/select.component.css diff --git a/YeProfspilka.Admin/src/app/ui/select/select.component.html b/src/admin-panel/src/app/ui/select/select.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/select/select.component.html rename to src/admin-panel/src/app/ui/select/select.component.html diff --git a/YeProfspilka.Admin/src/app/ui/select/select.component.ts b/src/admin-panel/src/app/ui/select/select.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/select/select.component.ts rename to src/admin-panel/src/app/ui/select/select.component.ts diff --git a/YeProfspilka.Admin/src/app/ui/text-field/text-field.component.html b/src/admin-panel/src/app/ui/text-field/text-field.component.html similarity index 100% rename from YeProfspilka.Admin/src/app/ui/text-field/text-field.component.html rename to src/admin-panel/src/app/ui/text-field/text-field.component.html diff --git a/YeProfspilka.Admin/src/app/ui/text-field/text-field.component.ts b/src/admin-panel/src/app/ui/text-field/text-field.component.ts similarity index 100% rename from YeProfspilka.Admin/src/app/ui/text-field/text-field.component.ts rename to src/admin-panel/src/app/ui/text-field/text-field.component.ts diff --git a/YeProfspilka.Admin/src/app/utils/ckeditorConfig.ts b/src/admin-panel/src/app/utils/ckeditorConfig.ts similarity index 100% rename from YeProfspilka.Admin/src/app/utils/ckeditorConfig.ts rename to src/admin-panel/src/app/utils/ckeditorConfig.ts diff --git a/YeProfspilka.Admin/src/app/utils/constants.ts b/src/admin-panel/src/app/utils/constants.ts similarity index 100% rename from YeProfspilka.Admin/src/app/utils/constants.ts rename to src/admin-panel/src/app/utils/constants.ts diff --git a/YeProfspilka.Admin/src/app/utils/editorOptions.ts b/src/admin-panel/src/app/utils/editorOptions.ts similarity index 100% rename from YeProfspilka.Admin/src/app/utils/editorOptions.ts rename to src/admin-panel/src/app/utils/editorOptions.ts diff --git a/YeProfspilka.Admin/src/app/utils/links.ts b/src/admin-panel/src/app/utils/links.ts similarity index 100% rename from YeProfspilka.Admin/src/app/utils/links.ts rename to src/admin-panel/src/app/utils/links.ts diff --git a/YeProfspilka.Admin/src/assets/.gitkeep b/src/admin-panel/src/assets/.gitkeep similarity index 100% rename from YeProfspilka.Admin/src/assets/.gitkeep rename to src/admin-panel/src/assets/.gitkeep diff --git a/YeProfspilka.Admin/src/assets/images/login-background.png b/src/admin-panel/src/assets/images/login-background.png similarity index 100% rename from YeProfspilka.Admin/src/assets/images/login-background.png rename to src/admin-panel/src/assets/images/login-background.png diff --git a/YeProfspilka.Admin/src/assets/images/logo-big.png b/src/admin-panel/src/assets/images/logo-big.png similarity index 100% rename from YeProfspilka.Admin/src/assets/images/logo-big.png rename to src/admin-panel/src/assets/images/logo-big.png diff --git a/YeProfspilka.Admin/src/assets/images/logo-transparent-small.png b/src/admin-panel/src/assets/images/logo-transparent-small.png similarity index 100% rename from YeProfspilka.Admin/src/assets/images/logo-transparent-small.png rename to src/admin-panel/src/assets/images/logo-transparent-small.png diff --git a/YeProfspilka.Admin/src/assets/images/success.png b/src/admin-panel/src/assets/images/success.png similarity index 100% rename from YeProfspilka.Admin/src/assets/images/success.png rename to src/admin-panel/src/assets/images/success.png diff --git a/YeProfspilka.Admin/src/assets/images/warning.png b/src/admin-panel/src/assets/images/warning.png similarity index 100% rename from YeProfspilka.Admin/src/assets/images/warning.png rename to src/admin-panel/src/assets/images/warning.png diff --git a/YeProfspilka.Admin/src/assets/svgs/google.svg b/src/admin-panel/src/assets/svgs/google.svg similarity index 100% rename from YeProfspilka.Admin/src/assets/svgs/google.svg rename to src/admin-panel/src/assets/svgs/google.svg diff --git a/YeProfspilka.Admin/src/assets/svgs/logo.svg b/src/admin-panel/src/assets/svgs/logo.svg similarity index 100% rename from YeProfspilka.Admin/src/assets/svgs/logo.svg rename to src/admin-panel/src/assets/svgs/logo.svg diff --git a/YeProfspilka.Admin/src/environments/environment.dev.ts b/src/admin-panel/src/environments/environment.dev.ts similarity index 100% rename from YeProfspilka.Admin/src/environments/environment.dev.ts rename to src/admin-panel/src/environments/environment.dev.ts diff --git a/YeProfspilka.Admin/src/environments/environment.prod.ts b/src/admin-panel/src/environments/environment.prod.ts similarity index 100% rename from YeProfspilka.Admin/src/environments/environment.prod.ts rename to src/admin-panel/src/environments/environment.prod.ts diff --git a/YeProfspilka.Admin/src/environments/environment.ts b/src/admin-panel/src/environments/environment.ts similarity index 100% rename from YeProfspilka.Admin/src/environments/environment.ts rename to src/admin-panel/src/environments/environment.ts diff --git a/YeProfspilka.Admin/src/favicon.ico b/src/admin-panel/src/favicon.ico similarity index 100% rename from YeProfspilka.Admin/src/favicon.ico rename to src/admin-panel/src/favicon.ico diff --git a/YeProfspilka.Admin/src/index.html b/src/admin-panel/src/index.html similarity index 100% rename from YeProfspilka.Admin/src/index.html rename to src/admin-panel/src/index.html diff --git a/YeProfspilka.Admin/src/main.ts b/src/admin-panel/src/main.ts similarity index 100% rename from YeProfspilka.Admin/src/main.ts rename to src/admin-panel/src/main.ts diff --git a/YeProfspilka.Admin/src/polyfills.ts b/src/admin-panel/src/polyfills.ts similarity index 100% rename from YeProfspilka.Admin/src/polyfills.ts rename to src/admin-panel/src/polyfills.ts diff --git a/YeProfspilka.Admin/src/styles.css b/src/admin-panel/src/styles.css similarity index 100% rename from YeProfspilka.Admin/src/styles.css rename to src/admin-panel/src/styles.css diff --git a/YeProfspilka.Admin/src/test.ts b/src/admin-panel/src/test.ts similarity index 100% rename from YeProfspilka.Admin/src/test.ts rename to src/admin-panel/src/test.ts diff --git a/YeProfspilka.Admin/tailwind.config.js b/src/admin-panel/tailwind.config.js similarity index 100% rename from YeProfspilka.Admin/tailwind.config.js rename to src/admin-panel/tailwind.config.js diff --git a/YeProfspilka.Admin/tsconfig.app.json b/src/admin-panel/tsconfig.app.json similarity index 100% rename from YeProfspilka.Admin/tsconfig.app.json rename to src/admin-panel/tsconfig.app.json diff --git a/YeProfspilka.Admin/tsconfig.json b/src/admin-panel/tsconfig.json similarity index 100% rename from YeProfspilka.Admin/tsconfig.json rename to src/admin-panel/tsconfig.json diff --git a/YeProfspilka.Admin/tsconfig.spec.json b/src/admin-panel/tsconfig.spec.json similarity index 100% rename from YeProfspilka.Admin/tsconfig.spec.json rename to src/admin-panel/tsconfig.spec.json diff --git a/YeProfspilka.Backend/.gitignore b/src/api/.gitignore similarity index 94% rename from YeProfspilka.Backend/.gitignore rename to src/api/.gitignore index a72f3dd..2afa2e2 100644 --- a/YeProfspilka.Backend/.gitignore +++ b/src/api/.gitignore @@ -1,454 +1,454 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET -project.lock.json -project.fragment.lock.json -artifacts/ - -# Tye -.tye/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -## -## Visual studio for Mac -## - - -# globs -Makefile.in -*.userprefs -*.usertasks -config.make -config.status -aclocal.m4 -install-sh -autom4te.cache/ -*.tar.gz -tarballs/ -test-results/ - -# Mac bundle stuff -*.dmg -*.app - -# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# JetBrains Rider -.idea/ -*.sln.iml - -## -## Visual Studio Code -## -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/YeProfspilka.Backend/.vscode/launch.json b/src/api/.vscode/launch.json similarity index 100% rename from YeProfspilka.Backend/.vscode/launch.json rename to src/api/.vscode/launch.json diff --git a/YeProfspilka.Backend/.vscode/settings.json b/src/api/.vscode/settings.json similarity index 100% rename from YeProfspilka.Backend/.vscode/settings.json rename to src/api/.vscode/settings.json diff --git a/YeProfspilka.Backend/.vscode/tasks.json b/src/api/.vscode/tasks.json similarity index 100% rename from YeProfspilka.Backend/.vscode/tasks.json rename to src/api/.vscode/tasks.json diff --git a/src/api/Dockerfile b/src/api/Dockerfile new file mode 100644 index 0000000..5a33a1a --- /dev/null +++ b/src/api/Dockerfile @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 as base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /api + +COPY . . + +RUN dotnet restore "./EProfspilka.API/EProfspilka.API.csproj" +COPY . . +WORKDIR "/api/EProfspilka.API" +RUN dotnet build "EProfspilka.API.csproj" -c Release -o /app + +FROM build as publish +RUN dotnet publish "EProfspilka.API.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENV ASPNETCORE_URLS=http://*:5001 + +EXPOSE 5001 +ENTRYPOINT ["dotnet", "EProfspilka.API.dll"] \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/AdvantageController.cs b/src/api/EProfspilka.API/Controllers/AdvantageController.cs similarity index 61% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/AdvantageController.cs rename to src/api/EProfspilka.API/Controllers/AdvantageController.cs index 07e21b8..6dc514e 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/AdvantageController.cs +++ b/src/api/EProfspilka.API/Controllers/AdvantageController.cs @@ -1,29 +1,22 @@ +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [Route("advantage")] -public class AdvantageController : ControllerBase +public class AdvantageController(IAdvantageService advantageService) : ControllerBase { - private readonly IAdvantageService _advantageService; - - public AdvantageController(IAdvantageService advantageService) - { - _advantageService = advantageService; - } - [HttpGet] - public async Task GetAll() => await _advantageService.GetAll(); + public async Task GetAll() => await advantageService.GetAll(); [HttpGet("{id}")] public async Task Get(Guid id) { try { - return Ok(await _advantageService.GetById(id)); + return Ok(await advantageService.GetById(id)); } catch (Exception e) { @@ -36,7 +29,7 @@ public async Task Create([FromBody] AdvantageDto advantageDto) { try { - return Ok(await _advantageService.Create(advantageDto)); + return Ok(await advantageService.Create(advantageDto)); } catch (Exception e) { @@ -49,7 +42,7 @@ public async Task Update([FromBody] AdvantageDto advantageDto) { try { - return Ok(await _advantageService.Update(advantageDto)); + return Ok(await advantageService.Update(advantageDto)); } catch (Exception e) { @@ -62,7 +55,7 @@ public async Task Delete(Guid id) { try { - await _advantageService.Delete(id); + await advantageService.Delete(id); return NoContent(); } catch (Exception e) diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/AuthenticationController.cs b/src/api/EProfspilka.API/Controllers/AuthenticationController.cs similarity index 56% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/AuthenticationController.cs rename to src/api/EProfspilka.API/Controllers/AuthenticationController.cs index ffa655e..1291cd6 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/AuthenticationController.cs +++ b/src/api/EProfspilka.API/Controllers/AuthenticationController.cs @@ -1,47 +1,32 @@ +using EProfispilka.Application.CommandHandlers; +using EProfispilka.Application.Configurations; +using EProfspilka.API.Extension; +using EProfspilka.API.Utils; +using EProfspilka.API.ViewModels; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Application.CommandHandlers; -using YeProfspilka.Application.Configurations; -using YeProfspilka.Backend.Extension; -using YeProfspilka.Backend.Utils; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [Route("authenticate")] [AllowAnonymous] -public class AuthenticationController : ControllerBase +public class AuthenticationController( + IAuthenticationService authenticationService, + IUserServices userServices, + AppConfiguration configuration, + ILogger logger, IMediator mediator) : ControllerBase { - private readonly IAuthenticationService _authenticationService; - private readonly IUserServices _userServices; - private readonly AppConfiguration _configuration; - private readonly IMediator _mediator; - private readonly ILogger _logger; - - public AuthenticationController( - IAuthenticationService authenticationService, - IUserServices userServices, - AppConfiguration configuration, - ILogger logger, IMediator mediator) - { - _authenticationService = authenticationService; - _userServices = userServices; - _configuration = configuration; - _logger = logger; - _mediator = mediator; - } - [HttpPost] public async Task Login([FromBody] EmailViewModel emailViewModel) { try { - var authenticateResponseModel = await _authenticationService.Authenticate(emailViewModel.Email); - _logger.LogInformation("Successful Google Authenticate user with Email: {Email}", emailViewModel.Email); + var authenticateResponseModel = await authenticationService.Authenticate(emailViewModel.Email); + logger.LogInformation("Successful Google Authenticate user with Email: {Email}", emailViewModel.Email); HttpContext.SetTokenCookie(authenticateResponseModel); return Ok(new @@ -60,20 +45,20 @@ public async Task GoogleAuthenticate([FromBody] GoogleViewModel g { try { - if (googleViewModel.Hd != _configuration.DomainEmail) + if (googleViewModel.Hd != configuration.DomainEmail) { return BadRequest(new ErrorResponseModel("Ви не можете зареєструватися під даним емейлом! Оберіть емейл вашого закладу!")); } - if (await _userServices.UserIsExist(googleViewModel.Email)) + if (await userServices.UserIsExist(googleViewModel.Email)) { return await Login(new EmailViewModel(googleViewModel.Email)); } - var authenticateResponseModel = await _authenticationService + var authenticateResponseModel = await authenticationService .Registration(googleViewModel.Email, googleViewModel.FullName, googleViewModel.Avatar); - _logger.LogInformation("Successful registration new user with Email: {email}", googleViewModel.Email); + logger.LogInformation("Successful registration new user with Email: {email}", googleViewModel.Email); HttpContext.SetTokenCookie(authenticateResponseModel); @@ -99,11 +84,11 @@ public async Task RefreshToken() if (refreshToken is null) { Logout(); - _logger.LogWarning("Refresh token incorrect. Execute logout"); + logger.LogWarning("Refresh token incorrect. Execute logout"); return BadRequest(new ErrorResponseModel("Refresh token is incorrect")); } - var result = await _mediator.Send(new RefreshTokenCommand(refreshToken)); + var result = await mediator.Send(new RefreshTokenCommand(refreshToken)); HttpContext.SetTokenCookie(result); return Ok(new diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/DiscountCodeController.cs b/src/api/EProfspilka.API/Controllers/DiscountCodeController.cs similarity index 68% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/DiscountCodeController.cs rename to src/api/EProfspilka.API/Controllers/DiscountCodeController.cs index 2ad0d0f..9baa1e9 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/DiscountCodeController.cs +++ b/src/api/EProfspilka.API/Controllers/DiscountCodeController.cs @@ -1,31 +1,24 @@ +using EProfispilka.Application.CommandHandlers; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Application.CommandHandlers; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [AllowAnonymous] [Route("discount/code")] -public class DiscountCodeController : ControllerBase +public class DiscountCodeController(IMediator mediator) : ControllerBase { - private readonly IMediator _mediator; - - public DiscountCodeController(IMediator mediator) - { - _mediator = mediator; - } - [HttpGet] [Route("{discountId:guid}")] public async Task> GenerateDiscountCode(Guid discountId) { try { - var result = await _mediator.Send(new GenerateDiscountCodeCommand(discountId)); + var result = await mediator.Send(new GenerateDiscountCodeCommand(discountId)); return Ok(result); } @@ -49,7 +42,7 @@ public async Task> ValidateDiscountCode(Guid disco return BadRequest(new ErrorResponseModel("Incorrect data!")); } - var result = await _mediator.Send(new VerifyDiscountCodeCommand(discountId, discountCodeId)); + var result = await mediator.Send(new VerifyDiscountCodeCommand(discountId, discountCodeId)); return Ok(result); } diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/DiscountController.cs b/src/api/EProfspilka.API/Controllers/DiscountController.cs similarity index 68% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/DiscountController.cs rename to src/api/EProfspilka.API/Controllers/DiscountController.cs index 0444c44..590bbaf 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/DiscountController.cs +++ b/src/api/EProfspilka.API/Controllers/DiscountController.cs @@ -1,35 +1,26 @@ +using EProfispilka.Application.CommandHandlers; +using EProfspilka.API.ViewModels; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; using MediatR; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Application.CommandHandlers; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [Route("discount")] -public class DiscountController : ControllerBase +public class DiscountController(IDiscountService discountService, IMediator mediator) : ControllerBase { - private readonly IDiscountService _discountService; - private readonly IMediator _mediator; - - public DiscountController(IDiscountService discountService, IMediator mediator) - { - _discountService = discountService; - _mediator = mediator; - } - [HttpGet] - public async Task> GetAllAsync() => await _discountService.GetAsync(); + public async Task> GetAllAsync() => await discountService.GetAsync(); [HttpGet("shared")] public async Task>> GetSharedDiscountsAsync() { try { - return Ok(await _mediator.Send(new GetSharedDiscountCommand())); + return Ok(await mediator.Send(new GetSharedDiscountCommand())); } catch (Exception e) { @@ -43,7 +34,7 @@ public async Task>> SearchAsync([FromQuery { try { - return Ok(await _mediator.Send(new SearchDiscountCommand(searchWord))); + return Ok(await mediator.Send(new SearchDiscountCommand(searchWord))); } catch (Exception e) { @@ -56,7 +47,7 @@ public async Task GetByIdAsync(Guid id) { try { - return Ok(await _discountService.GetByIdAsync(id)); + return Ok(await discountService.GetByIdAsync(id)); } catch (NotFoundException e) { @@ -73,7 +64,7 @@ public async Task CreateAsync(CreateDiscountViewModel model) { try { - var result = await _discountService.CreateAsync(new DiscountDto + var result = await discountService.CreateAsync(new DiscountDto { WithBarCode = model.WithBarCode, WithQrCode = model.WithQrCode, @@ -96,7 +87,7 @@ public async Task UpdateAsync(DiscountDto discountDto) { try { - var result = await _discountService.UpdateAsync(discountDto); + var result = await discountService.UpdateAsync(discountDto); return Ok(result); } @@ -111,7 +102,7 @@ public async Task DeleteAsync(Guid id) { try { - await _discountService.DeleteAsync(id); + await discountService.DeleteAsync(id); return NoContent(); } catch (Exception e) diff --git a/src/api/EProfspilka.API/Controllers/EventController.cs b/src/api/EProfspilka.API/Controllers/EventController.cs new file mode 100644 index 0000000..cf11244 --- /dev/null +++ b/src/api/EProfspilka.API/Controllers/EventController.cs @@ -0,0 +1,97 @@ +using AutoMapper; +using EProfspilka.API.ViewModels; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace EProfspilka.API.Controllers; + +[ApiController] +[Route("event")] +//[Authorize(Policy = PolicyNames.ModeratorAndAdminPolicyName)] +public class EventController(IEventService eventService, IMapper mapper, ILogger logger) : ControllerBase +{ + [HttpPost] + public async Task Create([FromBody] EventViewModel eventViewModel) + { + try + { + var eventDto = await eventService.Create(mapper.Map(eventViewModel)); + + return StatusCode(StatusCodes.Status201Created, eventDto); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpGet] + [AllowAnonymous] + public async Task Get() + { + try + { + return Ok(await eventService.Get()); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpGet("{id}")] + [AllowAnonymous] + public async Task>> Get(Guid id) + { + try + { + return Ok(await eventService.Get(id)); + } + catch (NotFoundException e) + { + return NotFound(new ErrorResponseModel(e.Message)); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpDelete("{id}")] + public async Task Delete(Guid id) + { + try + { + await eventService.Delete(id); + return NoContent(); + } + catch (NotFoundException e) + { + return NotFound(new ErrorResponseModel(e.Message)); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpPut] + public async Task Update(EventDto eventDto) + { + try + { + return Ok(await eventService.Update(eventDto)); + } + catch (NotFoundException e) + { + return NotFound(new ErrorResponseModel(e.Message)); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Controllers/PartnersController.cs b/src/api/EProfspilka.API/Controllers/PartnersController.cs new file mode 100644 index 0000000..11f63ed --- /dev/null +++ b/src/api/EProfspilka.API/Controllers/PartnersController.cs @@ -0,0 +1,74 @@ +using EProfspilka.API.ViewModels; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using Microsoft.AspNetCore.Mvc; + +namespace EProfspilka.API.Controllers; + +[ApiController] +[Route("partners")] +public class PartnersController(IPartnersService partnersService) : ControllerBase +{ + [HttpGet] + public async Task GetQuestions() + { + try + { + return Ok(await partnersService.GetAllAsync()); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpPost] + // TODO Uncomment this lines + //[Authorize(Policy = PolicyNames.ModeratorAndAdminPolicyName)] + public async Task CreateQuestion([FromBody] PartnerViewModel partnerViewModel) + { + try + { + var res = await partnersService.CreateAsync(new PartnerDto + { + SubText = partnerViewModel.SubText, + SubTextLink = partnerViewModel.SubTextLink, + Image = partnerViewModel.Image, + MainText = partnerViewModel.MainText + }); + return Ok(res); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpPut] + public async Task Update(PartnerDto partnerDto) + { + try + { + return Ok(await partnersService.UpdateAsync(partnerDto)); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpDelete("{id}")] + //[Authorize(Policy = PolicyNames.ModeratorAndAdminPolicyName)] + public async Task Delete(Guid id) + { + try + { + await partnersService.DeleteAsync(id); + return Ok(); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Controllers/QuestionController.cs b/src/api/EProfspilka.API/Controllers/QuestionController.cs new file mode 100644 index 0000000..357ab29 --- /dev/null +++ b/src/api/EProfspilka.API/Controllers/QuestionController.cs @@ -0,0 +1,73 @@ +using EProfspilka.API.ViewModels; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace EProfspilka.API.Controllers; + +[ApiController] +[Route("question")] +public class QuestionController(IQuestionService questionService) : ControllerBase +{ + [HttpGet] + public async Task GetQuestions() + { + try + { + return Ok(await questionService.GetAllAsync()); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpPost] + [Authorize] + public async Task CreateQuestion([FromBody] QuestionViewModel questionViewModel) + { + try + { + var res = await questionService.CreateAsync(new QuestionDto + { + Answer = questionViewModel.Answer, + QuestionText = questionViewModel.QuestionText + }); + return Ok(res); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpPut] + [Authorize] + public async Task Update(QuestionDto questionDto) + { + try + { + return Ok(await questionService.UpdateAsync(questionDto)); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } + + [HttpDelete("{id}")] + [Authorize] + public async Task Delete(Guid id) + { + try + { + await questionService.DeleteAsync(id); + return Ok(); + } + catch (Exception e) + { + return BadRequest(new ErrorResponseModel(e.Message)); + } + } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/SiteSettingsController.cs b/src/api/EProfspilka.API/Controllers/SiteSettingsController.cs similarity index 57% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/SiteSettingsController.cs rename to src/api/EProfspilka.API/Controllers/SiteSettingsController.cs index 7ea6c33..70bde9d 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/SiteSettingsController.cs +++ b/src/api/EProfspilka.API/Controllers/SiteSettingsController.cs @@ -1,22 +1,15 @@ -using MediatR; +using EProfspilka.Core.Models; +using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [Route("[controller]")] [Authorize] -public class SiteSettingsController : ControllerBase +public class SiteSettingsController(IMediator mediator) : ControllerBase { - private readonly IMediator _mediator; - - public SiteSettingsController(IMediator mediator) - { - _mediator = mediator; - } - [HttpGet] public async Task GetSiteSettings() { diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/StudentStoreController.cs b/src/api/EProfspilka.API/Controllers/StudentStoreController.cs similarity index 64% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/StudentStoreController.cs rename to src/api/EProfspilka.API/Controllers/StudentStoreController.cs index 51be2ba..a19d7af 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/StudentStoreController.cs +++ b/src/api/EProfspilka.API/Controllers/StudentStoreController.cs @@ -1,34 +1,22 @@ +using EProfispilka.Application.CommandHandlers; +using EProfispilka.Application.Factories; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Application.CommandHandlers; -using YeProfspilka.Application.Factories; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [Route("student-store")] -public class StudentStoreController : ControllerBase +public class StudentStoreController( + IStudentStoreService studentStore, + IMediator mediator, + ILogger logger, + IImportCommandFactory importCommandFactory) : ControllerBase { private const string XlsxContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; - private readonly IStudentStoreService _studentStore; - private readonly IMediator _mediator; - private readonly ILogger _logger; - private readonly IImportCommandFactory _importCommandFactory; - - public StudentStoreController( - IStudentStoreService studentStore, - IMediator mediator, - ILogger logger, - IImportCommandFactory importCommandFactory) - { - _studentStore = studentStore; - _mediator = mediator; - _logger = logger; - _importCommandFactory = importCommandFactory; - } [HttpPost("upload")] [Authorize] @@ -47,14 +35,14 @@ public async Task UploadUsers(IFormFile file, [FromQuery] string i await file.CopyToAsync(stream); } - var importCommand = _importCommandFactory.Create(importType, filePath); + var importCommand = importCommandFactory.Create(importType, filePath); if (importCommand is null) { return BadRequest(new ErrorResponseModel("Неіснуючий тип імпорту")); } - return Ok(await _mediator.Send(importCommand)); + return Ok(await mediator.Send(importCommand)); } catch (Exception e) @@ -79,7 +67,7 @@ public async Task UploadExcel([FromForm] IFormFile file) await file.CopyToAsync(stream); } - return Ok(await _studentStore.UploadUsers(filePath, true)); + return Ok(await studentStore.UploadUsers(filePath, true)); } catch (Exception e) { @@ -92,7 +80,7 @@ public async Task GetUsers() { try { - return Ok(await _studentStore.GetAllUsers()); + return Ok(await studentStore.GetAllUsers()); } catch (Exception e) { @@ -107,10 +95,10 @@ public async Task> ExportUsers() try { const string fileName = "users"; - var fileData = await _mediator.Send(new ExportStudentsCommand()); - _logger.LogInformation("Successful created file with users"); + var fileData = await mediator.Send(new ExportStudentsCommand()); + logger.LogInformation("Successful created file with users"); - Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); + Response.Headers.Append("Access-Control-Expose-Headers", "Content-Disposition"); return File(fileData, XlsxContentType, fileName + ".xlsx"); } @@ -125,7 +113,7 @@ public async Task> GetUser(Guid id) { try { - var matchingUser = await _mediator.Send(new GetStudentUserByIdCommand(id)); + var matchingUser = await mediator.Send(new GetStudentUserByIdCommand(id)); return Ok(matchingUser); } diff --git a/YeProfspilka.Backend/YeProfspilka.API/Controllers/UserController.cs b/src/api/EProfspilka.API/Controllers/UserController.cs similarity index 59% rename from YeProfspilka.Backend/YeProfspilka.API/Controllers/UserController.cs rename to src/api/EProfspilka.API/Controllers/UserController.cs index dddc1bd..9459966 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Controllers/UserController.cs +++ b/src/api/EProfspilka.API/Controllers/UserController.cs @@ -1,30 +1,21 @@ +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using YeProfspilka.Backend.Policies; -using YeProfspilka.Backend.ViewModels; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Backend.Controllers; +namespace EProfspilka.API.Controllers; [ApiController] [Route("user")] [Authorize] -public class UserController : ControllerBase +public class UserController(IUserServices userServices) : ControllerBase { - private readonly IUserServices _userServices; - - public UserController(IUserServices userServices) - { - _userServices = userServices; - } - [HttpGet] public async Task GetCurrentUser() { try { - return Ok(await _userServices.GetCurrentUser()); + return Ok(await userServices.GetCurrentUser()); } catch (Exception e) { @@ -33,7 +24,7 @@ public async Task GetCurrentUser() } [HttpGet("all")] - public async Task GetUsers() => Ok(await _userServices.GetUsers()); + public async Task GetUsers() => Ok(await userServices.GetUsers()); [HttpPut] [Authorize] @@ -41,7 +32,7 @@ public async Task UpdateUser([FromBody] UserMatchingStoreModel us { try { - return Ok(await _userServices.UpdateUser( + return Ok(await userServices.UpdateUser( userMatchingStoreModel.Id.Value, userMatchingStoreModel.Facultet, userMatchingStoreModel.Course.Value, diff --git a/YeProfspilka.Backend/YeProfspilka.API/YeProfspilka.API.csproj b/src/api/EProfspilka.API/EProfspilka.API.csproj similarity index 51% rename from YeProfspilka.Backend/YeProfspilka.API/YeProfspilka.API.csproj rename to src/api/EProfspilka.API/EProfspilka.API.csproj index e2b7f93..c787aea 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/YeProfspilka.API.csproj +++ b/src/api/EProfspilka.API/EProfspilka.API.csproj @@ -1,29 +1,28 @@ - + - net6.0 + net8.0 enable enable - YeProfspilka.Backend + EProfspilka.API 8a72245e-cd8d-4373-9dc0-648acdb3f871 - - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + diff --git a/src/api/EProfspilka.API/Extension/CookiesExtension.cs b/src/api/EProfspilka.API/Extension/CookiesExtension.cs new file mode 100644 index 0000000..e2c589c --- /dev/null +++ b/src/api/EProfspilka.API/Extension/CookiesExtension.cs @@ -0,0 +1,26 @@ +using EProfspilka.API.Utils; +using EProfspilka.Core.Models; + +namespace EProfspilka.API.Extension; + +public static class CookieExtension +{ + public static void SetTokenCookie(this HttpContext context, AuthenticateResponseModel model) + { + var cookieOptions = new CookieOptions + { + HttpOnly = true, + Expires = DateTime.Now.AddDays(7), + Secure = true, + SameSite = SameSiteMode.None, + }; + + //context.Response.Cookies.Delete("yeProfspilkaRefreshToken"); + context.Response.Cookies.Append(CookieConstants.RefreshTokenKey, model.RefreshToken, cookieOptions); + } + + public static void DeleteRefreshToken(this HttpContext context) + { + context.Response.Cookies.Delete(CookieConstants.RefreshTokenKey); + } +} diff --git a/YeProfspilka.Backend/YeProfspilka.API/Extension/ServicesExtensions.cs b/src/api/EProfspilka.API/Extension/ServicesExtensions.cs similarity index 91% rename from YeProfspilka.Backend/YeProfspilka.API/Extension/ServicesExtensions.cs rename to src/api/EProfspilka.API/Extension/ServicesExtensions.cs index 7912ffb..008af40 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Extension/ServicesExtensions.cs +++ b/src/api/EProfspilka.API/Extension/ServicesExtensions.cs @@ -1,21 +1,19 @@ +using System.Text; +using EProfispilka.Application.CommandHandlers; +using EProfispilka.Application.Configurations; +using EProfispilka.Application.Factories; +using EProfispilka.Application.Services; +using EProfspilka.API.Mappers; +using EProfspilka.API.Policies; +using EProfspilka.Core.Interfaces; +using EProfspilka.Db.EF; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; -using System.Reflection; -using System.Text; -using YeProfspilka.Application.CommandHandlers; -using YeProfspilka.Application.Configurations; -using YeProfspilka.Application.Factories; -using YeProfspilka.Application.Services; -using YeProfspilka.Backend.Mappers; -using YeProfspilka.Backend.Policies; -using YeProfspilka.Core; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Backend.Extension; +namespace EProfspilka.API.Extension; public static class ServicesExtensions { @@ -44,7 +42,7 @@ public static void ConfigureServices(this IServiceCollection services, IConfigur services.AddScoped(); // Add AutoMapper - services.AddAutoMapper(typeof(EventsMapper).GetTypeInfo().Assembly); + services.AddAutoMapper(typeof(EventsMapper)); // Add MediatR services.AddMediatR(cfg => diff --git a/YeProfspilka.Backend/YeProfspilka.API/Mappers/AdvantageMapper.cs b/src/api/EProfspilka.API/Mappers/AdvantageMapper.cs similarity index 64% rename from YeProfspilka.Backend/YeProfspilka.API/Mappers/AdvantageMapper.cs rename to src/api/EProfspilka.API/Mappers/AdvantageMapper.cs index 19138d5..9facc4e 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Mappers/AdvantageMapper.cs +++ b/src/api/EProfspilka.API/Mappers/AdvantageMapper.cs @@ -1,8 +1,8 @@ using AutoMapper; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Models; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; -namespace YeProfspilka.Backend.Mappers; +namespace EProfspilka.API.Mappers; public class AdvantageMapper : Profile { diff --git a/YeProfspilka.Backend/YeProfspilka.API/Mappers/DiscountMapper.cs b/src/api/EProfspilka.API/Mappers/DiscountMapper.cs similarity index 78% rename from YeProfspilka.Backend/YeProfspilka.API/Mappers/DiscountMapper.cs rename to src/api/EProfspilka.API/Mappers/DiscountMapper.cs index c9aa3dc..7ddb540 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Mappers/DiscountMapper.cs +++ b/src/api/EProfspilka.API/Mappers/DiscountMapper.cs @@ -1,8 +1,8 @@ using AutoMapper; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Models; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; -namespace YeProfspilka.Backend.Mappers; +namespace EProfspilka.API.Mappers; public class DiscountMapper : Profile { diff --git a/src/api/EProfspilka.API/Mappers/EventsMapper.cs b/src/api/EProfspilka.API/Mappers/EventsMapper.cs new file mode 100644 index 0000000..993fb1f --- /dev/null +++ b/src/api/EProfspilka.API/Mappers/EventsMapper.cs @@ -0,0 +1,23 @@ +using AutoMapper; +using EProfspilka.API.ViewModels; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; + +namespace EProfspilka.API.Mappers; + +public class EventsMapper : Profile +{ + public EventsMapper() + { + CreateMap(); + CreateMap(); + CreateMap() + .ForMember(x => x.IsPassed, opts => opts.MapFrom(x => x.Date > DateTime.Now)) + .ForMember(x => x.Images, opts => opts.MapFrom(x => MapEventsImages(x.EventImages))); + } + + private static IEnumerable MapEventsImages(IEnumerable eventImages) + { + return eventImages.Select(x => x.Image.ImageUrl); + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Mappers/PartnerMapper.cs b/src/api/EProfspilka.API/Mappers/PartnerMapper.cs new file mode 100644 index 0000000..0775a69 --- /dev/null +++ b/src/api/EProfspilka.API/Mappers/PartnerMapper.cs @@ -0,0 +1,14 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; + +namespace EProfspilka.API.Mappers; + +public class PartnerMapper : Profile +{ + public PartnerMapper() + { + CreateMap() + .ForMember(x => x.Image, opts => opts.MapFrom(x => x.Image.ImageUrl)); + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Mappers/QuestionMapper.cs b/src/api/EProfspilka.API/Mappers/QuestionMapper.cs new file mode 100644 index 0000000..70a7e70 --- /dev/null +++ b/src/api/EProfspilka.API/Mappers/QuestionMapper.cs @@ -0,0 +1,14 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; + +namespace EProfspilka.API.Mappers; + +public class QuestionMapper : Profile +{ + public QuestionMapper() + { + CreateMap(); + CreateMap(); + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Mappers/UserMapper.cs b/src/api/EProfspilka.API/Mappers/UserMapper.cs new file mode 100644 index 0000000..5cc7479 --- /dev/null +++ b/src/api/EProfspilka.API/Mappers/UserMapper.cs @@ -0,0 +1,36 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; +using Role = EProfspilka.Core.Enumerations.Role; + +namespace EProfspilka.API.Mappers; + +public class UserMapper : Profile +{ + public UserMapper() + { + CreateMap(); + + CreateMap() + .ForMember(x => x.Role, opts => opts.MapFrom(x => RoleResolver(x.UserRoles))) + .ForMember(x => x.Email, opts => opts.MapFrom(x => x.Email)) + .ForMember(x => x.Avatar, opts => opts.MapFrom(src => src.Image.ImageUrl)); + } + + private Role RoleResolver(IEnumerable userRoles) + { + var userRolesEnum = userRoles.Select(x => x.RoleId).ToList(); + + if (userRolesEnum.Contains(Role.Admin)) + return Role.Admin; + + if (userRolesEnum.Contains(Role.Moderator)) + return Role.Moderator; + + if (userRolesEnum.Contains(Role.MemberProfspilka)) + return Role.MemberProfspilka; + + return userRolesEnum.Contains(Role.Student) ? Role.Student : Role.NotVerified; + } + +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Policies/PolicyNames.cs b/src/api/EProfspilka.API/Policies/PolicyNames.cs new file mode 100644 index 0000000..22f3ed2 --- /dev/null +++ b/src/api/EProfspilka.API/Policies/PolicyNames.cs @@ -0,0 +1,38 @@ +namespace EProfspilka.API.Policies; + +public class PolicyNames +{ + // Policy names + public const string AdminPolicyName = "AdminPolicy"; + + public const string StudentPolicyName = "StudentPolicy"; + + public const string MemberProfspilkaPolicyName = "MemberProfspilkaPolicy"; + + public const string NotVerifiedPolicyName = "NotVerifiedPolicy"; + + public const string ModeratorPolicyName = "ModeratorPolicy"; + + public const string HeadOfUnitPolicyName = "HeadOfUnitPolicy"; + + public const string ModeratorAndAdminPolicyName = "ModeratorAndAdminPolicy"; + + public const string AllRolesPolicyName = "ModeratorAndAdminAndStudentPolicy"; + + // Roles + public const string AdminRole = "Admin"; + + public const string StudentRole = "Student"; + + public const string MemberProfspilkaRole = "MemberProfspilka"; + + public const string NotVerifiedRole = "NotVerified"; + + public const string ModeratorRole = "Moderator"; + + public const string HeadOfUnitRole = "HeadOfUnit"; + + public const string ModeratorAndAdminRole = "ModeratorAndAdmin"; + + public const string AllRoles = "ModeratorAndAdminAndStudent"; +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/Policies/RoleHandler.cs b/src/api/EProfspilka.API/Policies/RoleHandler.cs new file mode 100644 index 0000000..6b9177b --- /dev/null +++ b/src/api/EProfspilka.API/Policies/RoleHandler.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Authorization; + +namespace EProfspilka.API.Policies; + +public class RoleHandler : AuthorizationHandler +{ + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, RoleRequirement requirement) + { + if (context.User.IsInRole(requirement.Role)) + { + context.Succeed(requirement); + } + + return Task.CompletedTask; + } +} diff --git a/src/api/EProfspilka.API/Policies/RoleRequirement.cs b/src/api/EProfspilka.API/Policies/RoleRequirement.cs new file mode 100644 index 0000000..accc9a9 --- /dev/null +++ b/src/api/EProfspilka.API/Policies/RoleRequirement.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Authorization; + +namespace EProfspilka.API.Policies; + +public class RoleRequirement(string role) : IAuthorizationRequirement +{ + public string Role { get; set; } = role; +} diff --git a/YeProfspilka.Backend/YeProfspilka.API/Program.cs b/src/api/EProfspilka.API/Program.cs similarity index 91% rename from YeProfspilka.Backend/YeProfspilka.API/Program.cs rename to src/api/EProfspilka.API/Program.cs index b8c3c39..7a83ee0 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Program.cs +++ b/src/api/EProfspilka.API/Program.cs @@ -1,7 +1,7 @@ +using EProfspilka.API.Extension; +using EProfspilka.Db.DbInitialize; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Backend.Extension; -using YeProfspilka.Db.DbInitialize; -using YeProfspilka.Db.EF; var builder = WebApplication.CreateBuilder(args); diff --git a/YeProfspilka.Backend/YeProfspilka.API/Properties/launchSettings.json b/src/api/EProfspilka.API/Properties/launchSettings.json similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.API/Properties/launchSettings.json rename to src/api/EProfspilka.API/Properties/launchSettings.json diff --git a/YeProfspilka.Backend/YeProfspilka.API/Utils/CookieConstants.cs b/src/api/EProfspilka.API/Utils/CookieConstants.cs similarity index 74% rename from YeProfspilka.Backend/YeProfspilka.API/Utils/CookieConstants.cs rename to src/api/EProfspilka.API/Utils/CookieConstants.cs index 78617ae..c09b0c1 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/Utils/CookieConstants.cs +++ b/src/api/EProfspilka.API/Utils/CookieConstants.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Backend.Utils; +namespace EProfspilka.API.Utils; public static class CookieConstants { diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/CreateDiscountViewModel.cs b/src/api/EProfspilka.API/ViewModels/CreateDiscountViewModel.cs similarity index 69% rename from YeProfspilka.Backend/YeProfspilka.API/ViewModels/CreateDiscountViewModel.cs rename to src/api/EProfspilka.API/ViewModels/CreateDiscountViewModel.cs index beda8ea..3f0082d 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/CreateDiscountViewModel.cs +++ b/src/api/EProfspilka.API/ViewModels/CreateDiscountViewModel.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Enumerations; +using EProfspilka.Core.Enumerations; -namespace YeProfspilka.Backend.ViewModels; +namespace EProfspilka.API.ViewModels; public record CreateDiscountViewModel( string Name, diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/DiscountViewModel.cs b/src/api/EProfspilka.API/ViewModels/DiscountViewModel.cs similarity index 57% rename from YeProfspilka.Backend/YeProfspilka.API/ViewModels/DiscountViewModel.cs rename to src/api/EProfspilka.API/ViewModels/DiscountViewModel.cs index 9582dd2..4ac53aa 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/DiscountViewModel.cs +++ b/src/api/EProfspilka.API/ViewModels/DiscountViewModel.cs @@ -1,5 +1,5 @@ -using YeProfspilka.Core.Enumerations; +using EProfspilka.Core.Enumerations; -namespace YeProfspilka.Backend.ViewModels; +namespace EProfspilka.API.ViewModels; public record DiscountViewModel(string Name, string Description, string CodeWord, DiscountType DiscountType); \ No newline at end of file diff --git a/src/api/EProfspilka.API/ViewModels/EmailViewModel.cs b/src/api/EProfspilka.API/ViewModels/EmailViewModel.cs new file mode 100644 index 0000000..6fc1761 --- /dev/null +++ b/src/api/EProfspilka.API/ViewModels/EmailViewModel.cs @@ -0,0 +1,6 @@ +namespace EProfspilka.API.ViewModels; + +public class EmailViewModel(string email) +{ + public string Email { get; } = email; +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/ViewModels/EventViewModel.cs b/src/api/EProfspilka.API/ViewModels/EventViewModel.cs new file mode 100644 index 0000000..c5537e4 --- /dev/null +++ b/src/api/EProfspilka.API/ViewModels/EventViewModel.cs @@ -0,0 +1,14 @@ +namespace EProfspilka.API.ViewModels; + +public class EventViewModel +{ + public string Title { get; set; } + + public string Description { get; set; } + + public DateTime? Date { get; set; } + + public IEnumerable Images { get; set; } + + public string ShortDescription { get; set; } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/FileViewModel.cs b/src/api/EProfspilka.API/ViewModels/FileViewModel.cs similarity index 61% rename from YeProfspilka.Backend/YeProfspilka.API/ViewModels/FileViewModel.cs rename to src/api/EProfspilka.API/ViewModels/FileViewModel.cs index 42aa243..86a7084 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/FileViewModel.cs +++ b/src/api/EProfspilka.API/ViewModels/FileViewModel.cs @@ -1,3 +1,3 @@ -namespace YeProfspilka.Backend.ViewModels; +namespace EProfspilka.API.ViewModels; public record FileViewModel(IFormFile File, bool IsOverrideMethod); \ No newline at end of file diff --git a/src/api/EProfspilka.API/ViewModels/GoogleViewModel.cs b/src/api/EProfspilka.API/ViewModels/GoogleViewModel.cs new file mode 100644 index 0000000..bfbb500 --- /dev/null +++ b/src/api/EProfspilka.API/ViewModels/GoogleViewModel.cs @@ -0,0 +1,12 @@ +namespace EProfspilka.API.ViewModels; + +public class GoogleViewModel +{ + public string Email { get; set; } + + public string Hd { get; set; } + + public string FullName { get; set; } + + public string Avatar { get; set; } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/PartnerViewModel.cs b/src/api/EProfspilka.API/ViewModels/PartnerViewModel.cs similarity index 69% rename from YeProfspilka.Backend/YeProfspilka.API/ViewModels/PartnerViewModel.cs rename to src/api/EProfspilka.API/ViewModels/PartnerViewModel.cs index 910b9aa..9499fde 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/PartnerViewModel.cs +++ b/src/api/EProfspilka.API/ViewModels/PartnerViewModel.cs @@ -1,3 +1,3 @@ -namespace YeProfspilka.Backend.ViewModels; +namespace EProfspilka.API.ViewModels; public record PartnerViewModel(string MainText, string SubText, string Image, string SubTextLink); \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/QuestionViewModel.cs b/src/api/EProfspilka.API/ViewModels/QuestionViewModel.cs similarity index 61% rename from YeProfspilka.Backend/YeProfspilka.API/ViewModels/QuestionViewModel.cs rename to src/api/EProfspilka.API/ViewModels/QuestionViewModel.cs index 17db818..5a783fc 100644 --- a/YeProfspilka.Backend/YeProfspilka.API/ViewModels/QuestionViewModel.cs +++ b/src/api/EProfspilka.API/ViewModels/QuestionViewModel.cs @@ -1,3 +1,3 @@ -namespace YeProfspilka.Backend.ViewModels; +namespace EProfspilka.API.ViewModels; public record QuestionViewModel(string QuestionText, string Answer); \ No newline at end of file diff --git a/src/api/EProfspilka.API/ViewModels/RegistrationViewModel.cs b/src/api/EProfspilka.API/ViewModels/RegistrationViewModel.cs new file mode 100644 index 0000000..4875d98 --- /dev/null +++ b/src/api/EProfspilka.API/ViewModels/RegistrationViewModel.cs @@ -0,0 +1,10 @@ +namespace EProfspilka.API.ViewModels; + +public class RegistrationViewModel +{ + public string FullName { get; set; } + + public string Email { get; set; } + + public string Image { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.API/ViewModels/RoleViewModel.cs b/src/api/EProfspilka.API/ViewModels/RoleViewModel.cs new file mode 100644 index 0000000..7e3a2e4 --- /dev/null +++ b/src/api/EProfspilka.API/ViewModels/RoleViewModel.cs @@ -0,0 +1,5 @@ +using EProfspilka.Core.Enumerations; + +namespace EProfspilka.API.ViewModels; + +public record RoleViewModel(Guid Id, Role Role); \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.API/appsettings.Development.json b/src/api/EProfspilka.API/appsettings.Development.json similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.API/appsettings.Development.json rename to src/api/EProfspilka.API/appsettings.Development.json diff --git a/YeProfspilka.Backend/YeProfspilka.API/appsettings.json b/src/api/EProfspilka.API/appsettings.json similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.API/appsettings.json rename to src/api/EProfspilka.API/appsettings.json diff --git a/src/api/EProfspilka.Application/CommandHandlers/AddImportCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/AddImportCommandHandler.cs new file mode 100644 index 0000000..6023ae7 --- /dev/null +++ b/src/api/EProfspilka.Application/CommandHandlers/AddImportCommandHandler.cs @@ -0,0 +1,20 @@ +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using MediatR; +using Microsoft.Extensions.Logging; + +namespace EProfispilka.Application.CommandHandlers; + +public class AddImportCommand(string filePath) : IImportCommand +{ + public string FilePath { get; set; } = filePath; +} + +public class AddImportCommandHandler(ILogger logger) : IRequestHandler +{ + public async Task Handle(AddImportCommand request, CancellationToken cancellationToken) + { + logger.LogInformation("Add import executed"); + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/ExportStudentsCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/ExportStudentsCommandHandler.cs similarity index 66% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/ExportStudentsCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/ExportStudentsCommandHandler.cs index 4b39874..e9d42ec 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/ExportStudentsCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/ExportStudentsCommandHandler.cs @@ -1,33 +1,24 @@ -using MediatR; +using EProfspilka.Db.EF; +using MediatR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using OfficeOpenXml; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; public class ExportStudentsCommand : IRequest { } -public class ExportStudentsCommandHandler : IRequestHandler +public class ExportStudentsCommandHandler( + YeProfspilkaContext db, + ILogger logger) : IRequestHandler { - private readonly YeProfspilkaContext _db; - private readonly ILogger _logger; - - public ExportStudentsCommandHandler( - YeProfspilkaContext db, - ILogger logger) - { - _db = db; - _logger = logger; - } - public async Task Handle(ExportStudentsCommand request, CancellationToken cancellationToken) { - var users = await _db.StudentsStore.ToListAsync(cancellationToken); + var users = await db.StudentsStore.ToListAsync(cancellationToken); - _logger.LogInformation("Was found {count} users in StudentStore table", users.Count); + logger.LogInformation("Was found {count} users in StudentStore table", users.Count); ExcelPackage.LicenseContext = LicenseContext.NonCommercial; using var package = new ExcelPackage(); @@ -54,7 +45,7 @@ public async Task Handle(ExportStudentsCommand request, CancellationToke worksheet.Cells[row, 5].Value = student.IsMemberProf ? "Так" : "Ні"; } - _logger.LogInformation("Finished creation bytes array for xlsx file"); + logger.LogInformation("Finished creation bytes array for xlsx file"); return package.GetAsByteArray(); } diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GenerateDiscountCodeCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/GenerateDiscountCodeCommandHandler.cs similarity index 51% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GenerateDiscountCodeCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/GenerateDiscountCodeCommandHandler.cs index bcd3fbb..c7d175a 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GenerateDiscountCodeCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/GenerateDiscountCodeCommandHandler.cs @@ -1,39 +1,27 @@ using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using MediatR; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; -public class GenerateDiscountCodeCommand : IRequest +public class GenerateDiscountCodeCommand(Guid discountId) : IRequest { - public GenerateDiscountCodeCommand(Guid discountId) - { - DiscountId = discountId; - } - - public Guid DiscountId { get; set; } + public Guid DiscountId { get; set; } = discountId; } -public class GenerateDiscountCodeCommandHandler : IRequestHandler +public class GenerateDiscountCodeCommandHandler( + YeProfspilkaContext db, + IMapper mapper, + ISecurityContext securityContext) : IRequestHandler { - private readonly YeProfspilkaContext _db; - private readonly IMapper _mapper; - private readonly ISecurityContext _securityContext; - - public GenerateDiscountCodeCommandHandler( - YeProfspilkaContext db, - IMapper mapper, - ISecurityContext securityContext) - { - _db = db ?? throw new ArgumentException(nameof(YeProfspilkaContext)); - _mapper = mapper ?? throw new ArgumentException(nameof(IMapper)); - _securityContext = securityContext ?? throw new ArgumentException(nameof(ArgumentException)); - } + private readonly YeProfspilkaContext _db = db ?? throw new ArgumentException(nameof(YeProfspilkaContext)); + private readonly IMapper _mapper = mapper ?? throw new ArgumentException(nameof(IMapper)); + private readonly ISecurityContext _securityContext = securityContext ?? throw new ArgumentException(nameof(ArgumentException)); public async Task Handle(GenerateDiscountCodeCommand request, CancellationToken cancellationToken) { diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetSharedDiscountsCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/GetSharedDiscountsCommandHandler.cs similarity index 63% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetSharedDiscountsCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/GetSharedDiscountsCommandHandler.cs index 2ed6a6d..a5cde85 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/GetSharedDiscountsCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/GetSharedDiscountsCommandHandler.cs @@ -1,27 +1,20 @@ +using EProfspilka.Core.Enumerations; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using MediatR; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Enumerations; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; public class GetSharedDiscountCommand : IRequest> { } -public class GetSharedDiscountsCommandHandler : IRequestHandler> +public class GetSharedDiscountsCommandHandler(YeProfspilkaContext db) : IRequestHandler> { - private readonly YeProfspilkaContext _db; - - public GetSharedDiscountsCommandHandler(YeProfspilkaContext db) - { - _db = db; - } - public async Task> Handle(GetSharedDiscountCommand request, CancellationToken cancellationToken) { - return await _db.Discounts + return await db.Discounts .Where(d => d.DiscountType == DiscountType.AvailableForAll) .Select(x => new DiscountDto { diff --git a/src/api/EProfspilka.Application/CommandHandlers/GetSiteSettingsCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/GetSiteSettingsCommandHandler.cs new file mode 100644 index 0000000..887963b --- /dev/null +++ b/src/api/EProfspilka.Application/CommandHandlers/GetSiteSettingsCommandHandler.cs @@ -0,0 +1,17 @@ +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using MediatR; + +namespace EProfispilka.Application.CommandHandlers; + +public class GetSiteSettingsCommand : IRequest +{ +} + +public class GetSiteSettingsCommandHandler(YeProfspilkaContext db) : IRequestHandler +{ + public Task Handle(GetSiteSettingsCommand request, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } +} diff --git a/src/api/EProfspilka.Application/CommandHandlers/GetStudentUserByIdCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/GetStudentUserByIdCommandHandler.cs new file mode 100644 index 0000000..f0ac7cc --- /dev/null +++ b/src/api/EProfspilka.Application/CommandHandlers/GetStudentUserByIdCommandHandler.cs @@ -0,0 +1,58 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using MediatR; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + +namespace EProfispilka.Application.CommandHandlers; + +public class GetStudentUserByIdCommand(Guid id) : IRequest +{ + public Guid Id { get; set; } = id; +} + +public class GetStudentUserByIdCommandHandler( + YeProfspilkaContext db, + ILogger logger, + IRoleService roleService) + : IRequestHandler +{ + private const string DefaultImage = + "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460__340.png"; + + public async Task Handle(GetStudentUserByIdCommand request, CancellationToken cancellationToken) + { + var storeUser = await db.StudentsStore.SingleOrDefaultAsync(u => u.Id == request.Id, cancellationToken); + + if (storeUser is null) + { + logger.LogWarning("Student store user was not found with id = {id}", request.Id); + throw new NotFoundException(nameof(StudentStore), request.Id); + } + + var user = await db.Users + .Include(u => u.Image) + .Include(u => u.UserRoles) + .SingleOrDefaultAsync(u => u.Email == storeUser.Email, cancellationToken); + + if (user is null) + { + logger.LogInformation("User not found with email = {email}, so user is not activated", storeUser.Email); + } + + return new UserMatchingStoreModel() + { + Email = storeUser.Email, + FullName = storeUser.FullName, + Avatar = user?.Image.ImageUrl ?? DefaultImage, + IsMemberProf = storeUser.IsMemberProf, + Course = user?.Course ?? storeUser.Course, + Facultet = user?.Facultet ?? storeUser.Facultet, + Role = user == null ? null : roleService.RoleResolver(user.UserRoles), + Id = user?.Id ?? storeUser.Id, + }; + } +} diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/RefreshTokenCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/RefreshTokenCommandHandler.cs similarity index 50% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/RefreshTokenCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/RefreshTokenCommandHandler.cs index 8bb93a7..b268202 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/RefreshTokenCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/RefreshTokenCommandHandler.cs @@ -1,38 +1,24 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using MediatR; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; -public class RefreshTokenCommand : IRequest +public class RefreshTokenCommand(string refreshToken) : IRequest { - public RefreshTokenCommand(string refreshToken) - { - RefreshToken = refreshToken; - } - - public string RefreshToken { get; } + public string RefreshToken { get; } = refreshToken; } -public class RefreshTokenCommandHandler : IRequestHandler +public class RefreshTokenCommandHandler(YeProfspilkaContext db, ITokenService tokenService) : IRequestHandler { - private readonly YeProfspilkaContext _db; - private readonly ITokenService _tokenService; - - public RefreshTokenCommandHandler(YeProfspilkaContext db, ITokenService tokenService) - { - _db = db; - _tokenService = tokenService; - } - public async Task Handle(RefreshTokenCommand request, CancellationToken cancellationToken) { - var user = await _db.Users + var user = await db.Users .Include(x => x.UserRoles) .ThenInclude(x => x.Role) .Include(x => x.UserTokens) @@ -47,15 +33,15 @@ public async Task Handle(RefreshTokenCommand request, throw new RefreshTokenException("Token is expired"); } - var newRefreshToken = _tokenService.GenerateRefreshToken(); + var newRefreshToken = tokenService.GenerateRefreshToken(); refreshToken.Revoked = DateTime.Now; refreshToken.ReplacedByToken = newRefreshToken.Token; newRefreshToken.UserId = user.Id; - await _db.UserTokens.AddAsync(newRefreshToken, cancellationToken); - await _db.SaveChangesAsync(cancellationToken); + await db.UserTokens.AddAsync(newRefreshToken, cancellationToken); + await db.SaveChangesAsync(cancellationToken); // Generate new JWT token - var jwt = _tokenService.GenerateAccessToken(user); + var jwt = tokenService.GenerateAccessToken(user); return new AuthenticateResponseModel(jwt, newRefreshToken.Token); } diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/ReplaceImportCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/ReplaceImportCommandHandler.cs similarity index 50% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/ReplaceImportCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/ReplaceImportCommandHandler.cs index 14b20d6..efbf303 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/ReplaceImportCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/ReplaceImportCommandHandler.cs @@ -1,69 +1,51 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using MediatR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -using Role = YeProfspilka.Core.Enumerations.Role; +using Role = EProfspilka.Core.Enumerations.Role; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; -public class ReplaceImportCommand : IImportCommand +public class ReplaceImportCommand(string filePath) : IImportCommand { - public ReplaceImportCommand(string filePath) - { - FilePath = filePath; - } - - public string FilePath { get; set; } + public string FilePath { get; set; } = filePath; } -public class ReplaceImportCommandHandler : IRequestHandler +public class ReplaceImportCommandHandler( + YeProfspilkaContext db, + IStudentStoreService studentStoreService, + IStudentsReader studentsReader, ILogger logger) : IRequestHandler { - private readonly YeProfspilkaContext _db; - private readonly IStudentStoreService _studentStoreService; - private readonly IStudentsReader _studentsReader; - private readonly ILogger _logger; - - public ReplaceImportCommandHandler( - YeProfspilkaContext db, - IStudentStoreService studentStoreService, - IStudentsReader studentsReader, ILogger logger) - { - _db = db; - _studentStoreService = studentStoreService; - _studentsReader = studentsReader; - _logger = logger; - } - public async Task Handle(ReplaceImportCommand request, CancellationToken cancellationToken) { - _logger.LogInformation("Replace starting"); + logger.LogInformation("Replace starting"); try { - var students = _studentsReader.Read(request.FilePath); + var students = studentsReader.Read(request.FilePath); var updatedUsersCount = 0; // Remove StudentStore - _db.StudentsStore.RemoveRange( - await _db.StudentsStore.ToListAsync(cancellationToken)); - _logger.LogInformation("Removed all students from Student Store table"); + db.StudentsStore.RemoveRange( + await db.StudentsStore.ToListAsync(cancellationToken)); + logger.LogInformation("Removed all students from Student Store table"); // Insert new Students - await _db.StudentsStore.AddRangeAsync(students, cancellationToken); - _logger.LogInformation("Inserted new students to Student Store table count = {Count}", students.Count); + await db.StudentsStore.AddRangeAsync(students, cancellationToken); + logger.LogInformation("Inserted new students to Student Store table count = {Count}", students.Count); // Update users table information foreach (var student in students) { - var user = await _db.Users + var user = await db.Users .Include(x => x.UserRoles) .ThenInclude(x => x.Role) .SingleOrDefaultAsync(x => x.Email == student.Email, cancellationToken); if (user == null) { - _logger.LogInformation("Skip user = {Email}", student.Email); + logger.LogInformation("Skip user = {Email}", student.Email); // Skip user because he is not authorized yet continue; } @@ -76,7 +58,7 @@ public async Task Handle(ReplaceImportCommand request, Cancel { if (user.UserRoles.FirstOrDefault(x => x.RoleId == Role.MemberProfspilka) == null) { - _logger.LogInformation("Dont Have a Member Role {Email}", user.Email); + logger.LogInformation("Dont Have a Member Role {Email}", user.Email); user.UserRoles.Add(new UserRole { RoleId = Role.MemberProfspilka, UserId = user.Id }); } @@ -93,13 +75,13 @@ public async Task Handle(ReplaceImportCommand request, Cancel // Add student role user.UserRoles.Add(new UserRole { RoleId = Role.Student, UserId = user.Id }); } - _logger.LogInformation("Update user information for {Email}", user.Email); - _db.Users.Update(user); - await _db.SaveChangesAsync(cancellationToken); + logger.LogInformation("Update user information for {Email}", user.Email); + db.Users.Update(user); + await db.SaveChangesAsync(cancellationToken); } - _logger.LogInformation("Replace finished"); + logger.LogInformation("Replace finished"); return new UploadResultModel(true, students.Count, "Успішно завантажено нових користувачів", @@ -108,7 +90,7 @@ public async Task Handle(ReplaceImportCommand request, Cancel } catch (Exception e) { - _logger.LogError(e,"Replace finished with ERROR"); + logger.LogError(e, "Replace finished with ERROR"); return new UploadResultModel(false, 0, "Щось пішло не так!"); } } diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/SearchDiscountCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/SearchDiscountCommandHandler.cs similarity index 67% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/SearchDiscountCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/SearchDiscountCommandHandler.cs index c37937d..9857531 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/SearchDiscountCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/SearchDiscountCommandHandler.cs @@ -1,34 +1,22 @@ +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using MediatR; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; -public class SearchDiscountCommand : IRequest> +public class SearchDiscountCommand(string searchWord) : IRequest> { - public SearchDiscountCommand(string searchWord) - { - SearchWord = searchWord; - } - - public string SearchWord { get; } + public string SearchWord { get; } = searchWord; } -public class SearchDiscountCommandHandler : IRequestHandler> +public class SearchDiscountCommandHandler(YeProfspilkaContext db) : IRequestHandler> { - private readonly YeProfspilkaContext _db; - - public SearchDiscountCommandHandler(YeProfspilkaContext db) - { - _db = db; - } - public async Task> Handle(SearchDiscountCommand request, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(request.SearchWord)) { - return await _db.Discounts + return await db.Discounts .Select(x => new DiscountDto { Id = x.Id, @@ -42,7 +30,7 @@ public async Task> Handle(SearchDiscountCommand request .ToListAsync(cancellationToken); } - var discounts = await _db.Discounts + var discounts = await db.Discounts .Where(x => x.Name.Contains(request.SearchWord) || x.Description.Contains(request.SearchWord)) .Select(x => new DiscountDto { diff --git a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/VerifyDiscountCodeCommandHandler.cs b/src/api/EProfspilka.Application/CommandHandlers/VerifyDiscountCodeCommandHandler.cs similarity index 53% rename from YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/VerifyDiscountCodeCommandHandler.cs rename to src/api/EProfspilka.Application/CommandHandlers/VerifyDiscountCodeCommandHandler.cs index 6118a13..d6a90fa 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/CommandHandlers/VerifyDiscountCodeCommandHandler.cs +++ b/src/api/EProfspilka.Application/CommandHandlers/VerifyDiscountCodeCommandHandler.cs @@ -1,52 +1,33 @@ using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Enumerations; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using MediatR; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Enumerations; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.CommandHandlers; +namespace EProfispilka.Application.CommandHandlers; -public class VerifyDiscountCodeCommand : IRequest +public class VerifyDiscountCodeCommand(Guid discountId, Guid discountCodeId) : IRequest { - public VerifyDiscountCodeCommand(Guid discountId, Guid discountCodeId) - { - DiscountId = discountId; - DiscountCode = discountCodeId; - } - - public Guid DiscountId { get; set; } - public Guid DiscountCode { get; set; } + public Guid DiscountId { get; set; } = discountId; + public Guid DiscountCode { get; set; } = discountCodeId; } -public class VerifyDiscountCodeCommandHandler : IRequestHandler +public class VerifyDiscountCodeCommandHandler(YeProfspilkaContext db, IMapper mapper) : IRequestHandler { - private readonly YeProfspilkaContext _db; - private readonly IMapper _mapper; - - public VerifyDiscountCodeCommandHandler(YeProfspilkaContext db, IMapper mapper) - { - _db = db; - _mapper = mapper; - } - public async Task Handle(VerifyDiscountCodeCommand request, CancellationToken cancellationToken) { - var discountCode = await _db.DiscountCodes + var discountCode = await db.DiscountCodes .Include(x => x.Discount) .Include(x => x.User) .ThenInclude(x => x.Image) .FirstOrDefaultAsync(x => x.Code == request.DiscountCode && x.DiscountId == request.DiscountId, - cancellationToken); - - if (discountCode == null) - { - throw new NotFoundException(nameof(DiscountCode), request.DiscountCode); - } + cancellationToken) + ?? throw new NotFoundException(nameof(DiscountCode), request.DiscountCode); if (!discountCode.IsActive) { @@ -58,12 +39,12 @@ public async Task Handle(VerifyDiscountCodeCommand request { discountCode.IsActive = false; - await _db.SaveChangesAsync(cancellationToken); + await db.SaveChangesAsync(cancellationToken); return new VerifyDiscountResult { IsSuccess = true, - Discount = _mapper.Map(discountCode.Discount), + Discount = mapper.Map(discountCode.Discount), Email = discountCode.User?.Email, FullName = discountCode.User?.FullName, Image = discountCode.User?.Image.ImageUrl, diff --git a/src/api/EProfspilka.Application/Configurations/AppConfiguration.cs b/src/api/EProfspilka.Application/Configurations/AppConfiguration.cs new file mode 100644 index 0000000..f475282 --- /dev/null +++ b/src/api/EProfspilka.Application/Configurations/AppConfiguration.cs @@ -0,0 +1,6 @@ +namespace EProfispilka.Application.Configurations; + +public class AppConfiguration +{ + public string DomainEmail { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Configurations/JwtConfiguration.cs b/src/api/EProfspilka.Application/Configurations/JwtConfiguration.cs new file mode 100644 index 0000000..2af027e --- /dev/null +++ b/src/api/EProfspilka.Application/Configurations/JwtConfiguration.cs @@ -0,0 +1,10 @@ +namespace EProfispilka.Application.Configurations; + +public class JwtConfiguration +{ + public string Key { get; set; } + + public string Issuer { get; set; } + + public string Audience { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/EProfispilka.Application.csproj b/src/api/EProfspilka.Application/EProfispilka.Application.csproj new file mode 100644 index 0000000..621c187 --- /dev/null +++ b/src/api/EProfspilka.Application/EProfispilka.Application.csproj @@ -0,0 +1,22 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + diff --git a/src/api/EProfspilka.Application/Factories/ImportCommandFactory.cs b/src/api/EProfspilka.Application/Factories/ImportCommandFactory.cs new file mode 100644 index 0000000..82cd981 --- /dev/null +++ b/src/api/EProfspilka.Application/Factories/ImportCommandFactory.cs @@ -0,0 +1,21 @@ +using EProfispilka.Application.CommandHandlers; +using EProfspilka.Core.Interfaces; + +namespace EProfispilka.Application.Factories; + +public interface IImportCommandFactory +{ + IImportCommand? Create(string importType, string filePath); +} + +public class ImportCommandFactory : IImportCommandFactory +{ + public IImportCommand? Create(string importType, string filePath) + => importType switch + { + "add" => new AddImportCommand(filePath), + "replace" => new ReplaceImportCommand(filePath), + _ => null, + }; + +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Services/AdvantageService.cs b/src/api/EProfspilka.Application/Services/AdvantageService.cs new file mode 100644 index 0000000..a9e5a4b --- /dev/null +++ b/src/api/EProfspilka.Application/Services/AdvantageService.cs @@ -0,0 +1,75 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using Microsoft.EntityFrameworkCore; + +namespace EProfispilka.Application.Services; + +public class AdvantageService(IMapper mapper, YeProfspilkaContext dbContext) : IAdvantageService +{ + public async Task Update(AdvantageDto advantageDto) + { + var entity = await dbContext.Advantage.FirstOrDefaultAsync(x => x.Id == advantageDto.Id); + + if (entity == null) + { + throw new NotFoundException(nameof(Advantage), advantageDto.Id); + } + + entity.MainText = advantageDto.MainText; + entity.SubText = advantageDto.SubText; + + dbContext.Advantage.Update(entity); + await dbContext.SaveChangesAsync(); + + return advantageDto; + } + + public async Task GetAll() + { + return mapper.Map(await dbContext.Advantage.ToListAsync()); + } + + public async Task GetById(Guid id) + { + var entity = await dbContext.Advantage.FirstOrDefaultAsync(x => x.Id == id); + + if (entity == null) + { + throw new NotFoundException(nameof(Advantage), id); + } + + return mapper.Map(entity); + } + + public async Task Delete(Guid id) + { + var entity = await dbContext.Advantage.FirstOrDefaultAsync(x => x.Id == id); + + if (entity == null) + { + throw new NotFoundException(nameof(Advantage), id); + } + + dbContext.Advantage.Remove(entity); + await dbContext.SaveChangesAsync(); + } + + public async Task Create(AdvantageDto advantageDto) + { + var entry = await dbContext.Advantage.AddAsync(new Advantage + { + MainText = advantageDto.MainText, + SubText = advantageDto.SubText, + }); + + await dbContext.SaveChangesAsync(); + + advantageDto.Id = entry.Entity.Id; + + return advantageDto; + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Services/AuthenticationService.cs b/src/api/EProfspilka.Application/Services/AuthenticationService.cs new file mode 100644 index 0000000..95c7dee --- /dev/null +++ b/src/api/EProfspilka.Application/Services/AuthenticationService.cs @@ -0,0 +1,83 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using Microsoft.EntityFrameworkCore; +using Role = EProfspilka.Core.Enumerations.Role; + +namespace EProfispilka.Application.Services; + +public class AuthenticationService(YeProfspilkaContext context, IStudentStoreService studentStore, ITokenService tokenService) : IAuthenticationService +{ + public async Task Authenticate(string email) + { + var user = context.Users + .Include(x => x.UserTokens) + .Include(x => x.UserRoles) + .FirstOrDefault(x => x.Email == email); + + if (user == null) + { + throw new AuthenticateException($"Користувача з емеллом {email} не існує!"); + } + + var jwtToken = tokenService.GenerateAccessToken(user); + var refreshToken = tokenService.GenerateRefreshToken(); + + user.UserTokens.Add(refreshToken); + await context.SaveChangesAsync(); + + return new AuthenticateResponseModel(jwtToken, refreshToken.Token); + } + + public async Task Authenticate(string email, string password) + { + throw new NotImplementedException(); + } + + public async Task Registration(string email, string fullName, string image) + { + var user = await CreateUser(email, fullName, image); + + var jwtToken = tokenService.GenerateAccessToken(user); + var refreshToken = tokenService.GenerateRefreshToken(); + + user.UserTokens.Add(refreshToken); + + await context.Users.AddAsync(user); + await context.SaveChangesAsync(); + + return new AuthenticateResponseModel(jwtToken, refreshToken.Token); + } + + private async Task CreateUser(string email, string fullName, string image) + { + var user = new User + { + Id = Guid.NewGuid(), + Email = email, + FullName = fullName, + Image = new Image(image), + UserRoles = new List(), + UserTokens = new List(), + }; + + user.UserRoles.Add(new UserRole { RoleId = Role.Student, UserId = user.Id }); + + if (!await studentStore.IsStudent(email)) + { + user.UserRoles.Add(new UserRole + { + RoleId = Role.NotVerified, + UserId = user.Id, + }); + } + else + { + await studentStore.MappingUser(user); + } + + return user; + } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/DiscountService.cs b/src/api/EProfspilka.Application/Services/DiscountService.cs similarity index 50% rename from YeProfspilka.Backend/YeProfspilka.Application/Services/DiscountService.cs rename to src/api/EProfspilka.Application/Services/DiscountService.cs index 566eb0b..4114bf3 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/DiscountService.cs +++ b/src/api/EProfspilka.Application/Services/DiscountService.cs @@ -1,24 +1,15 @@ using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -namespace YeProfspilka.Application.Services; +namespace EProfispilka.Application.Services; -public class DiscountService : IDiscountService +public class DiscountService(YeProfspilkaContext db, IMapper mapper) : IDiscountService { - private readonly YeProfspilkaContext _db; - private readonly IMapper _mapper; - - public DiscountService(YeProfspilkaContext db, IMapper mapper) - { - _db = db; - _mapper = mapper; - } - public async Task CreateAsync(DiscountDto discountDto) { var discount = new Discount @@ -35,22 +26,18 @@ public async Task CreateAsync(DiscountDto discountDto) discount.BarCodeImage = new Image(discountDto.BarCodeImage); } - var entry = await _db.Discounts.AddAsync(discount); + var entry = await db.Discounts.AddAsync(discount); - await _db.SaveChangesAsync(); + await db.SaveChangesAsync(); - return _mapper.Map(entry.Entity); + return mapper.Map(entry.Entity); } public async Task UpdateAsync(DiscountDto discountDto) { - var entity = _db.Discounts.FirstOrDefault(x => x.Id == discountDto.Id); - - if (entity is null) - { - throw new NotFoundException(nameof(Discount), discountDto.Id); - } + var entity = db.Discounts.FirstOrDefault(x => x.Id == discountDto.Id) + ?? throw new NotFoundException(nameof(Discount), discountDto.Id); entity.Description = discountDto.Description; entity.Name = discountDto.Name; @@ -70,41 +57,33 @@ public async Task UpdateAsync(DiscountDto discountDto) entity.DiscountType = discountDto.DiscountType; - _db.Discounts.Update(entity); - await _db.SaveChangesAsync(); + db.Discounts.Update(entity); + await db.SaveChangesAsync(); - return _mapper.Map(entity); + return mapper.Map(entity); } public async Task DeleteAsync(Guid id) { - var entity = await _db.Discounts.FirstOrDefaultAsync(x => x.Id == id); + var entity = await db.Discounts.FirstOrDefaultAsync(x => x.Id == id) + ?? throw new NotFoundException(nameof(Discount), id); - if (entity is null) - { - throw new NotFoundException(nameof(Discount), id); - } - - _db.Discounts.Remove(entity); - await _db.SaveChangesAsync(); + db.Discounts.Remove(entity); + await db.SaveChangesAsync(); } public async Task GetByIdAsync(Guid id) { - var entity = await _db.Discounts.FirstOrDefaultAsync(x => x.Id == id); - - if (entity is null) - { - throw new NotFoundException(nameof(Discount), id); - } + var entity = await db.Discounts.FirstOrDefaultAsync(x => x.Id == id) + ?? throw new NotFoundException(nameof(Discount), id); - return _mapper.Map(entity); + return mapper.Map(entity); } public async Task> GetAsync() { - return _mapper.Map>( - await _db.Discounts + return mapper.Map>( + await db.Discounts .Include(x => x.BarCodeImage) .ToListAsync()); } diff --git a/src/api/EProfspilka.Application/Services/EventService.cs b/src/api/EProfspilka.Application/Services/EventService.cs new file mode 100644 index 0000000..39e1a20 --- /dev/null +++ b/src/api/EProfspilka.Application/Services/EventService.cs @@ -0,0 +1,117 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Enumerations; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using Microsoft.EntityFrameworkCore; + +namespace EProfispilka.Application.Services; + +public class EventService(YeProfspilkaContext dbContext, IMapper mapper) : IEventService +{ + public async Task Create(EventDto eventDto) + { + var newEvent = new Event + { + Id = Guid.NewGuid(), + Date = DateTime.Now, + Title = eventDto.Title, + Status = Status.Draft, + Description = eventDto.Description, + EventImages = new List() + }; + + foreach (var image in eventDto.Images) + { + newEvent.EventImages.Add(new EventImage() + { + Image = new Image(image), + EventId = newEvent.Id + }); + } + + var entry = await dbContext.Events.AddAsync(newEvent); + await dbContext.SaveChangesAsync(); + + eventDto.Id = entry.Entity.Id; + + return eventDto; + } + + public async Task Delete(Guid id) + { + var ev = await dbContext.Events.FirstOrDefaultAsync(x => x.Id == id); + if (ev == null) + { + throw new NotFoundException(nameof(Event), id); + } + + dbContext.Events.Remove(ev); + await dbContext.SaveChangesAsync(); + } + + public async Task Update(EventDto eventDto) + { + var ev = await dbContext.Events + .Include(x => x.EventImages) + .ThenInclude(x => x.Image) + .FirstOrDefaultAsync(x => x.Id == eventDto.Id); + + if (ev == null) + { + throw new NotFoundException(nameof(Event), eventDto.Id); + } + + ev.Date = eventDto.Date ?? DateTime.Now; + ev.Description = eventDto.Description; + ev.Title = eventDto.Title; + ev.ShortDescription = eventDto.ShortDescription; + ev.EventImages.Clear(); + + foreach (var url in eventDto.Images.Distinct()) + { + ev.EventImages.Add(new EventImage() + { + EventId = ev.Id, + Image = new Image(url) + }); + } + + dbContext.Events.Update(ev); + await dbContext.SaveChangesAsync(); + + return mapper.Map(ev); + } + + public async Task> Get() + { + var listEvents = await dbContext.Events + .Include(x => x.EventImages) + .ThenInclude(x => x.Image) + .ToListAsync(); + + return mapper.Map>(listEvents) ?? ArraySegment.Empty; + } + + public async Task Get(Guid id) + { + return mapper.Map(await GetEvent(id)); + } + + private async Task GetEvent(Guid id) + { + var ev = await dbContext.Events + .Include(x => x.EventImages) + .ThenInclude(x => x.Image) + .SingleOrDefaultAsync(x => x.Id == id); + + if (ev == null) + { + throw new NotFoundException(nameof(Event), id); + } + + return ev; + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Services/PartnersService.cs b/src/api/EProfspilka.Application/Services/PartnersService.cs new file mode 100644 index 0000000..f88cbec --- /dev/null +++ b/src/api/EProfspilka.Application/Services/PartnersService.cs @@ -0,0 +1,63 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using Microsoft.EntityFrameworkCore; + +namespace EProfispilka.Application.Services; + +public class PartnersService(YeProfspilkaContext db, IMapper mapper) : IPartnersService +{ + public async Task CreateAsync(PartnerDto partner) + { + var entry = await db.AddAsync(new Partner + { + SubText = partner.SubText, + SubTextLink = partner.SubTextLink, + MainText = partner.MainText, + Image = new Image(partner.Image) + }); + + await db.SaveChangesAsync(); + + return mapper.Map(entry.Entity); + } + + public async Task DeleteAsync(Guid id) + { + var partner = db.Partners.FirstOrDefault(x => x.Id == id); + + if (partner == null) + { + throw new NotFoundException(nameof(Partner), id); + } + + db.Partners.Remove(partner); + await db.SaveChangesAsync(); + } + + public async Task> GetAllAsync() + { + return mapper.Map>( + await db.Partners.Include(x => x.Image).ToListAsync()); + } + + public async Task UpdateAsync(PartnerDto partner) + { + var entity = await db.Partners + .Include(x => x.Image) + .FirstOrDefaultAsync(x => x.Id == partner.Id) ?? throw new NotFoundException(nameof(Partner), partner.Id); + + entity.Image.ImageUrl = partner.Image; + entity.MainText = partner.MainText; + entity.SubText = partner.SubText; + entity.SubTextLink = partner.SubTextLink; + + db.Update(entity); + await db.SaveChangesAsync(); + + return mapper.Map(partner); + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Services/QuestionService.cs b/src/api/EProfspilka.Application/Services/QuestionService.cs new file mode 100644 index 0000000..9bf3b8c --- /dev/null +++ b/src/api/EProfspilka.Application/Services/QuestionService.cs @@ -0,0 +1,61 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using Microsoft.EntityFrameworkCore; + +namespace EProfispilka.Application.Services; + +public class QuestionService(YeProfspilkaContext dbContext, IMapper mapper) : IQuestionService +{ + public async Task> GetAllAsync() + { + return mapper.Map>(await dbContext.Questions.ToListAsync()); + } + + public async Task CreateAsync(QuestionDto questionDto) + { + var entity = await dbContext.Questions.AddAsync(new Question() + { + QuestionText = questionDto.QuestionText, + Answer = questionDto.Answer + }); + + await dbContext.SaveChangesAsync(); + + return mapper.Map(entity.Entity); + } + + public async Task UpdateAsync(QuestionDto questionDto) + { + var entity = await dbContext.Questions.FirstOrDefaultAsync(x => x.Id == questionDto.Id); + + if (entity == null) + { + throw new NotFoundException(nameof(Question), questionDto.Id); + } + + entity.Answer = questionDto.Answer; + entity.QuestionText = questionDto.QuestionText; + + dbContext.Update(entity); + await dbContext.SaveChangesAsync(); + + return mapper.Map(entity); + } + + public async Task DeleteAsync(Guid id) + { + var question = await dbContext.Questions.FirstOrDefaultAsync(x => x.Id == id); + + if (question == null) + { + throw new NotFoundException(nameof(Question), id); + } + + dbContext.Remove(question); + await dbContext.SaveChangesAsync(); + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Services/RoleService.cs b/src/api/EProfspilka.Application/Services/RoleService.cs new file mode 100644 index 0000000..db38d2b --- /dev/null +++ b/src/api/EProfspilka.Application/Services/RoleService.cs @@ -0,0 +1,25 @@ +using EProfspilka.Core.Enumerations; +using EProfspilka.Core.Interfaces; + +namespace EProfispilka.Application.Services; + +public class RoleService : IRoleService +{ + public Role RoleResolver(IEnumerable userRoles) + { + var userRolesEnum = userRoles.Select(x => x.RoleId).ToList(); + + if (userRolesEnum.Contains(Role.Admin)) + return Role.Admin; + + if (userRolesEnum.Contains(Role.Moderator)) + return Role.Moderator; + + if (userRolesEnum.Contains(Role.MemberProfspilka)) + return Role.MemberProfspilka; + + return userRolesEnum.Contains(Role.Student) + ? Role.Student + : Role.NotVerified; + } +} diff --git a/src/api/EProfspilka.Application/Services/SecurityContext.cs b/src/api/EProfspilka.Application/Services/SecurityContext.cs new file mode 100644 index 0000000..d58ffd4 --- /dev/null +++ b/src/api/EProfspilka.Application/Services/SecurityContext.cs @@ -0,0 +1,22 @@ +using EProfspilka.Core.Interfaces; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using System.Security.Claims; + +namespace EProfispilka.Application.Services; + +public class SecurityContext(IHttpContextAccessor httpContextAccessor, ILogger logger) : ISecurityContext +{ + public Guid GetCurrentUserId() + { + var guidClaim = httpContextAccessor.HttpContext?.User.FindFirst(ClaimTypes.Name); + + if (guidClaim == null || !Guid.TryParse(guidClaim.Value, out var result)) + { + logger.LogError("guidClaim for User token not found"); + throw new Exception("User not found"); + } + + return result; + } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/StudentStoreService.cs b/src/api/EProfspilka.Application/Services/StudentStoreService.cs similarity index 78% rename from YeProfspilka.Backend/YeProfspilka.Application/Services/StudentStoreService.cs rename to src/api/EProfspilka.Application/Services/StudentStoreService.cs index 59f2961..82b259d 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/StudentStoreService.cs +++ b/src/api/EProfspilka.Application/Services/StudentStoreService.cs @@ -1,31 +1,22 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using OfficeOpenXml; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -using YeProfspilka.Core.Models; -using YeProfspilka.Db.EF; -using Role = YeProfspilka.Core.Enumerations.Role; +using Role = EProfspilka.Core.Enumerations.Role; -namespace YeProfspilka.Application.Services; +namespace EProfispilka.Application.Services; -public class StudentStoreService : IStudentStoreService +public class StudentStoreService(YeProfspilkaContext dbContext, IRoleService roleService) : IStudentStoreService { - private readonly YeProfspilkaContext _dbContext; - private readonly IRoleService _roleService; - private const string DefaultImage = "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460__340.png"; - public StudentStoreService(YeProfspilkaContext dbContext, IRoleService roleService) - { - _dbContext = dbContext; - _roleService = roleService; - } - public async Task IsStudent(string email) { - return await _dbContext.StudentsStore.AnyAsync(x => x.Email == email); + return await dbContext.StudentsStore.AnyAsync(x => x.Email == email); } public async Task UploadUsers(string filePath, bool isOverrideMethod) @@ -52,7 +43,7 @@ public async Task UploadUsers(string filePath, bool isOverrid } } var (newUsers, updatedUsers) = await MappingUsers(students, isOverrideMethod); - await _dbContext.SaveChangesAsync(); + await dbContext.SaveChangesAsync(); return new UploadResultModel(true, students.Count, "Дані завантажено успішно", newUsers, updatedUsers); } @@ -64,7 +55,7 @@ public async Task UploadUsers(string filePath, bool isOverrid public async Task MappingUser(User user) { - var stud = await _dbContext.StudentsStore.FirstOrDefaultAsync(x => x.Email == user.Email) + var stud = await dbContext.StudentsStore.FirstOrDefaultAsync(x => x.Email == user.Email) ?? throw new NotFoundException(nameof(User), user.Email); stud.FullName = user.FullName; @@ -84,9 +75,9 @@ public async Task MappingUser(User user) public async Task> GetAllUsers() { - var storeUsers = await _dbContext.StudentsStore.ToListAsync(); + var storeUsers = await dbContext.StudentsStore.ToListAsync(); - var activeUsers = await _dbContext.Users + var activeUsers = await dbContext.Users .Include(x => x.Image) .Include(x => x.UserRoles) .ThenInclude(x => x.Role) @@ -108,7 +99,7 @@ public async Task> GetAllUsers() Course = matchingUser.Course ?? 1, Facultet = matchingUser.Facultet ?? "", Email = matchingUser.Email, - Role = _roleService.RoleResolver(matchingUser.UserRoles) + Role = roleService.RoleResolver(matchingUser.UserRoles) }); } else @@ -132,7 +123,7 @@ public async Task> GetAllUsers() IEnumerable incomingStudents, bool isOverrideMethod) { - var dbUsers = await _dbContext.StudentsStore.ToListAsync(); + var dbUsers = await dbContext.StudentsStore.ToListAsync(); var newUsers = 0; var updatedUsers = 0; @@ -148,17 +139,17 @@ public async Task> GetAllUsers() existingUser.Facultet = incomingStudent.Facultet; existingUser.FullName = incomingStudent.FullName; existingUser.IsMemberProf = incomingStudent.IsMemberProf; - _dbContext.StudentsStore.Update(existingUser); + dbContext.StudentsStore.Update(existingUser); updatedUsers++; } else { - await _dbContext.StudentsStore.AddAsync(incomingStudent); + await dbContext.StudentsStore.AddAsync(incomingStudent); newUsers++; } } - await _dbContext.SaveChangesAsync(); + await dbContext.SaveChangesAsync(); return (newUsers, updatedUsers); } @@ -170,11 +161,11 @@ public async Task> GetAllUsers() continue; } - await _dbContext.StudentsStore.AddAsync(incomingStudent); + await dbContext.StudentsStore.AddAsync(incomingStudent); newUsers++; } - await _dbContext.SaveChangesAsync(); + await dbContext.SaveChangesAsync(); return (newUsers, updatedUsers); } diff --git a/YeProfspilka.Backend/YeProfspilka.Application/Services/StudentsReader.cs b/src/api/EProfspilka.Application/Services/StudentsReader.cs similarity index 74% rename from YeProfspilka.Backend/YeProfspilka.Application/Services/StudentsReader.cs rename to src/api/EProfspilka.Application/Services/StudentsReader.cs index 310187e..6fe9b89 100644 --- a/YeProfspilka.Backend/YeProfspilka.Application/Services/StudentsReader.cs +++ b/src/api/EProfspilka.Application/Services/StudentsReader.cs @@ -1,20 +1,13 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; using Microsoft.Extensions.Logging; using OfficeOpenXml; -using YeProfspilka.Core.Entities; -using YeProfspilka.Core.Exceptions; -using YeProfspilka.Core.Interfaces; -namespace YeProfspilka.Application.Services; +namespace EProfispilka.Application.Services; -public class StudentsReader : IStudentsReader +public class StudentsReader(ILogger logger) : IStudentsReader { - private readonly ILogger _logger; - - public StudentsReader(ILogger logger) - { - _logger = logger; - } - public List Read(string filePath) { if (string.IsNullOrEmpty(filePath)) @@ -31,7 +24,7 @@ public List Read(string filePath) using var package = new ExcelPackage(fileInfo); var worksheet = package.Workbook.Worksheets[0]; - _logger.LogInformation("File with path {FilePath} contain {CellsCount} cells count", filePath, + logger.LogInformation("File with path {FilePath} contain {CellsCount} cells count", filePath, worksheet.Cells.Count() - 1); for (var row = 2; row <= worksheet.Dimension.End.Row; row++) @@ -47,12 +40,12 @@ public List Read(string filePath) IsMemberProf = BoolFileParser(worksheet.Cells[row, 5].Value.ToString() ?? "Ні"), }); } - _logger.LogInformation("Read {Count} students in file", students.Count); + logger.LogInformation("Read {Count} students in file", students.Count); return students; } catch (Exception e) { - _logger.LogError(e, "Error when Reading file"); + logger.LogError(e, "Error when Reading file"); throw new StudentsReadingException("Error when Reading file"); } } diff --git a/src/api/EProfspilka.Application/Services/TokenService.cs b/src/api/EProfspilka.Application/Services/TokenService.cs new file mode 100644 index 0000000..13a155c --- /dev/null +++ b/src/api/EProfspilka.Application/Services/TokenService.cs @@ -0,0 +1,52 @@ +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; +using System.Security.Cryptography; +using System.Text; +using EProfispilka.Application.Configurations; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Interfaces; +using Microsoft.IdentityModel.Tokens; + +namespace EProfispilka.Application.Services; + +public class TokenService(JwtConfiguration jwtConfiguration) : ITokenService +{ + public string GenerateAccessToken(User user) + { + var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtConfiguration.Key)); + var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256); + var claims = GetClaims(user); + var token = new JwtSecurityToken( + jwtConfiguration.Issuer, + jwtConfiguration.Audience, + claims, + expires: DateTime.Now.AddHours(6), + signingCredentials: credentials); + + return new JwtSecurityTokenHandler().WriteToken(token); + } + + public UserToken GenerateRefreshToken() + { + var randomNumber = new byte[32]; + using var rng = RandomNumberGenerator.Create(); + rng.GetBytes(randomNumber); + + return new UserToken + { + Token = Convert.ToBase64String(randomNumber), + Expires = DateTime.Now.AddDays(7), + Created = DateTime.Now, + }; + } + + private static IEnumerable GetClaims(User user) + { + var claims = new List(); + + claims.Add(new Claim(ClaimTypes.Name, $"{user.Id}")); + claims.AddRange(user.UserRoles.Select(ur => new Claim(ClaimTypes.Role, ur.RoleId.ToString()))); + + return claims; + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Application/Services/UserService.cs b/src/api/EProfspilka.Application/Services/UserService.cs new file mode 100644 index 0000000..2e33982 --- /dev/null +++ b/src/api/EProfspilka.Application/Services/UserService.cs @@ -0,0 +1,115 @@ +using AutoMapper; +using EProfspilka.Core.Entities; +using EProfspilka.Core.Exceptions; +using EProfspilka.Core.Interfaces; +using EProfspilka.Core.Models; +using EProfspilka.Db.EF; +using Microsoft.EntityFrameworkCore; +using Role = EProfspilka.Core.Enumerations.Role; + +namespace EProfispilka.Application.Services; + +public class UserService(YeProfspilkaContext dbContext, ISecurityContext securityContext, IMapper mapper) : IUserServices +{ + public async Task GetCurrentUser() + { + var userId = securityContext.GetCurrentUserId(); + + var user = await dbContext.Users + .Include(x => x.Image) + .Include(x => x.UserRoles) + .ThenInclude(x => x.Role) + .SingleOrDefaultAsync(x => x.Id == userId); + + return mapper.Map(user); + } + + public async Task> GetUsers() + { + var users = await dbContext.Users + .Include(x => x.UserRoles) + .Include(x => x.Image) + .ToListAsync(); + + return mapper.Map>(users); + } + + public async Task UserIsExist(string email) + { + return await dbContext.Users.AnyAsync(x => x.Email == email); + } + + public async Task UpdateUser(Guid id, string facultet, int course, Role role) + { + var user = await dbContext.Users + .Include(x => x.UserRoles) + .ThenInclude(x => x.Role) + .FirstOrDefaultAsync(x => x.Id == id) + ?? throw new NotFoundException(nameof(User), id); + + user.Facultet = facultet; + user.Course = course; + + var student = await dbContext.StudentsStore.SingleAsync(x => x.Email == user.Email); + + student.Course = course; + student.Facultet = facultet; + + + if (user.UserRoles.Select(x => x.RoleId).Contains(role)) + { + var roles = user.UserRoles.Select(x => x.RoleId).ToList(); + // Sort list by value of enum + roles.Sort(); + var maxRole = roles.Max(); + + if (role < maxRole) + { + for (var i = roles.IndexOf(maxRole); i < roles.Count; i++) + { + user.UserRoles.Remove(user.UserRoles.Single(x => x.RoleId == roles[i])); + } + } + + await dbContext.SaveChangesAsync(); + return mapper.Map(user); + } + + + + if (role == Role.NotVerified) + { + user.UserRoles.Clear(); + user.UserRoles.Add(new UserRole + { + RoleId = Role.NotVerified + }); + + dbContext.Users.Update(user); + dbContext.StudentsStore.Update(student); + + await dbContext.SaveChangesAsync(); + + return mapper.Map(user); + } + + if (user.UserRoles.Select(x => x.RoleId).Contains(Role.NotVerified)) + { + var notVerified = + await dbContext.UserRoles.FirstAsync(x => x.UserId == user.Id && x.RoleId == Role.NotVerified); + user.UserRoles.Remove(notVerified); + } + + user.UserRoles.Add(new UserRole + { + RoleId = role + }); + + dbContext.Users.Update(user); + dbContext.StudentsStore.Update(student); + + await dbContext.SaveChangesAsync(); + + return mapper.Map(user); + } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/YeProfspilka.Core.csproj b/src/api/EProfspilka.Core/EProfspilka.Core.csproj similarity index 64% rename from YeProfspilka.Backend/YeProfspilka.Core/YeProfspilka.Core.csproj rename to src/api/EProfspilka.Core/EProfspilka.Core.csproj index 4c60dde..57e4cc0 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/YeProfspilka.Core.csproj +++ b/src/api/EProfspilka.Core/EProfspilka.Core.csproj @@ -1,13 +1,13 @@ - net6.0 + net8.0 enable enable - + diff --git a/src/api/EProfspilka.Core/Entities/Advantage.cs b/src/api/EProfspilka.Core/Entities/Advantage.cs new file mode 100644 index 0000000..e8520c7 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Advantage.cs @@ -0,0 +1,10 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class Advantage : BaseEntity +{ + public string MainText { get; set; } + + public string SubText { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/Base/BaseEntity.cs b/src/api/EProfspilka.Core/Entities/Base/BaseEntity.cs new file mode 100644 index 0000000..5ee4c37 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Base/BaseEntity.cs @@ -0,0 +1,6 @@ +namespace EProfspilka.Core.Entities.Base; + +public abstract class BaseEntity +{ + public Guid Id { get; set; } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Discount.cs b/src/api/EProfspilka.Core/Entities/Discount.cs similarity index 72% rename from YeProfspilka.Backend/YeProfspilka.Core/Entities/Discount.cs rename to src/api/EProfspilka.Core/Entities/Discount.cs index f0fa0ec..9b98569 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/Discount.cs +++ b/src/api/EProfspilka.Core/Entities/Discount.cs @@ -1,7 +1,7 @@ -using YeProfspilka.Core.Entities.Base; -using YeProfspilka.Core.Enumerations; +using EProfspilka.Core.Entities.Base; +using EProfspilka.Core.Enumerations; -namespace YeProfspilka.Core.Entities; +namespace EProfspilka.Core.Entities; public class Discount : BaseEntity { diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/DiscountCode.cs b/src/api/EProfspilka.Core/Entities/DiscountCode.cs similarity index 83% rename from YeProfspilka.Backend/YeProfspilka.Core/Entities/DiscountCode.cs rename to src/api/EProfspilka.Core/Entities/DiscountCode.cs index 31d65d0..30dd5a4 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/DiscountCode.cs +++ b/src/api/EProfspilka.Core/Entities/DiscountCode.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Entities.Base; +using EProfspilka.Core.Entities.Base; -namespace YeProfspilka.Core.Entities; +namespace EProfspilka.Core.Entities; public class DiscountCode : BaseEntity { diff --git a/src/api/EProfspilka.Core/Entities/Event.cs b/src/api/EProfspilka.Core/Entities/Event.cs new file mode 100644 index 0000000..b6dd867 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Event.cs @@ -0,0 +1,19 @@ +using EProfspilka.Core.Entities.Base; +using EProfspilka.Core.Enumerations; + +namespace EProfspilka.Core.Entities; + +public class Event : BaseEntity +{ + public string Title { get; set; } + + public DateTime Date { get; set; } + + public Status Status { get; set; } + + public ICollection EventImages { get; set; } + + public string Description { get; set; } + + public string ShortDescription { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/EventImage.cs b/src/api/EProfspilka.Core/Entities/EventImage.cs new file mode 100644 index 0000000..ce16858 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/EventImage.cs @@ -0,0 +1,14 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class EventImage : BaseEntity +{ + public Guid EventId { get; set; } + + public Event Event { get; set; } + + public Guid ImageId { get; set; } + + public Image Image { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/Image.cs b/src/api/EProfspilka.Core/Entities/Image.cs new file mode 100644 index 0000000..bd0ffb6 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Image.cs @@ -0,0 +1,15 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class Image : BaseEntity +{ + public string? ImageUrl { get; set; } + + public Image() { } + + public Image(string imageUrl) + { + ImageUrl = imageUrl; + } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/Mark.cs b/src/api/EProfspilka.Core/Entities/Mark.cs new file mode 100644 index 0000000..30b6568 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Mark.cs @@ -0,0 +1,12 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class Mark : BaseEntity +{ + public string Name { get; set; } + + public string Text { get; set; } + + public string SubText { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/Partner.cs b/src/api/EProfspilka.Core/Entities/Partner.cs new file mode 100644 index 0000000..481766e --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Partner.cs @@ -0,0 +1,14 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class Partner : BaseEntity +{ + public string MainText { get; set; } + + public string SubText { get; set; } + + public string SubTextLink { get; set; } + + public Image Image { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/Question.cs b/src/api/EProfspilka.Core/Entities/Question.cs new file mode 100644 index 0000000..fd26a5a --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Question.cs @@ -0,0 +1,10 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class Question : BaseEntity +{ + public string QuestionText { get; set; } + + public string Answer { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/Role.cs b/src/api/EProfspilka.Core/Entities/Role.cs new file mode 100644 index 0000000..6b77ab3 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/Role.cs @@ -0,0 +1,10 @@ +namespace EProfspilka.Core.Entities; + +public class Role +{ + public Enumerations.Role Id { get; set; } + + public string Name { get; set; } + + public ICollection UserRoles { get; set; } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Entities/SiteSettings.cs b/src/api/EProfspilka.Core/Entities/SiteSettings.cs similarity index 54% rename from YeProfspilka.Backend/YeProfspilka.Core/Entities/SiteSettings.cs rename to src/api/EProfspilka.Core/Entities/SiteSettings.cs index 221dce2..151c325 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Entities/SiteSettings.cs +++ b/src/api/EProfspilka.Core/Entities/SiteSettings.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Entities.Base; +using EProfspilka.Core.Entities.Base; -namespace YeProfspilka.Core.Entities; +namespace EProfspilka.Core.Entities; public class SiteSettings : BaseEntity { diff --git a/src/api/EProfspilka.Core/Entities/StudentStore.cs b/src/api/EProfspilka.Core/Entities/StudentStore.cs new file mode 100644 index 0000000..70b90cc --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/StudentStore.cs @@ -0,0 +1,16 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class StudentStore : BaseEntity +{ + public string FullName { get; set; } + + public string Email { get; set; } + + public string Facultet { get; set; } + + public int Course { get; set; } + + public bool IsMemberProf { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/User.cs b/src/api/EProfspilka.Core/Entities/User.cs new file mode 100644 index 0000000..299b8eb --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/User.cs @@ -0,0 +1,20 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class User : BaseEntity +{ + public string Email { get; set; } + + public string FullName { get; set; } + + public Image Image { get; set; } + + public string? Facultet { get; set; } + + public int? Course { get; set; } + + public ICollection UserRoles { get; set; } + + public ICollection UserTokens { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/UserRole.cs b/src/api/EProfspilka.Core/Entities/UserRole.cs new file mode 100644 index 0000000..01b0978 --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/UserRole.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace EProfspilka.Core.Entities; + +public class UserRole +{ + [Key] + public Enumerations.Role RoleId { get; set; } + + public Guid UserId { get; set; } + + public virtual User User { get; set; } + + public virtual Role Role { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Entities/UserTokens.cs b/src/api/EProfspilka.Core/Entities/UserTokens.cs new file mode 100644 index 0000000..da533ae --- /dev/null +++ b/src/api/EProfspilka.Core/Entities/UserTokens.cs @@ -0,0 +1,20 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Entities; + +public class UserToken : BaseEntity +{ + public Guid UserId { get; set; } + + public User User { get; set; } + + public string Token { get; set; } + + public DateTime Expires { get; set; } + + public DateTime Created { get; set; } + + public DateTime? Revoked { get; set; } + + public string ReplacedByToken { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/DiscountType.cs b/src/api/EProfspilka.Core/Enumerations/DiscountType.cs similarity index 80% rename from YeProfspilka.Backend/YeProfspilka.Core/Enumerations/DiscountType.cs rename to src/api/EProfspilka.Core/Enumerations/DiscountType.cs index 4fc8695..335eef6 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/DiscountType.cs +++ b/src/api/EProfspilka.Core/Enumerations/DiscountType.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Core.Enumerations; +namespace EProfspilka.Core.Enumerations; public enum DiscountType { diff --git a/src/api/EProfspilka.Core/Enumerations/Role.cs b/src/api/EProfspilka.Core/Enumerations/Role.cs new file mode 100644 index 0000000..1b75e04 --- /dev/null +++ b/src/api/EProfspilka.Core/Enumerations/Role.cs @@ -0,0 +1,12 @@ +namespace EProfspilka.Core.Enumerations; + +public enum Role +{ + NotVerified = 0, + Student = 1, + MemberProfspilka = 2, + Moderator = 3, + // Head of unit. This persistent add Admin + HeadOfUnit = 4, + Admin = 5, +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/Status.cs b/src/api/EProfspilka.Core/Enumerations/Status.cs similarity index 57% rename from YeProfspilka.Backend/YeProfspilka.Core/Enumerations/Status.cs rename to src/api/EProfspilka.Core/Enumerations/Status.cs index 7500d34..7137d45 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Enumerations/Status.cs +++ b/src/api/EProfspilka.Core/Enumerations/Status.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Core.Enumerations; +namespace EProfspilka.Core.Enumerations; public enum Status { diff --git a/src/api/EProfspilka.Core/Exceptions/AuthenticateException.cs b/src/api/EProfspilka.Core/Exceptions/AuthenticateException.cs new file mode 100644 index 0000000..e59220b --- /dev/null +++ b/src/api/EProfspilka.Core/Exceptions/AuthenticateException.cs @@ -0,0 +1,5 @@ +namespace EProfspilka.Core.Exceptions; + +public class AuthenticateException(string message) : Exception(message) +{ +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Exceptions/NotFoundException.cs b/src/api/EProfspilka.Core/Exceptions/NotFoundException.cs new file mode 100644 index 0000000..31191fd --- /dev/null +++ b/src/api/EProfspilka.Core/Exceptions/NotFoundException.cs @@ -0,0 +1,5 @@ +namespace EProfspilka.Core.Exceptions; + +public class NotFoundException(string name, object key) : Exception($"Entity \"{name}\" ({key}) not found.") +{ +} diff --git a/src/api/EProfspilka.Core/Exceptions/RefreshTokenException.cs b/src/api/EProfspilka.Core/Exceptions/RefreshTokenException.cs new file mode 100644 index 0000000..e90af60 --- /dev/null +++ b/src/api/EProfspilka.Core/Exceptions/RefreshTokenException.cs @@ -0,0 +1,5 @@ +namespace EProfspilka.Core.Exceptions; + +public class RefreshTokenException(string message) : Exception(message) +{ +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Exceptions/StudentsReadingException.cs b/src/api/EProfspilka.Core/Exceptions/StudentsReadingException.cs new file mode 100644 index 0000000..aa6d0db --- /dev/null +++ b/src/api/EProfspilka.Core/Exceptions/StudentsReadingException.cs @@ -0,0 +1,5 @@ +namespace EProfspilka.Core.Exceptions; + +public class StudentsReadingException(string message) : Exception(message) +{ +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IAdvantageService.cs b/src/api/EProfspilka.Core/Interfaces/IAdvantageService.cs similarity index 78% rename from YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IAdvantageService.cs rename to src/api/EProfspilka.Core/Interfaces/IAdvantageService.cs index 441f0e0..0b7e9ad 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IAdvantageService.cs +++ b/src/api/EProfspilka.Core/Interfaces/IAdvantageService.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Models; +using EProfspilka.Core.Models; -namespace YeProfspilka.Core.Interfaces; +namespace EProfspilka.Core.Interfaces; public interface IAdvantageService { diff --git a/src/api/EProfspilka.Core/Interfaces/IAuthenticationService.cs b/src/api/EProfspilka.Core/Interfaces/IAuthenticationService.cs new file mode 100644 index 0000000..08d8a41 --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/IAuthenticationService.cs @@ -0,0 +1,12 @@ +using EProfspilka.Core.Models; + +namespace EProfspilka.Core.Interfaces; + +public interface IAuthenticationService +{ + Task Authenticate(string email); + + Task Authenticate(string email, string password); + + Task Registration(string email, string fullName, string image); +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Interfaces/ICrudService.cs b/src/api/EProfspilka.Core/Interfaces/ICrudService.cs new file mode 100644 index 0000000..0ef7e51 --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/ICrudService.cs @@ -0,0 +1,16 @@ +using EProfspilka.Core.Entities.Base; + +namespace EProfspilka.Core.Interfaces; + +public interface ICrudService where T : BaseEntity +{ + Task Create(T entity); + + void Update(T entity); + + Task Delete(Guid id); + + Task GetById(Guid id); + + Task> Get(); +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IDiscountService.cs b/src/api/EProfspilka.Core/Interfaces/IDiscountService.cs similarity index 79% rename from YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IDiscountService.cs rename to src/api/EProfspilka.Core/Interfaces/IDiscountService.cs index e48f624..ebae129 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IDiscountService.cs +++ b/src/api/EProfspilka.Core/Interfaces/IDiscountService.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Models; +using EProfspilka.Core.Models; -namespace YeProfspilka.Core.Interfaces; +namespace EProfspilka.Core.Interfaces; public interface IDiscountService { diff --git a/src/api/EProfspilka.Core/Interfaces/IEventService.cs b/src/api/EProfspilka.Core/Interfaces/IEventService.cs new file mode 100644 index 0000000..42ea67d --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/IEventService.cs @@ -0,0 +1,16 @@ +using EProfspilka.Core.Models; + +namespace EProfspilka.Core.Interfaces; + +public interface IEventService +{ + Task Create(EventDto eventDto); + + Task Delete(Guid id); + + Task Update(EventDto eventDto); + + Task> Get(); + + Task Get(Guid id); +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IImportCommand.cs b/src/api/EProfspilka.Core/Interfaces/IImportCommand.cs similarity index 63% rename from YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IImportCommand.cs rename to src/api/EProfspilka.Core/Interfaces/IImportCommand.cs index 0255613..d4ddbea 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IImportCommand.cs +++ b/src/api/EProfspilka.Core/Interfaces/IImportCommand.cs @@ -1,7 +1,7 @@ +using EProfspilka.Core.Models; using MediatR; -using YeProfspilka.Core.Models; -namespace YeProfspilka.Core.Interfaces; +namespace EProfspilka.Core.Interfaces; public interface IImportCommand : IRequest { diff --git a/src/api/EProfspilka.Core/Interfaces/IPartnersService.cs b/src/api/EProfspilka.Core/Interfaces/IPartnersService.cs new file mode 100644 index 0000000..19c52e7 --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/IPartnersService.cs @@ -0,0 +1,14 @@ +using EProfspilka.Core.Models; + +namespace EProfspilka.Core.Interfaces; + +public interface IPartnersService +{ + Task> GetAllAsync(); + + Task UpdateAsync(PartnerDto partner); + + Task CreateAsync(PartnerDto partner); + + Task DeleteAsync(Guid id); +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Interfaces/IQuestionService.cs b/src/api/EProfspilka.Core/Interfaces/IQuestionService.cs new file mode 100644 index 0000000..cb97689 --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/IQuestionService.cs @@ -0,0 +1,14 @@ +using EProfspilka.Core.Models; + +namespace EProfspilka.Core.Interfaces; + +public interface IQuestionService +{ + Task> GetAllAsync(); + + Task CreateAsync(QuestionDto questionDto); + + Task UpdateAsync(QuestionDto questionDto); + + Task DeleteAsync(Guid id); +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IRoleService.cs b/src/api/EProfspilka.Core/Interfaces/IRoleService.cs similarity index 57% rename from YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IRoleService.cs rename to src/api/EProfspilka.Core/Interfaces/IRoleService.cs index fd2ad1c..b14c3c7 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IRoleService.cs +++ b/src/api/EProfspilka.Core/Interfaces/IRoleService.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Entities; +using EProfspilka.Core.Entities; -namespace YeProfspilka.Core.Interfaces; +namespace EProfspilka.Core.Interfaces; public interface IRoleService { diff --git a/src/api/EProfspilka.Core/Interfaces/ISecurityContext.cs b/src/api/EProfspilka.Core/Interfaces/ISecurityContext.cs new file mode 100644 index 0000000..a7803bf --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/ISecurityContext.cs @@ -0,0 +1,6 @@ +namespace EProfspilka.Core.Interfaces; + +public interface ISecurityContext +{ + Guid GetCurrentUserId(); +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Interfaces/IStudentStoreService.cs b/src/api/EProfspilka.Core/Interfaces/IStudentStoreService.cs new file mode 100644 index 0000000..c06ded2 --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/IStudentStoreService.cs @@ -0,0 +1,15 @@ +using EProfspilka.Core.Entities; +using EProfspilka.Core.Models; + +namespace EProfspilka.Core.Interfaces; + +public interface IStudentStoreService +{ + Task IsStudent(string email); + + Task UploadUsers(string filePath, bool IsOverrideMethod); + + Task MappingUser(User user); + + Task> GetAllUsers(); +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IStudentsReader.cs b/src/api/EProfspilka.Core/Interfaces/IStudentsReader.cs similarity index 53% rename from YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IStudentsReader.cs rename to src/api/EProfspilka.Core/Interfaces/IStudentsReader.cs index e757f38..07d2a41 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/IStudentsReader.cs +++ b/src/api/EProfspilka.Core/Interfaces/IStudentsReader.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Entities; +using EProfspilka.Core.Entities; -namespace YeProfspilka.Core.Interfaces; +namespace EProfspilka.Core.Interfaces; public interface IStudentsReader { diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ITokenService.cs b/src/api/EProfspilka.Core/Interfaces/ITokenService.cs similarity index 61% rename from YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ITokenService.cs rename to src/api/EProfspilka.Core/Interfaces/ITokenService.cs index 9b017c7..3f1d420 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Interfaces/ITokenService.cs +++ b/src/api/EProfspilka.Core/Interfaces/ITokenService.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Entities; +using EProfspilka.Core.Entities; -namespace YeProfspilka.Core.Interfaces; +namespace EProfspilka.Core.Interfaces; public interface ITokenService { diff --git a/src/api/EProfspilka.Core/Interfaces/IUserService.cs b/src/api/EProfspilka.Core/Interfaces/IUserService.cs new file mode 100644 index 0000000..07ffc01 --- /dev/null +++ b/src/api/EProfspilka.Core/Interfaces/IUserService.cs @@ -0,0 +1,15 @@ +using EProfspilka.Core.Enumerations; +using EProfspilka.Core.Models; + +namespace EProfspilka.Core.Interfaces; + +public interface IUserServices +{ + Task GetCurrentUser(); + + Task> GetUsers(); + + Task UserIsExist(string email); + + Task UpdateUser(Guid id, string facultet, int course, Role role); +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/AdvantageDto.cs b/src/api/EProfspilka.Core/Models/AdvantageDto.cs similarity index 80% rename from YeProfspilka.Backend/YeProfspilka.Core/Models/AdvantageDto.cs rename to src/api/EProfspilka.Core/Models/AdvantageDto.cs index 3d6d103..0ee1403 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/AdvantageDto.cs +++ b/src/api/EProfspilka.Core/Models/AdvantageDto.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Core.Models; +namespace EProfspilka.Core.Models; public class AdvantageDto { diff --git a/src/api/EProfspilka.Core/Models/AuthenticateResponseModel.cs b/src/api/EProfspilka.Core/Models/AuthenticateResponseModel.cs new file mode 100644 index 0000000..1a5a6d1 --- /dev/null +++ b/src/api/EProfspilka.Core/Models/AuthenticateResponseModel.cs @@ -0,0 +1,8 @@ +namespace EProfspilka.Core.Models; + +public class AuthenticateResponseModel(string jwtToken, string refreshToken) +{ + public string JwtToken { get; set; } = jwtToken; + + public string RefreshToken { get; set; } = refreshToken; +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/DiscountCodeDto.cs b/src/api/EProfspilka.Core/Models/DiscountCodeDto.cs similarity index 89% rename from YeProfspilka.Backend/YeProfspilka.Core/Models/DiscountCodeDto.cs rename to src/api/EProfspilka.Core/Models/DiscountCodeDto.cs index 85fb297..a59cc8c 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/DiscountCodeDto.cs +++ b/src/api/EProfspilka.Core/Models/DiscountCodeDto.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Core.Models; +namespace EProfspilka.Core.Models; public class DiscountCodeDto { diff --git a/src/api/EProfspilka.Core/Models/DiscountDto.cs b/src/api/EProfspilka.Core/Models/DiscountDto.cs new file mode 100644 index 0000000..1609c90 --- /dev/null +++ b/src/api/EProfspilka.Core/Models/DiscountDto.cs @@ -0,0 +1,20 @@ +using EProfspilka.Core.Enumerations; + +namespace EProfspilka.Core.Models; + +public class DiscountDto +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + public bool? WithBarCode { get; set; } + + public bool? WithQrCode { get; set; } + + public string? BarCodeImage { get; set; } + + public string? Description { get; set; } + + public DiscountType DiscountType { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Models/ErrorResponseModel.cs b/src/api/EProfspilka.Core/Models/ErrorResponseModel.cs new file mode 100644 index 0000000..f3a6a67 --- /dev/null +++ b/src/api/EProfspilka.Core/Models/ErrorResponseModel.cs @@ -0,0 +1,6 @@ +namespace EProfspilka.Core.Models; + +public class ErrorResponseModel(string message) +{ + public string Message { get; set; } = message; +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Models/EventDto.cs b/src/api/EProfspilka.Core/Models/EventDto.cs new file mode 100644 index 0000000..d883e0c --- /dev/null +++ b/src/api/EProfspilka.Core/Models/EventDto.cs @@ -0,0 +1,22 @@ +using EProfspilka.Core.Enumerations; + +namespace EProfspilka.Core.Models; + +public class EventDto +{ + public Guid Id { get; set; } + + public string Title { get; set; } + + public string Description { get; set; } + + public DateTime? Date { get; set; } + + public Status Status { get; set; } + + public bool IsPassed { get; set; } + + public string ShortDescription { get; set; } + + public IEnumerable Images { get; set; } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/PartnerDto.cs b/src/api/EProfspilka.Core/Models/PartnerDto.cs similarity index 86% rename from YeProfspilka.Backend/YeProfspilka.Core/Models/PartnerDto.cs rename to src/api/EProfspilka.Core/Models/PartnerDto.cs index 2e81216..f99d9af 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/PartnerDto.cs +++ b/src/api/EProfspilka.Core/Models/PartnerDto.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Core.Models; +namespace EProfspilka.Core.Models; public class PartnerDto { diff --git a/src/api/EProfspilka.Core/Models/QuestionDto.cs b/src/api/EProfspilka.Core/Models/QuestionDto.cs new file mode 100644 index 0000000..3fa7cfb --- /dev/null +++ b/src/api/EProfspilka.Core/Models/QuestionDto.cs @@ -0,0 +1,10 @@ +namespace EProfspilka.Core.Models; + +public class QuestionDto +{ + public Guid Id { get; set; } + + public string QuestionText { get; set; } + + public string Answer { get; set; } +} \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Models/SiteSettingsDto.cs b/src/api/EProfspilka.Core/Models/SiteSettingsDto.cs new file mode 100644 index 0000000..937ad4a --- /dev/null +++ b/src/api/EProfspilka.Core/Models/SiteSettingsDto.cs @@ -0,0 +1,6 @@ +namespace EProfspilka.Core.Models; + +public class SiteSettingsDto +{ + +} diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/UploadResultModel.cs b/src/api/EProfspilka.Core/Models/UploadResultModel.cs similarity index 76% rename from YeProfspilka.Backend/YeProfspilka.Core/Models/UploadResultModel.cs rename to src/api/EProfspilka.Core/Models/UploadResultModel.cs index cd57266..65f9801 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/UploadResultModel.cs +++ b/src/api/EProfspilka.Core/Models/UploadResultModel.cs @@ -1,3 +1,3 @@ -namespace YeProfspilka.Core.Models; +namespace EProfspilka.Core.Models; public record UploadResultModel(bool IsSuccess, int Count, string Message, int NewUsers = 0, int UpdatedUsers = 0); \ No newline at end of file diff --git a/src/api/EProfspilka.Core/Models/UserDto.cs b/src/api/EProfspilka.Core/Models/UserDto.cs new file mode 100644 index 0000000..75f1a86 --- /dev/null +++ b/src/api/EProfspilka.Core/Models/UserDto.cs @@ -0,0 +1,24 @@ +using EProfspilka.Core.Enumerations; + +namespace EProfspilka.Core.Models; + +public class UserDto +{ + public Guid Id { get; set; } + + public string FullName { get; set; } + + public string Email { get; set; } + + public string Status { get; set; } + + public string Avatar { get; set; } + + public string Facultet { get; set; } + + public int Course { get; set; } + + public Role Role { get; set; } + + public IEnumerable Discounts { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/UserMatchingStoreModel.cs b/src/api/EProfspilka.Core/Models/UserMatchingStoreModel.cs similarity index 82% rename from YeProfspilka.Backend/YeProfspilka.Core/Models/UserMatchingStoreModel.cs rename to src/api/EProfspilka.Core/Models/UserMatchingStoreModel.cs index a0dac24..25c08a7 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/UserMatchingStoreModel.cs +++ b/src/api/EProfspilka.Core/Models/UserMatchingStoreModel.cs @@ -1,6 +1,6 @@ -using YeProfspilka.Core.Enumerations; +using EProfspilka.Core.Enumerations; -namespace YeProfspilka.Core.Models; +namespace EProfspilka.Core.Models; public class UserMatchingStoreModel { diff --git a/YeProfspilka.Backend/YeProfspilka.Core/Models/VerifyDiscountResult.cs b/src/api/EProfspilka.Core/Models/VerifyDiscountResult.cs similarity index 87% rename from YeProfspilka.Backend/YeProfspilka.Core/Models/VerifyDiscountResult.cs rename to src/api/EProfspilka.Core/Models/VerifyDiscountResult.cs index 2b18458..3818898 100644 --- a/YeProfspilka.Backend/YeProfspilka.Core/Models/VerifyDiscountResult.cs +++ b/src/api/EProfspilka.Core/Models/VerifyDiscountResult.cs @@ -1,4 +1,4 @@ -namespace YeProfspilka.Core.Models; +namespace EProfspilka.Core.Models; public class VerifyDiscountResult { diff --git a/src/api/EProfspilka.Db/Configurations/RoleConfiguration.cs b/src/api/EProfspilka.Db/Configurations/RoleConfiguration.cs new file mode 100644 index 0000000..131f11e --- /dev/null +++ b/src/api/EProfspilka.Db/Configurations/RoleConfiguration.cs @@ -0,0 +1,21 @@ +using EProfspilka.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace EProfspilka.Db.Configurations; + +public class RoleConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasData( + [ + new() { Id = Core.Enumerations.Role.Student, Name = "Student" }, + new() { Id = Core.Enumerations.Role.Admin, Name = "Admin" }, + new() { Id = Core.Enumerations.Role.Moderator, Name = "Moderator" }, + new() { Id = Core.Enumerations.Role.NotVerified, Name = "NotVerified" }, + new() { Id = Core.Enumerations.Role.MemberProfspilka, Name = "MemberProfspilka" }, + new() { Id = Core.Enumerations.Role.HeadOfUnit, Name = "HeadOfUnit" }, + ]); + } +} diff --git a/src/api/EProfspilka.Db/Configurations/UserRoleConfiguration.cs b/src/api/EProfspilka.Db/Configurations/UserRoleConfiguration.cs new file mode 100644 index 0000000..3a56b62 --- /dev/null +++ b/src/api/EProfspilka.Db/Configurations/UserRoleConfiguration.cs @@ -0,0 +1,15 @@ +using EProfspilka.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace EProfspilka.Db.Configurations; + +public class UserRoleConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(a => new { a.UserId, a.RoleId }); + builder.HasOne(a => a.User).WithMany(a => a.UserRoles).HasForeignKey(a => a.UserId); + builder.HasOne(a => a.Role).WithMany(r => r.UserRoles).HasForeignKey(a => a.RoleId); + } +} \ No newline at end of file diff --git a/YeProfspilka.Backend/YeProfspilka.Db/DbInitialize/DbInitializer.cs b/src/api/EProfspilka.Db/DbInitialize/DbInitializer.cs similarity index 94% rename from YeProfspilka.Backend/YeProfspilka.Db/DbInitialize/DbInitializer.cs rename to src/api/EProfspilka.Db/DbInitialize/DbInitializer.cs index ce91715..ada5aff 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/DbInitialize/DbInitializer.cs +++ b/src/api/EProfspilka.Db/DbInitialize/DbInitializer.cs @@ -1,8 +1,8 @@ -using YeProfspilka.Core.Entities; -using YeProfspilka.Db.EF; -using Role = YeProfspilka.Core.Enumerations.Role; +using EProfspilka.Core.Entities; +using EProfspilka.Db.EF; +using Role = EProfspilka.Core.Enumerations.Role; -namespace YeProfspilka.Db.DbInitialize; +namespace EProfspilka.Db.DbInitialize; public static class DbInitializer { @@ -119,7 +119,7 @@ private static void SeedSuperAdmin(YeProfspilkaContext db) Id = adminId, Email = "marianchuk.maksym@chnu.edu.ua", Facultet = "ФМІ", - Image = new () { Id = Guid.NewGuid(), ImageUrl = "https://lh3.googleusercontent.com/a/ACg8ocKRehp3a4owyAgaI_uiQgJ6xbVmcOf-VugDuo7XnJXoKw=s576-c-no"}, + Image = new() { Id = Guid.NewGuid(), ImageUrl = "https://lh3.googleusercontent.com/a/ACg8ocKRehp3a4owyAgaI_uiQgJ6xbVmcOf-VugDuo7XnJXoKw=s576-c-no" }, FullName = "Максим Васильович Мар'янчук", UserRoles = new List { diff --git a/YeProfspilka.Backend/YeProfspilka.Db/EF/YeProfspilkaContext.cs b/src/api/EProfspilka.Db/EF/YeProfspilkaContext.cs similarity index 83% rename from YeProfspilka.Backend/YeProfspilka.Db/EF/YeProfspilkaContext.cs rename to src/api/EProfspilka.Db/EF/YeProfspilkaContext.cs index bd54c6c..1b6760e 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/EF/YeProfspilkaContext.cs +++ b/src/api/EProfspilka.Db/EF/YeProfspilkaContext.cs @@ -1,15 +1,11 @@ +using EProfspilka.Core.Entities; using Microsoft.EntityFrameworkCore; using System.Reflection; -using YeProfspilka.Core.Entities; -namespace YeProfspilka.Db.EF; +namespace EProfspilka.Db.EF; -public class YeProfspilkaContext : DbContext +public class YeProfspilkaContext(DbContextOptions contextOptions) : DbContext(contextOptions) { - public YeProfspilkaContext(DbContextOptions contextOptions) - : base(contextOptions) - { } - protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); diff --git a/YeProfspilka.Backend/YeProfspilka.Db/YeProfspilka.Db.csproj b/src/api/EProfspilka.Db/EProfspilka.Db.csproj similarity index 56% rename from YeProfspilka.Backend/YeProfspilka.Db/YeProfspilka.Db.csproj rename to src/api/EProfspilka.Db/EProfspilka.Db.csproj index 316dccb..38815e9 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/YeProfspilka.Db.csproj +++ b/src/api/EProfspilka.Db/EProfspilka.Db.csproj @@ -1,20 +1,20 @@ - + - net6.0 + net8.0 enable enable - - - - + + + + - + diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329143045_Initial.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230329143045_Initial.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329143045_Initial.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230329143045_Initial.Designer.cs index 8841c90..278ce3b 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329143045_Initial.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230329143045_Initial.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329143045_Initial.cs b/src/api/EProfspilka.Db/Migrations/20230329143045_Initial.cs similarity index 98% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329143045_Initial.cs rename to src/api/EProfspilka.Db/Migrations/20230329143045_Initial.cs index dd6d4e7..46f7555 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329143045_Initial.cs +++ b/src/api/EProfspilka.Db/Migrations/20230329143045_Initial.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.Designer.cs index 2fbb2bd..76c5f7f 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.cs b/src/api/EProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.cs similarity index 97% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.cs rename to src/api/EProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.cs index 17fb811..64093ba 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.cs +++ b/src/api/EProfspilka.Db/Migrations/20230329145915_Events_and_EventsImages.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331081602_Update_User.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230331081602_Update_User.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331081602_Update_User.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230331081602_Update_User.Designer.cs index 3cfdc02..4e832c3 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331081602_Update_User.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230331081602_Update_User.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331081602_Update_User.cs b/src/api/EProfspilka.Db/Migrations/20230331081602_Update_User.cs similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331081602_Update_User.cs rename to src/api/EProfspilka.Db/Migrations/20230331081602_Update_User.cs diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331091226_Add_Roles.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230331091226_Add_Roles.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331091226_Add_Roles.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230331091226_Add_Roles.Designer.cs index ffa06ed..873b074 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331091226_Add_Roles.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230331091226_Add_Roles.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331091226_Add_Roles.cs b/src/api/EProfspilka.Db/Migrations/20230331091226_Add_Roles.cs similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331091226_Add_Roles.cs rename to src/api/EProfspilka.Db/Migrations/20230331091226_Add_Roles.cs diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331141715_AddNew_Entities.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230331141715_AddNew_Entities.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331141715_AddNew_Entities.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230331141715_AddNew_Entities.Designer.cs index 75a7e25..4f3463c 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331141715_AddNew_Entities.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230331141715_AddNew_Entities.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331141715_AddNew_Entities.cs b/src/api/EProfspilka.Db/Migrations/20230331141715_AddNew_Entities.cs similarity index 98% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331141715_AddNew_Entities.cs rename to src/api/EProfspilka.Db/Migrations/20230331141715_AddNew_Entities.cs index 6d931c6..13778fc 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230331141715_AddNew_Entities.cs +++ b/src/api/EProfspilka.Db/Migrations/20230331141715_AddNew_Entities.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422141524_StatusForEvents.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230422141524_StatusForEvents.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422141524_StatusForEvents.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230422141524_StatusForEvents.Designer.cs index 0015fdf..1d98602 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422141524_StatusForEvents.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230422141524_StatusForEvents.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422141524_StatusForEvents.cs b/src/api/EProfspilka.Db/Migrations/20230422141524_StatusForEvents.cs similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422141524_StatusForEvents.cs rename to src/api/EProfspilka.Db/Migrations/20230422141524_StatusForEvents.cs diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422153534_RenameField.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230422153534_RenameField.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422153534_RenameField.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230422153534_RenameField.Designer.cs index f7589c6..9254be8 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422153534_RenameField.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230422153534_RenameField.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422153534_RenameField.cs b/src/api/EProfspilka.Db/Migrations/20230422153534_RenameField.cs similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230422153534_RenameField.cs rename to src/api/EProfspilka.Db/Migrations/20230422153534_RenameField.cs diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230426204425_Discount_Service.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230426204425_Discount_Service.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230426204425_Discount_Service.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230426204425_Discount_Service.Designer.cs index 7484c0b..028639b 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230426204425_Discount_Service.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230426204425_Discount_Service.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230426204425_Discount_Service.cs b/src/api/EProfspilka.Db/Migrations/20230426204425_Discount_Service.cs similarity index 94% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230426204425_Discount_Service.cs rename to src/api/EProfspilka.Db/Migrations/20230426204425_Discount_Service.cs index 8b567f3..83d69f7 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230426204425_Discount_Service.cs +++ b/src/api/EProfspilka.Db/Migrations/20230426204425_Discount_Service.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230617194635_Codes.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230617194635_Codes.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230617194635_Codes.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230617194635_Codes.Designer.cs index a728137..b0323bc 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230617194635_Codes.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230617194635_Codes.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230617194635_Codes.cs b/src/api/EProfspilka.Db/Migrations/20230617194635_Codes.cs similarity index 95% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230617194635_Codes.cs rename to src/api/EProfspilka.Db/Migrations/20230617194635_Codes.cs index f8a3c09..a317068 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230617194635_Codes.cs +++ b/src/api/EProfspilka.Db/Migrations/20230617194635_Codes.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.Designer.cs index c9827f9..2575f90 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.cs b/src/api/EProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.cs similarity index 97% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.cs rename to src/api/EProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.cs index 09e424d..0819550 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.cs +++ b/src/api/EProfspilka.Db/Migrations/20230618155526_UpdateDiscountCodes.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.Designer.cs index e35ebe5..4434ee6 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.cs b/src/api/EProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.cs similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.cs rename to src/api/EProfspilka.Db/Migrations/20230703095308_Discount_Type_For_Discoiunt.cs diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703101159_DiscountUpdate.Designer.cs b/src/api/EProfspilka.Db/Migrations/20230703101159_DiscountUpdate.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703101159_DiscountUpdate.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20230703101159_DiscountUpdate.Designer.cs index 81e32be..d80d642 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703101159_DiscountUpdate.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20230703101159_DiscountUpdate.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703101159_DiscountUpdate.cs b/src/api/EProfspilka.Db/Migrations/20230703101159_DiscountUpdate.cs similarity index 97% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703101159_DiscountUpdate.cs rename to src/api/EProfspilka.Db/Migrations/20230703101159_DiscountUpdate.cs index 309c03d..94ce7cc 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20230703101159_DiscountUpdate.cs +++ b/src/api/EProfspilka.Db/Migrations/20230703101159_DiscountUpdate.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.Designer.cs b/src/api/EProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.Designer.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.Designer.cs rename to src/api/EProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.Designer.cs index d587f1a..04015cd 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.Designer.cs +++ b/src/api/EProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.Designer.cs @@ -1,11 +1,11 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.cs b/src/api/EProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.cs similarity index 100% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.cs rename to src/api/EProfspilka.Db/Migrations/20231014180842_Event_ShortDescriptions.cs diff --git a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/AppDbContextModelSnapshot.cs b/src/api/EProfspilka.Db/Migrations/AppDbContextModelSnapshot.cs similarity index 99% rename from YeProfspilka.Backend/YeProfspilka.Db/Migrations/AppDbContextModelSnapshot.cs rename to src/api/EProfspilka.Db/Migrations/AppDbContextModelSnapshot.cs index 141f301..9438ebb 100644 --- a/YeProfspilka.Backend/YeProfspilka.Db/Migrations/AppDbContextModelSnapshot.cs +++ b/src/api/EProfspilka.Db/Migrations/AppDbContextModelSnapshot.cs @@ -1,10 +1,10 @@ // using System; +using EProfspilka.Db.EF; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using YeProfspilka.Db.EF; #nullable disable diff --git a/YeProfspilka.Backend/YeProfspilka.Backend.sln b/src/api/eProfspilka.sln similarity index 66% rename from YeProfspilka.Backend/YeProfspilka.Backend.sln rename to src/api/eProfspilka.sln index e4c673f..ade6378 100644 --- a/YeProfspilka.Backend/YeProfspilka.Backend.sln +++ b/src/api/eProfspilka.sln @@ -1,12 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YeProfspilka.API", "YeProfspilka.API\YeProfspilka.API.csproj", "{A95250AA-896B-4A8F-A99B-F28ACC2F4494}" +# Visual Studio Version 17 +VisualStudioVersion = 17.10.34928.147 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EProfspilka.API", "EProfspilka.API\EProfspilka.API.csproj", "{A95250AA-896B-4A8F-A99B-F28ACC2F4494}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YeProfspilka.Db", "YeProfspilka.Db\YeProfspilka.Db.csproj", "{4F1AE7DB-0AA6-4C2F-9684-89062DF9F3A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EProfspilka.Db", "EProfspilka.Db\EProfspilka.Db.csproj", "{4F1AE7DB-0AA6-4C2F-9684-89062DF9F3A8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YeProfspilka.Core", "YeProfspilka.Core\YeProfspilka.Core.csproj", "{9ABC6BD0-53C8-4009-B599-F0E3909A72F1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EProfspilka.Core", "EProfspilka.Core\EProfspilka.Core.csproj", "{9ABC6BD0-53C8-4009-B599-F0E3909A72F1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YeProfspilka.Application", "YeProfspilka.Application\YeProfspilka.Application.csproj", "{099AC314-0130-4CDC-89F2-0F2A01F30FAE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EProfispilka.Application", "EProfspilka.Application\EProfispilka.Application.csproj", "{099AC314-0130-4CDC-89F2-0F2A01F30FAE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -31,4 +34,7 @@ Global {099AC314-0130-4CDC-89F2-0F2A01F30FAE}.Release|Any CPU.ActiveCfg = Release|Any CPU {099AC314-0130-4CDC-89F2-0F2A01F30FAE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal diff --git a/YeProfspilka.Backend/global.json b/src/api/global.json similarity index 77% rename from YeProfspilka.Backend/global.json rename to src/api/global.json index 1bcf6c0..90c8ac9 100644 --- a/YeProfspilka.Backend/global.json +++ b/src/api/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.0", + "version": "8.0.3", "rollForward": "latestMinor", "allowPrerelease": false } diff --git a/YeProfspilka.Frontend/.env b/src/web/.env similarity index 100% rename from YeProfspilka.Frontend/.env rename to src/web/.env diff --git a/YeProfspilka.Frontend/.env.prod b/src/web/.env.prod similarity index 100% rename from YeProfspilka.Frontend/.env.prod rename to src/web/.env.prod diff --git a/YeProfspilka.Frontend/.eslintrc.json b/src/web/.eslintrc.json similarity index 100% rename from YeProfspilka.Frontend/.eslintrc.json rename to src/web/.eslintrc.json diff --git a/YeProfspilka.Frontend/.gitignore b/src/web/.gitignore similarity index 100% rename from YeProfspilka.Frontend/.gitignore rename to src/web/.gitignore diff --git a/YeProfspilka.Frontend/.vscode/settings.json b/src/web/.vscode/settings.json similarity index 100% rename from YeProfspilka.Frontend/.vscode/settings.json rename to src/web/.vscode/settings.json diff --git a/YeProfspilka.Frontend/Dockerfile b/src/web/Dockerfile similarity index 100% rename from YeProfspilka.Frontend/Dockerfile rename to src/web/Dockerfile diff --git a/YeProfspilka.Frontend/README.md b/src/web/README.md similarity index 100% rename from YeProfspilka.Frontend/README.md rename to src/web/README.md diff --git a/YeProfspilka.Frontend/nginx.conf b/src/web/nginx.conf similarity index 100% rename from YeProfspilka.Frontend/nginx.conf rename to src/web/nginx.conf diff --git a/YeProfspilka.Frontend/package-lock.json b/src/web/package-lock.json similarity index 100% rename from YeProfspilka.Frontend/package-lock.json rename to src/web/package-lock.json diff --git a/YeProfspilka.Frontend/package.json b/src/web/package.json similarity index 97% rename from YeProfspilka.Frontend/package.json rename to src/web/package.json index ae3416c..d54c2af 100644 --- a/YeProfspilka.Frontend/package.json +++ b/src/web/package.json @@ -1,5 +1,5 @@ { - "name": "yeprofspilka.frontend", + "name": "e-profspilka.web", "version": "0.1.0", "private": true, "dependencies": { diff --git a/YeProfspilka.Frontend/public/favicon.ico b/src/web/public/favicon.ico similarity index 100% rename from YeProfspilka.Frontend/public/favicon.ico rename to src/web/public/favicon.ico diff --git a/YeProfspilka.Frontend/public/favicon.png b/src/web/public/favicon.png similarity index 100% rename from YeProfspilka.Frontend/public/favicon.png rename to src/web/public/favicon.png diff --git a/YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Bold.otf b/src/web/public/fonts/e-Ukraine/e-Ukraine-Bold.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Bold.otf rename to src/web/public/fonts/e-Ukraine/e-Ukraine-Bold.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Light.otf b/src/web/public/fonts/e-Ukraine/e-Ukraine-Light.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Light.otf rename to src/web/public/fonts/e-Ukraine/e-Ukraine-Light.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Medium.otf b/src/web/public/fonts/e-Ukraine/e-Ukraine-Medium.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Medium.otf rename to src/web/public/fonts/e-Ukraine/e-Ukraine-Medium.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Regular.otf b/src/web/public/fonts/e-Ukraine/e-Ukraine-Regular.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Regular.otf rename to src/web/public/fonts/e-Ukraine/e-Ukraine-Regular.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Thin.otf b/src/web/public/fonts/e-Ukraine/e-Ukraine-Thin.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-Thin.otf rename to src/web/public/fonts/e-Ukraine/e-Ukraine-Thin.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-UltraLight.otf b/src/web/public/fonts/e-Ukraine/e-Ukraine-UltraLight.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-Ukraine/e-Ukraine-UltraLight.otf rename to src/web/public/fonts/e-Ukraine/e-Ukraine-UltraLight.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Bold.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-Bold.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Bold.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-Bold.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-LOGO.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-LOGO.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-LOGO.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-LOGO.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Light.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-Light.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Light.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-Light.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Medium.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-Medium.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Medium.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-Medium.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Regular.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-Regular.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Regular.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-Regular.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Thin.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-Thin.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-Thin.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-Thin.otf diff --git a/YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-UltraLight.otf b/src/web/public/fonts/e-UkraineHead/e-UkraineHead-UltraLight.otf similarity index 100% rename from YeProfspilka.Frontend/public/fonts/e-UkraineHead/e-UkraineHead-UltraLight.otf rename to src/web/public/fonts/e-UkraineHead/e-UkraineHead-UltraLight.otf diff --git a/YeProfspilka.Frontend/public/images/logo-big.png b/src/web/public/images/logo-big.png similarity index 100% rename from YeProfspilka.Frontend/public/images/logo-big.png rename to src/web/public/images/logo-big.png diff --git a/YeProfspilka.Frontend/public/images/logo-transparent-big.png b/src/web/public/images/logo-transparent-big.png similarity index 100% rename from YeProfspilka.Frontend/public/images/logo-transparent-big.png rename to src/web/public/images/logo-transparent-big.png diff --git a/YeProfspilka.Frontend/public/images/logo.png b/src/web/public/images/logo.png similarity index 100% rename from YeProfspilka.Frontend/public/images/logo.png rename to src/web/public/images/logo.png diff --git a/YeProfspilka.Frontend/public/images/success.png b/src/web/public/images/success.png similarity index 100% rename from YeProfspilka.Frontend/public/images/success.png rename to src/web/public/images/success.png diff --git a/YeProfspilka.Frontend/public/images/warning.png b/src/web/public/images/warning.png similarity index 100% rename from YeProfspilka.Frontend/public/images/warning.png rename to src/web/public/images/warning.png diff --git a/YeProfspilka.Frontend/public/index.html b/src/web/public/index.html similarity index 100% rename from YeProfspilka.Frontend/public/index.html rename to src/web/public/index.html diff --git a/YeProfspilka.Frontend/public/manifest.json b/src/web/public/manifest.json similarity index 100% rename from YeProfspilka.Frontend/public/manifest.json rename to src/web/public/manifest.json diff --git a/YeProfspilka.Frontend/public/robots.txt b/src/web/public/robots.txt similarity index 100% rename from YeProfspilka.Frontend/public/robots.txt rename to src/web/public/robots.txt diff --git a/YeProfspilka.Frontend/src/App.jsx b/src/web/src/App.jsx similarity index 100% rename from YeProfspilka.Frontend/src/App.jsx rename to src/web/src/App.jsx diff --git a/YeProfspilka.Frontend/src/app/store.js b/src/web/src/app/store.js similarity index 100% rename from YeProfspilka.Frontend/src/app/store.js rename to src/web/src/app/store.js diff --git a/YeProfspilka.Frontend/src/assets/svgs/google.svg b/src/web/src/assets/svgs/google.svg similarity index 100% rename from YeProfspilka.Frontend/src/assets/svgs/google.svg rename to src/web/src/assets/svgs/google.svg diff --git a/YeProfspilka.Frontend/src/assets/svgs/index.js b/src/web/src/assets/svgs/index.js similarity index 100% rename from YeProfspilka.Frontend/src/assets/svgs/index.js rename to src/web/src/assets/svgs/index.js diff --git a/YeProfspilka.Frontend/src/assets/svgs/logo.svg b/src/web/src/assets/svgs/logo.svg similarity index 100% rename from YeProfspilka.Frontend/src/assets/svgs/logo.svg rename to src/web/src/assets/svgs/logo.svg diff --git a/YeProfspilka.Frontend/src/assets/svgs/mainCircle.svg b/src/web/src/assets/svgs/mainCircle.svg similarity index 100% rename from YeProfspilka.Frontend/src/assets/svgs/mainCircle.svg rename to src/web/src/assets/svgs/mainCircle.svg diff --git a/YeProfspilka.Frontend/src/components/Accordion/index.jsx b/src/web/src/components/Accordion/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Accordion/index.jsx rename to src/web/src/components/Accordion/index.jsx diff --git a/YeProfspilka.Frontend/src/components/AdvantagesCard/index.jsx b/src/web/src/components/AdvantagesCard/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/AdvantagesCard/index.jsx rename to src/web/src/components/AdvantagesCard/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Alert/index.jsx b/src/web/src/components/Alert/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Alert/index.jsx rename to src/web/src/components/Alert/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Avatar/index.jsx b/src/web/src/components/Avatar/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Avatar/index.jsx rename to src/web/src/components/Avatar/index.jsx diff --git a/YeProfspilka.Frontend/src/components/BarcodeGenerator/index.jsx b/src/web/src/components/BarcodeGenerator/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/BarcodeGenerator/index.jsx rename to src/web/src/components/BarcodeGenerator/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Carousel/index.jsx b/src/web/src/components/Carousel/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Carousel/index.jsx rename to src/web/src/components/Carousel/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Circles/index.jsx b/src/web/src/components/Circles/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Circles/index.jsx rename to src/web/src/components/Circles/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Container/index.jsx b/src/web/src/components/Container/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Container/index.jsx rename to src/web/src/components/Container/index.jsx diff --git a/YeProfspilka.Frontend/src/components/DiscountCard/Timer.jsx b/src/web/src/components/DiscountCard/Timer.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/DiscountCard/Timer.jsx rename to src/web/src/components/DiscountCard/Timer.jsx diff --git a/YeProfspilka.Frontend/src/components/DiscountCard/index.jsx b/src/web/src/components/DiscountCard/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/DiscountCard/index.jsx rename to src/web/src/components/DiscountCard/index.jsx diff --git a/YeProfspilka.Frontend/src/components/EventCard/index.jsx b/src/web/src/components/EventCard/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/EventCard/index.jsx rename to src/web/src/components/EventCard/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Footer/index.jsx b/src/web/src/components/Footer/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Footer/index.jsx rename to src/web/src/components/Footer/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Header/Hamburger.jsx b/src/web/src/components/Header/Hamburger.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Header/Hamburger.jsx rename to src/web/src/components/Header/Hamburger.jsx diff --git a/YeProfspilka.Frontend/src/components/Header/MobileHeader.jsx b/src/web/src/components/Header/MobileHeader.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Header/MobileHeader.jsx rename to src/web/src/components/Header/MobileHeader.jsx diff --git a/YeProfspilka.Frontend/src/components/Header/MobileMenuContent.jsx b/src/web/src/components/Header/MobileMenuContent.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Header/MobileMenuContent.jsx rename to src/web/src/components/Header/MobileMenuContent.jsx diff --git a/YeProfspilka.Frontend/src/components/Header/UserDetails.jsx b/src/web/src/components/Header/UserDetails.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Header/UserDetails.jsx rename to src/web/src/components/Header/UserDetails.jsx diff --git a/YeProfspilka.Frontend/src/components/Header/index.jsx b/src/web/src/components/Header/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Header/index.jsx rename to src/web/src/components/Header/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Layout/index.jsx b/src/web/src/components/Layout/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Layout/index.jsx rename to src/web/src/components/Layout/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Loader/index.jsx b/src/web/src/components/Loader/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Loader/index.jsx rename to src/web/src/components/Loader/index.jsx diff --git a/YeProfspilka.Frontend/src/components/PageWrapper/index.jsx b/src/web/src/components/PageWrapper/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/PageWrapper/index.jsx rename to src/web/src/components/PageWrapper/index.jsx diff --git a/YeProfspilka.Frontend/src/components/PartnerCard/index.jsx b/src/web/src/components/PartnerCard/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/PartnerCard/index.jsx rename to src/web/src/components/PartnerCard/index.jsx diff --git a/YeProfspilka.Frontend/src/components/ProtectedRoute/index.jsx b/src/web/src/components/ProtectedRoute/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/ProtectedRoute/index.jsx rename to src/web/src/components/ProtectedRoute/index.jsx diff --git a/YeProfspilka.Frontend/src/components/QrcodeGenerator/index.jsx b/src/web/src/components/QrcodeGenerator/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/QrcodeGenerator/index.jsx rename to src/web/src/components/QrcodeGenerator/index.jsx diff --git a/YeProfspilka.Frontend/src/components/RegistrationForm/index.jsx b/src/web/src/components/RegistrationForm/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/RegistrationForm/index.jsx rename to src/web/src/components/RegistrationForm/index.jsx diff --git a/YeProfspilka.Frontend/src/components/SimpleModal/index.jsx b/src/web/src/components/SimpleModal/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/SimpleModal/index.jsx rename to src/web/src/components/SimpleModal/index.jsx diff --git a/YeProfspilka.Frontend/src/components/Svg/index.jsx b/src/web/src/components/Svg/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/components/Svg/index.jsx rename to src/web/src/components/Svg/index.jsx diff --git a/YeProfspilka.Frontend/src/features/advantagesSlice.js b/src/web/src/features/advantagesSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/advantagesSlice.js rename to src/web/src/features/advantagesSlice.js diff --git a/YeProfspilka.Frontend/src/features/alertSlice.js b/src/web/src/features/alertSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/alertSlice.js rename to src/web/src/features/alertSlice.js diff --git a/YeProfspilka.Frontend/src/features/discountSlice.js b/src/web/src/features/discountSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/discountSlice.js rename to src/web/src/features/discountSlice.js diff --git a/YeProfspilka.Frontend/src/features/eventsSlice.js b/src/web/src/features/eventsSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/eventsSlice.js rename to src/web/src/features/eventsSlice.js diff --git a/YeProfspilka.Frontend/src/features/index.js b/src/web/src/features/index.js similarity index 100% rename from YeProfspilka.Frontend/src/features/index.js rename to src/web/src/features/index.js diff --git a/YeProfspilka.Frontend/src/features/loginSlice.js b/src/web/src/features/loginSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/loginSlice.js rename to src/web/src/features/loginSlice.js diff --git a/YeProfspilka.Frontend/src/features/partnersSlice.js b/src/web/src/features/partnersSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/partnersSlice.js rename to src/web/src/features/partnersSlice.js diff --git a/YeProfspilka.Frontend/src/features/questionsSlice.js b/src/web/src/features/questionsSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/questionsSlice.js rename to src/web/src/features/questionsSlice.js diff --git a/YeProfspilka.Frontend/src/features/userSlice.js b/src/web/src/features/userSlice.js similarity index 100% rename from YeProfspilka.Frontend/src/features/userSlice.js rename to src/web/src/features/userSlice.js diff --git a/YeProfspilka.Frontend/src/index.css b/src/web/src/index.css similarity index 100% rename from YeProfspilka.Frontend/src/index.css rename to src/web/src/index.css diff --git a/YeProfspilka.Frontend/src/index.js b/src/web/src/index.js similarity index 100% rename from YeProfspilka.Frontend/src/index.js rename to src/web/src/index.js diff --git a/YeProfspilka.Frontend/src/pages/Event/index.jsx b/src/web/src/pages/Event/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Event/index.jsx rename to src/web/src/pages/Event/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/Events/index.jsx b/src/web/src/pages/Events/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Events/index.jsx rename to src/web/src/pages/Events/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/ExternalRedirect/index.jsx b/src/web/src/pages/ExternalRedirect/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/ExternalRedirect/index.jsx rename to src/web/src/pages/ExternalRedirect/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/Advantages.jsx b/src/web/src/pages/Main/components/Advantages.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/Advantages.jsx rename to src/web/src/pages/Main/components/Advantages.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/Events.jsx b/src/web/src/pages/Main/components/Events.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/Events.jsx rename to src/web/src/pages/Main/components/Events.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/Landing.jsx b/src/web/src/pages/Main/components/Landing.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/Landing.jsx rename to src/web/src/pages/Main/components/Landing.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/Mark.jsx b/src/web/src/pages/Main/components/Mark.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/Mark.jsx rename to src/web/src/pages/Main/components/Mark.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/Partners.jsx b/src/web/src/pages/Main/components/Partners.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/Partners.jsx rename to src/web/src/pages/Main/components/Partners.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/SharedDiscounts.jsx b/src/web/src/pages/Main/components/SharedDiscounts.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/SharedDiscounts.jsx rename to src/web/src/pages/Main/components/SharedDiscounts.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/Socials.jsx b/src/web/src/pages/Main/components/Socials.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/Socials.jsx rename to src/web/src/pages/Main/components/Socials.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/components/TypicalQuestions.jsx b/src/web/src/pages/Main/components/TypicalQuestions.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/components/TypicalQuestions.jsx rename to src/web/src/pages/Main/components/TypicalQuestions.jsx diff --git a/YeProfspilka.Frontend/src/pages/Main/index.jsx b/src/web/src/pages/Main/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Main/index.jsx rename to src/web/src/pages/Main/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/NotFound/index.jsx b/src/web/src/pages/NotFound/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/NotFound/index.jsx rename to src/web/src/pages/NotFound/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/Profile/DiscountsList.jsx b/src/web/src/pages/Profile/DiscountsList.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Profile/DiscountsList.jsx rename to src/web/src/pages/Profile/DiscountsList.jsx diff --git a/YeProfspilka.Frontend/src/pages/Profile/Field.jsx b/src/web/src/pages/Profile/Field.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Profile/Field.jsx rename to src/web/src/pages/Profile/Field.jsx diff --git a/YeProfspilka.Frontend/src/pages/Profile/ProfileSidebar.jsx b/src/web/src/pages/Profile/ProfileSidebar.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Profile/ProfileSidebar.jsx rename to src/web/src/pages/Profile/ProfileSidebar.jsx diff --git a/YeProfspilka.Frontend/src/pages/Profile/UserStatus.jsx b/src/web/src/pages/Profile/UserStatus.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Profile/UserStatus.jsx rename to src/web/src/pages/Profile/UserStatus.jsx diff --git a/YeProfspilka.Frontend/src/pages/Profile/index.jsx b/src/web/src/pages/Profile/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/Profile/index.jsx rename to src/web/src/pages/Profile/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/VerifyDiscount/index.jsx b/src/web/src/pages/VerifyDiscount/index.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/VerifyDiscount/index.jsx rename to src/web/src/pages/VerifyDiscount/index.jsx diff --git a/YeProfspilka.Frontend/src/pages/routes.jsx b/src/web/src/pages/routes.jsx similarity index 100% rename from YeProfspilka.Frontend/src/pages/routes.jsx rename to src/web/src/pages/routes.jsx diff --git a/YeProfspilka.Frontend/src/pages/routesProtection.js b/src/web/src/pages/routesProtection.js similarity index 100% rename from YeProfspilka.Frontend/src/pages/routesProtection.js rename to src/web/src/pages/routesProtection.js diff --git a/YeProfspilka.Frontend/src/services/AdvantagesService.js b/src/web/src/services/AdvantagesService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/AdvantagesService.js rename to src/web/src/services/AdvantagesService.js diff --git a/YeProfspilka.Frontend/src/services/AuthenticateService.js b/src/web/src/services/AuthenticateService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/AuthenticateService.js rename to src/web/src/services/AuthenticateService.js diff --git a/YeProfspilka.Frontend/src/services/DiscountService.js b/src/web/src/services/DiscountService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/DiscountService.js rename to src/web/src/services/DiscountService.js diff --git a/YeProfspilka.Frontend/src/services/EventService.js b/src/web/src/services/EventService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/EventService.js rename to src/web/src/services/EventService.js diff --git a/YeProfspilka.Frontend/src/services/GoogleAuth.js b/src/web/src/services/GoogleAuth.js similarity index 100% rename from YeProfspilka.Frontend/src/services/GoogleAuth.js rename to src/web/src/services/GoogleAuth.js diff --git a/YeProfspilka.Frontend/src/services/PartnersService.js b/src/web/src/services/PartnersService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/PartnersService.js rename to src/web/src/services/PartnersService.js diff --git a/YeProfspilka.Frontend/src/services/QuestionsService.js b/src/web/src/services/QuestionsService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/QuestionsService.js rename to src/web/src/services/QuestionsService.js diff --git a/YeProfspilka.Frontend/src/services/TokenService.js b/src/web/src/services/TokenService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/TokenService.js rename to src/web/src/services/TokenService.js diff --git a/YeProfspilka.Frontend/src/services/UserService.js b/src/web/src/services/UserService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/UserService.js rename to src/web/src/services/UserService.js diff --git a/YeProfspilka.Frontend/src/services/config/ApiService.js b/src/web/src/services/config/ApiService.js similarity index 100% rename from YeProfspilka.Frontend/src/services/config/ApiService.js rename to src/web/src/services/config/ApiService.js diff --git a/YeProfspilka.Frontend/src/services/config/axios.config.js b/src/web/src/services/config/axios.config.js similarity index 100% rename from YeProfspilka.Frontend/src/services/config/axios.config.js rename to src/web/src/services/config/axios.config.js diff --git a/YeProfspilka.Frontend/src/types/alertTypes.js b/src/web/src/types/alertTypes.js similarity index 100% rename from YeProfspilka.Frontend/src/types/alertTypes.js rename to src/web/src/types/alertTypes.js diff --git a/YeProfspilka.Frontend/src/types/discountType.js b/src/web/src/types/discountType.js similarity index 100% rename from YeProfspilka.Frontend/src/types/discountType.js rename to src/web/src/types/discountType.js diff --git a/YeProfspilka.Frontend/src/types/memberStatus.js b/src/web/src/types/memberStatus.js similarity index 100% rename from YeProfspilka.Frontend/src/types/memberStatus.js rename to src/web/src/types/memberStatus.js diff --git a/YeProfspilka.Frontend/src/ui/Buttons/Button.jsx b/src/web/src/ui/Buttons/Button.jsx similarity index 100% rename from YeProfspilka.Frontend/src/ui/Buttons/Button.jsx rename to src/web/src/ui/Buttons/Button.jsx diff --git a/YeProfspilka.Frontend/src/ui/Buttons/GoogleButton.jsx b/src/web/src/ui/Buttons/GoogleButton.jsx similarity index 100% rename from YeProfspilka.Frontend/src/ui/Buttons/GoogleButton.jsx rename to src/web/src/ui/Buttons/GoogleButton.jsx diff --git a/YeProfspilka.Frontend/src/ui/Buttons/PrimaryButton.jsx b/src/web/src/ui/Buttons/PrimaryButton.jsx similarity index 100% rename from YeProfspilka.Frontend/src/ui/Buttons/PrimaryButton.jsx rename to src/web/src/ui/Buttons/PrimaryButton.jsx diff --git a/YeProfspilka.Frontend/src/ui/Fields/TextField.jsx b/src/web/src/ui/Fields/TextField.jsx similarity index 100% rename from YeProfspilka.Frontend/src/ui/Fields/TextField.jsx rename to src/web/src/ui/Fields/TextField.jsx diff --git a/YeProfspilka.Frontend/src/utils/constants.js b/src/web/src/utils/constants.js similarity index 100% rename from YeProfspilka.Frontend/src/utils/constants.js rename to src/web/src/utils/constants.js diff --git a/YeProfspilka.Frontend/src/utils/mocks.js b/src/web/src/utils/mocks.js similarity index 100% rename from YeProfspilka.Frontend/src/utils/mocks.js rename to src/web/src/utils/mocks.js diff --git a/YeProfspilka.Frontend/tailwind.config.js b/src/web/tailwind.config.js similarity index 100% rename from YeProfspilka.Frontend/tailwind.config.js rename to src/web/tailwind.config.js