Logs
This commit is contained in:
parent
6c6c0936f5
commit
8d435f71b5
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3b6d3ae0b55a58f9494d04bfeb66c0114a08395")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6c6c0936f5e12ba65625b810a3751f41f19d78bc")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("console_ui")]
|
[assembly: System.Reflection.AssemblyProductAttribute("console_ui")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("console_ui")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("console_ui")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
93dfdc7e462970a4fa2b898ff569f4de22ebb6efb11b9d888e185341a38fc581
|
9b1464a1a381c026e523ead07c5c0bd2c1fc254caae642a9c0dc293c388a5267
|
||||||
|
Binary file not shown.
@ -23,6 +23,10 @@ namespace Demo.Data.Repository
|
|||||||
var allRecords = _remoteDatabaseContext.PresenceDaos.ToList();
|
var allRecords = _remoteDatabaseContext.PresenceDaos.ToList();
|
||||||
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
||||||
_remoteDatabaseContext.SaveChanges();
|
_remoteDatabaseContext.SaveChanges();
|
||||||
|
if (allRecords.Count == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +34,10 @@ namespace Demo.Data.Repository
|
|||||||
var allRecords = _remoteDatabaseContext.PresenceDaos.Where(x => x.userDAO.GroupID == groupID).ToList();
|
var allRecords = _remoteDatabaseContext.PresenceDaos.Where(x => x.userDAO.GroupID == groupID).ToList();
|
||||||
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
||||||
_remoteDatabaseContext.SaveChanges();
|
_remoteDatabaseContext.SaveChanges();
|
||||||
|
if (allRecords.Count == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,12 +46,20 @@ namespace Demo.Data.Repository
|
|||||||
var allRecords = _remoteDatabaseContext.PresenceDaos.Where(x => x.Date >= start && x.Date <= end).ToList();
|
var allRecords = _remoteDatabaseContext.PresenceDaos.Where(x => x.Date >= start && x.Date <= end).ToList();
|
||||||
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
||||||
_remoteDatabaseContext.SaveChanges();
|
_remoteDatabaseContext.SaveChanges();
|
||||||
|
if (allRecords.Count == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public bool DeletePresenceByUser(Guid userGuid){
|
public bool DeletePresenceByUser(Guid userGuid){
|
||||||
var allRecords = _remoteDatabaseContext.PresenceDaos.Where(x => x.userDAO.Guid == userGuid).ToList();
|
var allRecords = _remoteDatabaseContext.PresenceDaos.Where(x => x.userDAO.Guid == userGuid).ToList();
|
||||||
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
_remoteDatabaseContext.PresenceDaos.RemoveRange(allRecords);
|
||||||
_remoteDatabaseContext.SaveChanges();
|
_remoteDatabaseContext.SaveChanges();
|
||||||
|
if (allRecords.Count == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3b6d3ae0b55a58f9494d04bfeb66c0114a08395")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6c6c0936f5e12ba65625b810a3751f41f19d78bc")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("data")]
|
[assembly: System.Reflection.AssemblyProductAttribute("data")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Создано классом WriteCodeFragment MSBuild.
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
f258bbf320b2ab2f45e9951a8d2c1ff8ace7248d5e5c1d570f80701d61cb737b
|
1717865c1f3ea8eb394c6de25814487453eeb08c49cfa440b8caad21b340b555
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3b6d3ae0b55a58f9494d04bfeb66c0114a08395")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6c6c0936f5e12ba65625b810a3751f41f19d78bc")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
|
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Создано классом WriteCodeFragment MSBuild.
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
a97fc4fccec52337177679fc2cabe9bf83b4a407fbaa8b45e8ce331c9c202c1c
|
7cd83e005f219e7f461ddb8b33cfed5348a98ea55d97b78c917596cc14252493
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -11,10 +11,12 @@ public class AdminController: ControllerBase{
|
|||||||
private readonly GroupUseCase _groupUseCase;
|
private readonly GroupUseCase _groupUseCase;
|
||||||
private readonly UserUseCase _userUseCase;
|
private readonly UserUseCase _userUseCase;
|
||||||
private readonly PresenceUseCase _presenceUseCase;
|
private readonly PresenceUseCase _presenceUseCase;
|
||||||
public AdminController(GroupUseCase groupUseCase, UserUseCase userUseCase, PresenceUseCase presenceUseCase){
|
private readonly ILogger<PresenceController> _logger;
|
||||||
|
public AdminController(GroupUseCase groupUseCase, UserUseCase userUseCase, PresenceUseCase presenceUseCase, ILogger<PresenceController> logger){
|
||||||
_groupUseCase = groupUseCase;
|
_groupUseCase = groupUseCase;
|
||||||
_userUseCase = userUseCase;
|
_userUseCase = userUseCase;
|
||||||
_presenceUseCase = presenceUseCase;
|
_presenceUseCase = presenceUseCase;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
//post
|
//post
|
||||||
@ -23,6 +25,7 @@ public class AdminController: ControllerBase{
|
|||||||
{
|
{
|
||||||
if (request == null || string.IsNullOrEmpty(request.GroupName))
|
if (request == null || string.IsNullOrEmpty(request.GroupName))
|
||||||
{
|
{
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return BadRequest("Invalid request");
|
return BadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,10 +43,12 @@ public class AdminController: ControllerBase{
|
|||||||
[HttpDelete("user")]
|
[HttpDelete("user")]
|
||||||
public ActionResult<bool> DeleteUser(Guid userGuid){
|
public ActionResult<bool> DeleteUser(Guid userGuid){
|
||||||
if (userGuid == Guid.Empty){
|
if (userGuid == Guid.Empty){
|
||||||
|
_logger.LogWarning("Invalid request");
|
||||||
return BadRequest("Invalid request");
|
return BadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
bool isDeleted = _userUseCase.RemoveUserByGuid(userGuid);
|
bool isDeleted = _userUseCase.RemoveUserByGuid(userGuid);
|
||||||
if (isDeleted == false){
|
if (isDeleted == false){
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
@ -52,12 +57,14 @@ public class AdminController: ControllerBase{
|
|||||||
[HttpDelete("users")]
|
[HttpDelete("users")]
|
||||||
public ActionResult<bool> DeleteUsers([FromBody] DeleteUsersRequest request){
|
public ActionResult<bool> DeleteUsers([FromBody] DeleteUsersRequest request){
|
||||||
if (request == null){
|
if (request == null){
|
||||||
|
_logger.LogWarning("Invalid request");
|
||||||
return BadRequest("Invalid request");
|
return BadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
foreach (Guid userGuid in request.UsersGuid)
|
foreach (Guid userGuid in request.UsersGuid)
|
||||||
{
|
{
|
||||||
bool isDeleted = _userUseCase.RemoveUserByGuid(userGuid);
|
bool isDeleted = _userUseCase.RemoveUserByGuid(userGuid);
|
||||||
if (isDeleted == false){
|
if (isDeleted == false){
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,6 +75,7 @@ public class AdminController: ControllerBase{
|
|||||||
public ActionResult<bool> DeleteGroup(int GroupID){
|
public ActionResult<bool> DeleteGroup(int GroupID){
|
||||||
bool isDeleted = _groupUseCase.RemoveGroupByID(GroupID);
|
bool isDeleted = _groupUseCase.RemoveGroupByID(GroupID);
|
||||||
if (isDeleted == false){
|
if (isDeleted == false){
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return NotFound("Group not found");
|
return NotFound("Group not found");
|
||||||
}
|
}
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
@ -76,12 +84,14 @@ public class AdminController: ControllerBase{
|
|||||||
[HttpDelete("groups")]
|
[HttpDelete("groups")]
|
||||||
public ActionResult<bool> DeleteGroups([FromBody] DeleteGroupsRequest request){
|
public ActionResult<bool> DeleteGroups([FromBody] DeleteGroupsRequest request){
|
||||||
if (request == null){
|
if (request == null){
|
||||||
|
_logger.LogWarning("Invalid request");
|
||||||
return BadRequest("Invalid request");
|
return BadRequest("Invalid request");
|
||||||
}
|
}
|
||||||
foreach (int GroupID in request.GroupIDs)
|
foreach (int GroupID in request.GroupIDs)
|
||||||
{
|
{
|
||||||
bool isDeleted = _groupUseCase.RemoveGroupByID(GroupID);
|
bool isDeleted = _groupUseCase.RemoveGroupByID(GroupID);
|
||||||
if (isDeleted == false){
|
if (isDeleted == false){
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return NotFound("Group not found");
|
return NotFound("Group not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,6 +117,7 @@ public class AdminController: ControllerBase{
|
|||||||
if (user != null){
|
if (user != null){
|
||||||
return Ok(user);
|
return Ok(user);
|
||||||
} else{
|
} else{
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,12 @@ namespace presence_api.Controllers;
|
|||||||
|
|
||||||
public class PresenceController: ControllerBase{
|
public class PresenceController: ControllerBase{
|
||||||
private readonly PresenceUseCase _presenceUseCase;
|
private readonly PresenceUseCase _presenceUseCase;
|
||||||
|
private readonly ILogger<PresenceController> _logger;
|
||||||
|
|
||||||
public PresenceController(PresenceUseCase presenceUseCase)
|
public PresenceController(PresenceUseCase presenceUseCase, ILogger<PresenceController> logger)
|
||||||
{
|
{
|
||||||
_presenceUseCase = presenceUseCase;
|
_presenceUseCase = presenceUseCase;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get
|
//get
|
||||||
@ -37,6 +39,7 @@ public class PresenceController: ControllerBase{
|
|||||||
public ActionResult<bool> GeneratePresence([FromBody] PresencePost request)
|
public ActionResult<bool> GeneratePresence([FromBody] PresencePost request)
|
||||||
{
|
{
|
||||||
if (request == null){
|
if (request == null){
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
return BadRequest("buba");
|
return BadRequest("buba");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +54,11 @@ public class PresenceController: ControllerBase{
|
|||||||
public ActionResult<bool> DeletePresenceByGroup(int groupID)
|
public ActionResult<bool> DeletePresenceByGroup(int groupID)
|
||||||
{
|
{
|
||||||
var isDeleted = _presenceUseCase.DeletePresenceByGroup(groupID);
|
var isDeleted = _presenceUseCase.DeletePresenceByGroup(groupID);
|
||||||
|
if (isDeleted == false)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
|
return NotFound("buba");
|
||||||
|
}
|
||||||
return isDeleted;
|
return isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +66,11 @@ public class PresenceController: ControllerBase{
|
|||||||
public ActionResult<bool> DeletePresenceByUser(Guid userGuid)
|
public ActionResult<bool> DeletePresenceByUser(Guid userGuid)
|
||||||
{
|
{
|
||||||
var isDeleted = _presenceUseCase.DeletePresenceByUser(userGuid);
|
var isDeleted = _presenceUseCase.DeletePresenceByUser(userGuid);
|
||||||
|
if (isDeleted == false)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
|
return NotFound("buba");
|
||||||
|
}
|
||||||
return isDeleted;
|
return isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +80,11 @@ public class PresenceController: ControllerBase{
|
|||||||
DateOnly.TryParse(request.start, out DateOnly start);
|
DateOnly.TryParse(request.start, out DateOnly start);
|
||||||
DateOnly.TryParse(request.end, out DateOnly end);
|
DateOnly.TryParse(request.end, out DateOnly end);
|
||||||
var isDeleted = _presenceUseCase.DeletePresenceByRange(start, end);
|
var isDeleted = _presenceUseCase.DeletePresenceByRange(start, end);
|
||||||
|
if (isDeleted == false)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
|
return NotFound("buba");
|
||||||
|
}
|
||||||
return isDeleted;
|
return isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +94,12 @@ public class PresenceController: ControllerBase{
|
|||||||
public ActionResult<bool> UpdatePresence([FromBody] PresenceUpdate request)
|
public ActionResult<bool> UpdatePresence([FromBody] PresenceUpdate request)
|
||||||
{
|
{
|
||||||
DateOnly.TryParse(request.date, out DateOnly date);
|
DateOnly.TryParse(request.date, out DateOnly date);
|
||||||
var isDeleted = _presenceUseCase.IsAttedance(request.firstLesson, request.lastLesson, date, request.UserGuid);
|
var isUpdated = _presenceUseCase.IsAttedance(request.firstLesson, request.lastLesson, date, request.UserGuid);
|
||||||
return isDeleted;
|
if (isUpdated == false)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("NotFound");
|
||||||
|
return NotFound("buba");
|
||||||
|
}
|
||||||
|
return isUpdated;
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("presence_api")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("presence_api")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3b6d3ae0b55a58f9494d04bfeb66c0114a08395")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6c6c0936f5e12ba65625b810a3751f41f19d78bc")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("presence_api")]
|
[assembly: System.Reflection.AssemblyProductAttribute("presence_api")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("presence_api")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("presence_api")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Создано классом WriteCodeFragment MSBuild.
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
059e4fe3c040ba5e4de8059d5b0cbbf5144c8ae5437fd528809cae631559f787
|
ad0d9bd61813c0a35cbd8c85f8db96d734d0fcd658f5913b10790b5aa3eb50a5
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f3b6d3ae0b55a58f9494d04bfeb66c0114a08395")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6c6c0936f5e12ba65625b810a3751f41f19d78bc")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
|
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
da14eec68cbfc6fa33052b5f9e0c191fa5b6056cb645bca6e358d4f9d8de0ffc
|
e3e671f79a52a9b1ef470e4e04498c35d6e044563001e3cff33e3856f43c8bd1
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user