Add Master Data

This commit is contained in:
Thanakarn Klangkasame
2025-10-10 16:22:06 +07:00
parent ad0d9e41ba
commit d4ab1cb592
55 changed files with 16058 additions and 197 deletions

View File

@@ -5,6 +5,7 @@ using AMREZ.EOP.Abstractions.Infrastructures.Common;
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
using AMREZ.EOP.Abstractions.Security;
using AMREZ.EOP.Contracts.DTOs.Authentications.Login;
using AMREZ.EOP.Domain.Entities.Authentications;
using Microsoft.AspNetCore.Http;
namespace AMREZ.EOP.Application.UseCases.Authentications
@@ -60,9 +61,15 @@ namespace AMREZ.EOP.Application.UseCases.Authentications
return null;
}
var roles = (user.UserRoles ?? Enumerable.Empty<UserRole>())
.Where(ur => ur.Role != null /*&& ur.Role.TenantId == user.TenantId*/) // ถ้า Role เป็น per-tenant ค่อยกรอง
.Select(ur => ur.Role!.Code)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
await _uow.CommitAsync(ct);
return new LoginResponse(user.Id, user.TenantId, email, tenantKey);
return new LoginResponse(user.Id, user.TenantId, email, tenantKey, roles);
}
catch
{