mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
Refactor: migrate Core -> Domain and reorganize projects
Large refactor that renames/moves core types into a new Govor.Domain surface and reorganizes the Application layer. Models, configurations, migrations and many files moved from Govor.Core/Govor.Data to Govor.Domain; numerous Application services, interfaces and implementations were relocated or added (authentication, friends, messages, medias, push notifications, user sessions, storage, synching, private chats, etc.). Tests updated to use Govor.Domain namespaces and adjusted project references (removed Govor.Data reference from API tests). Also updated API, Hub and mapping code and project files to reflect the new structure and naming. This is primarily a codebase-wide namespace and module reorganization to establish a Domain project and restructure application services.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using AutoMapper;
|
||||
using Govor.Application.Interfaces.Infrastructure.Extensions;
|
||||
using Govor.Application.Interfaces.UserSession;
|
||||
using Govor.Application.Infrastructure.Extensions;
|
||||
using Govor.Application.Users.UserSessions;
|
||||
using Govor.Contracts.DTOs;
|
||||
using Govor.Core.Repositories.PushTokens;
|
||||
using Govor.Data.Repositories.Exceptions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -43,7 +41,11 @@ public class SessionController : Controller
|
||||
try
|
||||
{
|
||||
var sessions = await _userSessionReader.GetAllSessionsAsync(_currentUserService.GetCurrentUserId());
|
||||
return Ok(_mapper.Map<List<SessionDto>>(sessions));
|
||||
|
||||
if(sessions.IsFailure)
|
||||
return NotFound(sessions.Error);
|
||||
|
||||
return Ok(_mapper.Map<List<SessionDto>>(sessions.Value));
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
@@ -65,8 +67,12 @@ public class SessionController : Controller
|
||||
if (sessionId == Guid.Empty)
|
||||
return BadRequest("Invalid sessionId.");
|
||||
|
||||
await _userSessionRevoker.CloseSessionByIdAsync(sessionId,
|
||||
var res = await _userSessionRevoker.CloseSessionByIdAsync(sessionId,
|
||||
_currentUserService.GetCurrentUserId());
|
||||
|
||||
if (res.IsFailure)
|
||||
return BadRequest(res.Error);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
@@ -79,11 +85,6 @@ public class SessionController : Controller
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
return Forbid(ex.Message);
|
||||
}
|
||||
catch (NotFoundException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
return NotFound(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, ex.Message);
|
||||
@@ -96,11 +97,14 @@ public class SessionController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
await _userSessionRevoker.CloseSessionByIdAsync(
|
||||
var res = await _userSessionRevoker.CloseSessionByIdAsync(
|
||||
_currentUserSessionService.GetUserSessionId(),
|
||||
_currentUserService.GetCurrentUserId());
|
||||
|
||||
return Ok();
|
||||
|
||||
if(res.IsFailure)
|
||||
return NotFound(res.Error);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
@@ -112,11 +116,6 @@ public class SessionController : Controller
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
return Forbid(ex.Message);
|
||||
}
|
||||
catch (NotFoundException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, ex.Message);
|
||||
return NotFound(ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, ex.Message);
|
||||
@@ -129,7 +128,11 @@ public class SessionController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
await _userSessionRevoker.CloseAllSessionsAsync(_currentUserService.GetCurrentUserId());
|
||||
var res = await _userSessionRevoker.CloseAllSessionsAsync(_currentUserService.GetCurrentUserId());
|
||||
|
||||
if(res.IsFailure)
|
||||
return NotFound(res.Error);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
|
||||
Reference in New Issue
Block a user