diff --git a/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfo.cs b/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfo.cs index e973843..368e634 100644 --- a/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfo.cs +++ b/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5b98b0036758c0bfbfd050b258dbaf603f2669f2")] [assembly: System.Reflection.AssemblyProductAttribute("console_ui")] [assembly: System.Reflection.AssemblyTitleAttribute("console_ui")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfoInputs.cache b/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfoInputs.cache index 62e776c..66815dc 100644 --- a/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfoInputs.cache +++ b/console_ui/obj/Debug/net8.0/console_ui.AssemblyInfoInputs.cache @@ -1 +1 @@ -ba882f03fdfa9546ef7659464bc47e4a0ca2d53498595f377280140f0c41eed4 +b49b12c1eb209457e0c1d0e3edaa7ba0ff70b6f92d0e9721fc4a71fd5a16073d diff --git a/console_ui/obj/Debug/net8.0/console_ui.csproj.AssemblyReference.cache b/console_ui/obj/Debug/net8.0/console_ui.csproj.AssemblyReference.cache index 1067ab1..f770548 100644 Binary files a/console_ui/obj/Debug/net8.0/console_ui.csproj.AssemblyReference.cache and b/console_ui/obj/Debug/net8.0/console_ui.csproj.AssemblyReference.cache differ diff --git a/data/Repository/IPresenceRepository.cs b/data/Repository/IPresenceRepository.cs index 00c88a6..fba97a3 100755 --- a/data/Repository/IPresenceRepository.cs +++ b/data/Repository/IPresenceRepository.cs @@ -9,10 +9,15 @@ namespace presence.data.Repository { public interface IPresenceRepository { + List GetPresence(int GroupId, DateOnly startData, DateOnly endData, int UserId); List GetPresenceByGroup(int groupId); List GetPresenceByGroupAndDate(int groupId, DateOnly date); bool UncheckAttendence(int firstClass, int lastClass, DateOnly date, int userId); bool AddPresence(PresenceDao presence); + bool DeletePresenceByGroup(int groupId); + bool DeletePresenceByUser(int userId); + bool DeletePresenceByDate(DateOnly startData, DateOnly endData); + } } \ No newline at end of file diff --git a/data/Repository/PresenceRepositoryImpl.cs b/data/Repository/PresenceRepositoryImpl.cs index 1e7ef48..9450799 100755 --- a/data/Repository/PresenceRepositoryImpl.cs +++ b/data/Repository/PresenceRepositoryImpl.cs @@ -33,6 +33,13 @@ namespace presence.data.Repository return true; } + public List GetPresence(int GroupId, DateOnly startData, DateOnly endData, int UserId) + { + var presenceList = _remoteDatabaseContext.Presences.Where(presence => presence.GroupId == GroupId + && presence.UserId == UserId && presence.Date >= startData && presence.Date <= endData).ToList(); + return presenceList; + } + public List GetPresenceByGroup(int groupId) { var listPresences = _remoteDatabaseContext.Presences @@ -59,5 +66,60 @@ namespace presence.data.Repository _remoteDatabaseContext.SaveChanges(); return true; } + + public bool DeletePresenceByGroup(int groupId) + { + var presenceToDelete = _remoteDatabaseContext.Presences.Where(x => x.GroupId == groupId).ToList(); + + if (presenceToDelete.Count > 0) + { + foreach (var presence in presenceToDelete) + { + _remoteDatabaseContext.Presences.Remove(presence); + } + + _remoteDatabaseContext.SaveChanges(); + return true; + } + return false; + } + + public bool DeletePresenceByUser(int userId) + { + var presenceToDelete = _remoteDatabaseContext.Presences.Where(x => x.UserId == userId).ToList(); + + if (presenceToDelete.Count > 0) + { + foreach (var presence in presenceToDelete) + { + _remoteDatabaseContext.Presences.Remove(presence); + } + + _remoteDatabaseContext.SaveChanges(); + return true; + } + return false; + } + + public bool DeletePresenceByDate(DateOnly startData, DateOnly endData) + { + var PresenceToDelete = _remoteDatabaseContext.Presences.Where(x => x.Date == startData).ToList(); + for (var i = startData; i < endData; i = i.AddDays(1)) + { + PresenceToDelete.AddRange(_remoteDatabaseContext.Presences.Where(x => x.Date == i).ToList()); + } + if (PresenceToDelete.Count > 0) + { + foreach (var presence in PresenceToDelete) + { + _remoteDatabaseContext.Presences.Remove(presence); + } + + _remoteDatabaseContext.SaveChanges(); + return true; + } + + return false; + } } } \ No newline at end of file diff --git a/data/bin/Debug/net8.0/data.dll b/data/bin/Debug/net8.0/data.dll index ea4ce75..587edfb 100644 Binary files a/data/bin/Debug/net8.0/data.dll and b/data/bin/Debug/net8.0/data.dll differ diff --git a/data/bin/Debug/net8.0/data.pdb b/data/bin/Debug/net8.0/data.pdb index 1baf166..42ceebb 100644 Binary files a/data/bin/Debug/net8.0/data.pdb and b/data/bin/Debug/net8.0/data.pdb differ diff --git a/data/obj/Debug/net8.0/data.AssemblyInfo.cs b/data/obj/Debug/net8.0/data.AssemblyInfo.cs index f77db53..272b475 100644 --- a/data/obj/Debug/net8.0/data.AssemblyInfo.cs +++ b/data/obj/Debug/net8.0/data.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("data")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4bdc422ce8c208f21ae34f3d9f1cc61a98a48a3c")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5b98b0036758c0bfbfd050b258dbaf603f2669f2")] [assembly: System.Reflection.AssemblyProductAttribute("data")] [assembly: System.Reflection.AssemblyTitleAttribute("data")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache b/data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache index 558245e..ecdbe28 100644 --- a/data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache +++ b/data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache @@ -1 +1 @@ -f31721b3835e5b512a8546f19c261266dec727598bee64acedc7558f74f5abd0 +6f386b203319659ed0626eb565d13c3eafd1b1ae62135254883fcc52ed19b403 diff --git a/data/obj/Debug/net8.0/data.dll b/data/obj/Debug/net8.0/data.dll index ea4ce75..587edfb 100644 Binary files a/data/obj/Debug/net8.0/data.dll and b/data/obj/Debug/net8.0/data.dll differ diff --git a/data/obj/Debug/net8.0/data.pdb b/data/obj/Debug/net8.0/data.pdb index 1baf166..42ceebb 100644 Binary files a/data/obj/Debug/net8.0/data.pdb and b/data/obj/Debug/net8.0/data.pdb differ diff --git a/data/obj/Debug/net8.0/ref/data.dll b/data/obj/Debug/net8.0/ref/data.dll index 591bcb0..ca51007 100644 Binary files a/data/obj/Debug/net8.0/ref/data.dll and b/data/obj/Debug/net8.0/ref/data.dll differ diff --git a/data/obj/Debug/net8.0/refint/data.dll b/data/obj/Debug/net8.0/refint/data.dll index 591bcb0..ca51007 100644 Binary files a/data/obj/Debug/net8.0/refint/data.dll and b/data/obj/Debug/net8.0/refint/data.dll differ diff --git a/domain/Models/ResponseModels/PresenceResponse.cs b/domain/Models/ResponseModels/PresenceResponse.cs new file mode 100644 index 0000000..c1f3275 --- /dev/null +++ b/domain/Models/ResponseModels/PresenceResponse.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace domain.Models.ResponseModels +{ + public class PresenceResponse + { + public required DateOnly Date {get; set;} + public int ClassNumber {get; set;} + public bool IsAttendence {get; set;} + public required UserResponse User {get; set;} + } +} \ No newline at end of file diff --git a/domain/UseCase/PresenceUseCase.cs b/domain/UseCase/PresenceUseCase.cs index ead220e..0629be8 100755 --- a/domain/UseCase/PresenceUseCase.cs +++ b/domain/UseCase/PresenceUseCase.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; +using domain.Models.ResponseModels; using presence.data.LocalData.Entity; using presence.data.RemoteData.RemoteDataBase.DAO; using presence.data.Repository; @@ -25,15 +26,33 @@ namespace presence.domain.UseCase _groupRepository = groupRepositoryImpl; } - public List GetPresenceByGroup(int groupId) { + public List GetPresence(int GroupId, DateOnly startData, DateOnly endData, int UserId) + { + var users = _userRepository.GetAllUser().Where(x => x.GroupId == GroupId).ToList(); + + var presence = _presenceRepository.GetPresence(GroupId, startData, endData, UserId) + .Where(x => users.Any(user => user.UserId == x.UserId)) + .Select(presence => new PresenceResponse{ + User = new UserResponse{ + Id = presence.UserId, + Group = new GroupResponse{Id = GroupId, Name = _groupRepository.GetGroupById(GroupId).Name}, + FIO = users.First(user => user.UserId == presence.UserId).FIO, + }, + ClassNumber = presence.ClassNumber, + Date = presence.Date, + IsAttendence = presence.IsAttendence + }).ToList(); + return presence; + } + public List GetPresenceByGroup(int groupId) { var users = _userRepository.GetAllUser().Where(x => x.GroupId == groupId).ToList(); var presenceByGroup = _presenceRepository.GetPresenceByGroup(groupId) .Where(x => users.Any(user => user.UserId == x.UserId)) - .Select(presence => new Presence{ - User = new User{ + .Select(presence => new PresenceResponse{ + User = new UserResponse{ Id = presence.UserId, - GroupId = new Group{Id = groupId, Name = _groupRepository.GetGroupById(groupId).Name}, + Group = new GroupResponse{Id = groupId, Name = _groupRepository.GetGroupById(groupId).Name}, FIO = users.First(user => user.UserId == presence.UserId).FIO, }, ClassNumber = presence.ClassNumber, @@ -65,27 +84,45 @@ namespace presence.domain.UseCase return _presenceRepository.UncheckAttendence(firstClass, lastClass, date, userId); } - public void AddPresence(int firstClass, int lastClass, int groupId,DateOnly date) + public List AddPresence(String startDate, String endDate, int groupId) { - var users = _userRepository.GetAllUser().Where(x => x.GroupId==groupId).ToList(); - List presenceList = new List(); - for (int i = firstClass; i < lastClass; i++) + var users = _userRepository.GetAllUser().Where(x => x.GroupId == groupId).ToList(); + List presenceList = new List(); + + for (var currentDate = DateOnly.Parse(startDate); currentDate <= DateOnly.Parse(endDate); currentDate = currentDate.AddDays(1)) { - foreach (var user in users) + for (int i = 1; i < 8; i++) { - Presence pres = new Presence{ClassNumber = i, Date = date, - User = new User{Id = user.UserId, - FIO = user.FIO, - GroupId = new Group{Id = groupId, - Name = _groupRepository.GetGroupById(groupId).Name}}}; - presenceList.Add(pres); - } + if (currentDate.DayOfWeek == DayOfWeek.Saturday || + currentDate.DayOfWeek == DayOfWeek.Sunday) + { + continue; + } + + foreach (var user in users) + { + var presenceDao = new PresenceDao + { + ClassNumber = i, + Date = currentDate, + UserId = user.UserId, + User = user, + GroupId = groupId + }; + _presenceRepository.AddPresence(presenceDao); + } + } + } + // Здесь можно добавить код для сохранения presenceList в репозиторий, если это необходимо + return presenceList; } + public Dictionary GetPresenceStatsByGroup(int groupId) { var stats = new Dictionary(); - + + // Получаем всех студентов группы var users = _userRepository.GetAllUser().Where(x => x.GroupId == groupId).ToList(); stats["Количество студентов"] = users.Count; @@ -116,6 +153,7 @@ namespace presence.domain.UseCase return stats; } + public void GenerateWeeklyPresence(int firstClass, int lastClass, int groupId, DateOnly startDate) { // Получаем всех студентов группы @@ -152,5 +190,20 @@ namespace presence.domain.UseCase } } } + + public bool DeletePresenceByGroup(int groupId) + { + return _presenceRepository.DeletePresenceByGroup(groupId); + } + + public bool DeletePresenceByUser(int UserId) + { + return _presenceRepository.DeletePresenceByUser(UserId); + } + + public bool DeletePresenceByDate(DateOnly startData, DateOnly endData) + { + return _presenceRepository.DeletePresenceByDate(startData, endData); + } } } diff --git a/domain/UseCase/UserUseCase.cs b/domain/UseCase/UserUseCase.cs index 6e09932..c4d8d37 100755 --- a/domain/UseCase/UserUseCase.cs +++ b/domain/UseCase/UserUseCase.cs @@ -26,14 +26,14 @@ namespace presence.domain.UseCase private List GetAllGroups() => _repositoryGroupImpl.GetAllGroup() .Select(it => new Group { Id = it.Id, Name = it.Name}).ToList(); - public List GetAllUsers() => _repositoryUserImpl.GetAllUser() + public List GetAllUsers() => _repositoryUserImpl.GetAllUser() .Join(_repositoryGroupImpl.GetAllGroup(), user => user.GroupId, group => group.Id, (user, group) => - new UserResponse { FIO = user.FIO, + new User { FIO = user.FIO, Id = user.UserId, - Group = new GroupResponse{Id = group.Id, Name = group.Name}} + GroupId = new Group{Id = group.Id, Name = group.Name}} ).ToList(); diff --git a/domain/bin/Debug/net8.0/data.dll b/domain/bin/Debug/net8.0/data.dll index ea4ce75..587edfb 100644 Binary files a/domain/bin/Debug/net8.0/data.dll and b/domain/bin/Debug/net8.0/data.dll differ diff --git a/domain/bin/Debug/net8.0/data.pdb b/domain/bin/Debug/net8.0/data.pdb index 1baf166..42ceebb 100644 Binary files a/domain/bin/Debug/net8.0/data.pdb and b/domain/bin/Debug/net8.0/data.pdb differ diff --git a/domain/bin/Debug/net8.0/domain.dll b/domain/bin/Debug/net8.0/domain.dll index d2996b8..b60f9d9 100644 Binary files a/domain/bin/Debug/net8.0/domain.dll and b/domain/bin/Debug/net8.0/domain.dll differ diff --git a/domain/bin/Debug/net8.0/domain.pdb b/domain/bin/Debug/net8.0/domain.pdb index 12479d7..349c8dc 100644 Binary files a/domain/bin/Debug/net8.0/domain.pdb and b/domain/bin/Debug/net8.0/domain.pdb differ diff --git a/domain/obj/Debug/net8.0/domain.AssemblyInfo.cs b/domain/obj/Debug/net8.0/domain.AssemblyInfo.cs index 1310460..f9719c0 100644 --- a/domain/obj/Debug/net8.0/domain.AssemblyInfo.cs +++ b/domain/obj/Debug/net8.0/domain.AssemblyInfo.cs @@ -13,10 +13,10 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("domain")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4bdc422ce8c208f21ae34f3d9f1cc61a98a48a3c")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5b98b0036758c0bfbfd050b258dbaf603f2669f2")] [assembly: System.Reflection.AssemblyProductAttribute("domain")] [assembly: System.Reflection.AssemblyTitleAttribute("domain")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -// Создано классом WriteCodeFragment MSBuild. +// Generated by the MSBuild WriteCodeFragment class. diff --git a/domain/obj/Debug/net8.0/domain.AssemblyInfoInputs.cache b/domain/obj/Debug/net8.0/domain.AssemblyInfoInputs.cache index 64f7b25..8ee0657 100644 --- a/domain/obj/Debug/net8.0/domain.AssemblyInfoInputs.cache +++ b/domain/obj/Debug/net8.0/domain.AssemblyInfoInputs.cache @@ -1 +1 @@ -a093ba0bf5d64479b23b12bae8cbb0ec7eeab3342133eaa4fe9b892857454774 +32c088b7c6199415eae14640ae08a92e330be47769adae5ea3e1bd938c16f111 diff --git a/domain/obj/Debug/net8.0/domain.csproj.AssemblyReference.cache b/domain/obj/Debug/net8.0/domain.csproj.AssemblyReference.cache index 9c16d17..4a79922 100644 Binary files a/domain/obj/Debug/net8.0/domain.csproj.AssemblyReference.cache and b/domain/obj/Debug/net8.0/domain.csproj.AssemblyReference.cache differ diff --git a/domain/obj/Debug/net8.0/domain.csproj.CoreCompileInputs.cache b/domain/obj/Debug/net8.0/domain.csproj.CoreCompileInputs.cache index 886305c..027c06b 100644 --- a/domain/obj/Debug/net8.0/domain.csproj.CoreCompileInputs.cache +++ b/domain/obj/Debug/net8.0/domain.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -a9b24df1a9b756a44c00b9ae5110f480b03594c888c3659dbb3f3845f84a2ce4 +ae51241ac0f631c070df03008b50d177e40c007642b63ec680be1b4b5ad4221b diff --git a/domain/obj/Debug/net8.0/domain.dll b/domain/obj/Debug/net8.0/domain.dll index d2996b8..b60f9d9 100644 Binary files a/domain/obj/Debug/net8.0/domain.dll and b/domain/obj/Debug/net8.0/domain.dll differ diff --git a/domain/obj/Debug/net8.0/domain.pdb b/domain/obj/Debug/net8.0/domain.pdb index 12479d7..349c8dc 100644 Binary files a/domain/obj/Debug/net8.0/domain.pdb and b/domain/obj/Debug/net8.0/domain.pdb differ diff --git a/domain/obj/Debug/net8.0/ref/domain.dll b/domain/obj/Debug/net8.0/ref/domain.dll index 3f5251a..2a4ea91 100644 Binary files a/domain/obj/Debug/net8.0/ref/domain.dll and b/domain/obj/Debug/net8.0/ref/domain.dll differ diff --git a/domain/obj/Debug/net8.0/refint/domain.dll b/domain/obj/Debug/net8.0/refint/domain.dll index 3f5251a..2a4ea91 100644 Binary files a/domain/obj/Debug/net8.0/refint/domain.dll and b/domain/obj/Debug/net8.0/refint/domain.dll differ diff --git a/presence_api/Controllers/AdminController/AdminController.cs b/presence_api/Controllers/AdminController/AdminController.cs new file mode 100644 index 0000000..07b5b6b --- /dev/null +++ b/presence_api/Controllers/AdminController/AdminController.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using presence.domain.Models; +using presence.domain.UseCase; + +namespace presence_api.Controllers.UserController; + +[ApiController] +[Route("api/[admin]")] +public class AdminController: ControllerBase + { + private readonly UserUseCase _userUseCase; + private readonly GroupUseCase _groupUseCase; + private readonly PresenceUseCase _presenceUseCase; + + public AdminController(UserUseCase userUseCase, GroupUseCase groupUseCase, PresenceUseCase presenceUseCase) + { + _userUseCase = userUseCase; + _groupUseCase = groupUseCase; + _presenceUseCase = presenceUseCase; + } + } \ No newline at end of file diff --git a/presence_api/Controllers/PresenceController/PresenceController.cs b/presence_api/Controllers/PresenceController/PresenceController.cs new file mode 100644 index 0000000..6037c47 --- /dev/null +++ b/presence_api/Controllers/PresenceController/PresenceController.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using domain.Models.ResponseModels; +using Microsoft.AspNetCore.Mvc; +using presence.domain.Models; +using presence.domain.UseCase; + +namespace presence_api.Controllers.PresenceController; + +[ApiController] +[Route("api/[controller]")] +public class PresenceController: ControllerBase +{ + private readonly PresenceUseCase _presenceUseCase; + + public PresenceController(PresenceUseCase presenceUseCase) + { + _presenceUseCase = presenceUseCase; + } + + [HttpGet] + public ActionResult> GetPresence([FromQuery] int GroupId, + [FromQuery] string StartData, [FromQuery] string EndData, + [FromQuery] int UserId) + { + DateOnly startData; + DateOnly endData; + bool isParsed = DateOnly.TryParse(StartData, out startData); + bool isParse = DateOnly.TryParse(EndData, out endData); + if (!isParsed) + { + return BadRequest("Неверный формат даты начала."); + } + if (!isParse) + { + return BadRequest("Неверный формат даты конца."); + } + return Ok(_presenceUseCase.GetPresence(GroupId, startData, endData, UserId)); + } + + [HttpPost] + public ActionResult> PostPresence([FromQuery] int GroupId, + [FromQuery] string StartData, [FromQuery] string EndData, [FromQuery] int UserId) + { + return Ok(_presenceUseCase.AddPresence(StartData, EndData, GroupId)); + } + + [HttpDelete] + public ActionResult> DeletePresenceByGroup([FromQuery] int GroupId) + { + return Ok(_presenceUseCase.DeletePresenceByGroup(GroupId)); + } + + [HttpDelete] + public ActionResult> DeletePresenceByUser([FromQuery] int UserId) + { + return Ok(_presenceUseCase.DeletePresenceByUser(UserId)); + } + + [HttpDelete] + public ActionResult> DeletePresenceByDate([FromQuery] string StartData, [FromQuery] string EndData) + { + DateOnly startData; + DateOnly endData; + bool isParsed = DateOnly.TryParse(StartData, out startData); + bool isParse = DateOnly.TryParse(EndData, out endData); + if (!isParsed) + { + return BadRequest("Неверный формат даты начала."); + } + if (!isParse) + { + return BadRequest("Неверный формат даты конца."); + } + return Ok(_presenceUseCase.DeletePresenceByDate(startData, endData)); + } + + [HttpPost] + public ActionResult UpdateAttendance([FromQuery] int FirstClass, + [FromQuery] int LastClass, [FromQuery] string Data, + [FromQuery] int UserId) + { + DateOnly data; + bool isParsed = DateOnly.TryParse(Data, out data); + if (!isParsed) + { + return BadRequest("Неверный формат даты."); + } + return Ok(_presenceUseCase.UncheckAttendence(FirstClass, LastClass, data, UserId)); + } +} diff --git a/presence_api/Controllers/UserController/UserController.cs b/presence_api/Controllers/UserController/UserController.cs deleted file mode 100644 index 2d9963c..0000000 --- a/presence_api/Controllers/UserController/UserController.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using presence.domain.Models; -using presence.domain.UseCase; - -namespace presence_api.Controllers.UserController; - -[ApiController] -[Route("api/[controller]")] -public class UserController: ControllerBase - { - private readonly UserUseCase _userUseCase; - - public UserController(UserUseCase userUseCase) - { - _userUseCase = userUseCase; - } - - [HttpGet] - public ActionResult> GetAllUser() - { - return Ok(_userUseCase.GetAllUsers()); - } - } \ No newline at end of file diff --git a/presence_api/Program.cs b/presence_api/Program.cs index 87ab170..6a9e377 100644 --- a/presence_api/Program.cs +++ b/presence_api/Program.cs @@ -9,7 +9,8 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.ConfigureGroup(); -builder.Services.ConfigureUser(); +builder.Services.ConfigureAdmin(); +builder.Services.ConfigurePresence(); var app = builder.Build(); diff --git a/presence_api/ServiceExtensions/ServiceExtensions.cs b/presence_api/ServiceExtensions/ServiceExtensions.cs index a53c769..f2c28d4 100644 --- a/presence_api/ServiceExtensions/ServiceExtensions.cs +++ b/presence_api/ServiceExtensions/ServiceExtensions.cs @@ -22,5 +22,23 @@ namespace presence_api.ServiceExtensions .AddScoped() .AddScoped(); } + + public static void ConfigurePresence(this IServiceCollection services) + { + services + .AddScoped() + .AddScoped(); + } + + public static void ConfigureAdmin(this IServiceCollection services) + { + services + .AddScoped() + .AddScoped() + .AddScoped() + .AddScoped() + .AddScoped() + .AddScoped(); + } } } \ No newline at end of file diff --git a/presence_api/bin/Debug/net8.0/data.dll b/presence_api/bin/Debug/net8.0/data.dll index ea4ce75..587edfb 100644 Binary files a/presence_api/bin/Debug/net8.0/data.dll and b/presence_api/bin/Debug/net8.0/data.dll differ diff --git a/presence_api/bin/Debug/net8.0/data.pdb b/presence_api/bin/Debug/net8.0/data.pdb index 1baf166..42ceebb 100644 Binary files a/presence_api/bin/Debug/net8.0/data.pdb and b/presence_api/bin/Debug/net8.0/data.pdb differ diff --git a/presence_api/bin/Debug/net8.0/domain.dll b/presence_api/bin/Debug/net8.0/domain.dll index d2996b8..b60f9d9 100644 Binary files a/presence_api/bin/Debug/net8.0/domain.dll and b/presence_api/bin/Debug/net8.0/domain.dll differ diff --git a/presence_api/bin/Debug/net8.0/domain.pdb b/presence_api/bin/Debug/net8.0/domain.pdb index 12479d7..349c8dc 100644 Binary files a/presence_api/bin/Debug/net8.0/domain.pdb and b/presence_api/bin/Debug/net8.0/domain.pdb differ diff --git a/presence_api/bin/Debug/net8.0/presence_api.dll b/presence_api/bin/Debug/net8.0/presence_api.dll index 09c561f..8f38242 100644 Binary files a/presence_api/bin/Debug/net8.0/presence_api.dll and b/presence_api/bin/Debug/net8.0/presence_api.dll differ diff --git a/presence_api/bin/Debug/net8.0/presence_api.pdb b/presence_api/bin/Debug/net8.0/presence_api.pdb index cf2fd1a..4cd4129 100644 Binary files a/presence_api/bin/Debug/net8.0/presence_api.pdb and b/presence_api/bin/Debug/net8.0/presence_api.pdb differ diff --git a/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfo.cs b/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfo.cs index b7394c0..4da3777 100644 --- a/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfo.cs +++ b/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("presence_api")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4bdc422ce8c208f21ae34f3d9f1cc61a98a48a3c")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5b98b0036758c0bfbfd050b258dbaf603f2669f2")] [assembly: System.Reflection.AssemblyProductAttribute("presence_api")] [assembly: System.Reflection.AssemblyTitleAttribute("presence_api")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfoInputs.cache b/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfoInputs.cache index 497a24b..3f83609 100644 --- a/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfoInputs.cache +++ b/presence_api/obj/Debug/net8.0/presence_api.AssemblyInfoInputs.cache @@ -1 +1 @@ -d346aa73c391eb0ef182af766d6332e886a863e9a1d1a8b4618c0041ef8db1f6 +b64a32c4afcdd923cba00e274a519ae6a5efc835494f91bacc7cf08bf4992583 diff --git a/presence_api/obj/Debug/net8.0/presence_api.csproj.AssemblyReference.cache b/presence_api/obj/Debug/net8.0/presence_api.csproj.AssemblyReference.cache index 5766755..a3bfa9c 100644 Binary files a/presence_api/obj/Debug/net8.0/presence_api.csproj.AssemblyReference.cache and b/presence_api/obj/Debug/net8.0/presence_api.csproj.AssemblyReference.cache differ diff --git a/presence_api/obj/Debug/net8.0/presence_api.csproj.CoreCompileInputs.cache b/presence_api/obj/Debug/net8.0/presence_api.csproj.CoreCompileInputs.cache index f60c0d8..07a406b 100644 --- a/presence_api/obj/Debug/net8.0/presence_api.csproj.CoreCompileInputs.cache +++ b/presence_api/obj/Debug/net8.0/presence_api.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -6c572403d26fc1fb9b48c0e23b3616f42e8d5076d149940e6b0f5e2bd64da14b +14cfac9208e7f1e1bd6f6867da3895abc7d7237c391a4adda871de15fc41ad95 diff --git a/presence_api/obj/Debug/net8.0/presence_api.dll b/presence_api/obj/Debug/net8.0/presence_api.dll index 09c561f..8f38242 100644 Binary files a/presence_api/obj/Debug/net8.0/presence_api.dll and b/presence_api/obj/Debug/net8.0/presence_api.dll differ diff --git a/presence_api/obj/Debug/net8.0/presence_api.pdb b/presence_api/obj/Debug/net8.0/presence_api.pdb index cf2fd1a..4cd4129 100644 Binary files a/presence_api/obj/Debug/net8.0/presence_api.pdb and b/presence_api/obj/Debug/net8.0/presence_api.pdb differ diff --git a/presence_api/obj/Debug/net8.0/ref/presence_api.dll b/presence_api/obj/Debug/net8.0/ref/presence_api.dll index d61729c..6004a7f 100644 Binary files a/presence_api/obj/Debug/net8.0/ref/presence_api.dll and b/presence_api/obj/Debug/net8.0/ref/presence_api.dll differ diff --git a/presence_api/obj/Debug/net8.0/refint/presence_api.dll b/presence_api/obj/Debug/net8.0/refint/presence_api.dll index d61729c..6004a7f 100644 Binary files a/presence_api/obj/Debug/net8.0/refint/presence_api.dll and b/presence_api/obj/Debug/net8.0/refint/presence_api.dll differ diff --git a/ui/UserConsole.cs b/ui/UserConsole.cs index cfa8b8e..e7eae9f 100755 --- a/ui/UserConsole.cs +++ b/ui/UserConsole.cs @@ -26,7 +26,7 @@ namespace presence.ui StringBuilder userOutput = new StringBuilder(); foreach (var user in _userUseCase.GetAllUsers()) { - userOutput.AppendLine($"{user.Id}\t{user.FIO}\t{user.Group}"); + userOutput.AppendLine($"{user.Id}\t{user.FIO}\t{user.GroupId}"); } Console.WriteLine(userOutput); } diff --git a/ui/obj/Debug/net8.0/ui.AssemblyInfo.cs b/ui/obj/Debug/net8.0/ui.AssemblyInfo.cs index eca84b8..e86da84 100644 --- a/ui/obj/Debug/net8.0/ui.AssemblyInfo.cs +++ b/ui/obj/Debug/net8.0/ui.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("ui")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5b98b0036758c0bfbfd050b258dbaf603f2669f2")] [assembly: System.Reflection.AssemblyProductAttribute("ui")] [assembly: System.Reflection.AssemblyTitleAttribute("ui")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/ui/obj/Debug/net8.0/ui.AssemblyInfoInputs.cache b/ui/obj/Debug/net8.0/ui.AssemblyInfoInputs.cache index 04da69e..4a754e8 100644 --- a/ui/obj/Debug/net8.0/ui.AssemblyInfoInputs.cache +++ b/ui/obj/Debug/net8.0/ui.AssemblyInfoInputs.cache @@ -1 +1 @@ -20ed1ba88db46bd37bf95cc037aa54d55b6a60c0405520a36b7f26aec1c3e1fe +aae41bb0bff218b6d819a8588d8a08693e0dd4ef657786bcb45f29aa7e6facd9 diff --git a/ui/obj/Debug/net8.0/ui.csproj.AssemblyReference.cache b/ui/obj/Debug/net8.0/ui.csproj.AssemblyReference.cache index 16d1aa2..2b7d54f 100644 Binary files a/ui/obj/Debug/net8.0/ui.csproj.AssemblyReference.cache and b/ui/obj/Debug/net8.0/ui.csproj.AssemblyReference.cache differ