Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
lvzb 10 months ago
parent
commit
e717da2da8
  1. 1
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application.Contracts/Departments/IDepartmentAppService.cs
  2. 21
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Departments/DepartmentAppService.cs

1
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application.Contracts/Departments/IDepartmentAppService.cs

@ -9,4 +9,5 @@ public interface IDepartmentAppService
{
Task<DepartmentDTO> GetByUsernameAsync(string username);
Task UpdateAsync(DepartmentCreateInput input);
Task<DepartmentDTO> GetByUserIdAsync(string userId);
}

21
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Departments/DepartmentAppService.cs

@ -49,6 +49,27 @@ public class DepartmentAppService
var deptDto = await GetByCodeAsync(departmentCode).ConfigureAwait(false);
return deptDto;
}
[AllowAnonymous]
[HttpGet("by-userid")]
public virtual async Task<DepartmentDTO> GetByUserIdAsync(string userId)
{
var user = await _identityUserManager.FindByIdAsync(userId).ConfigureAwait(false);
if (user == null)
{
return null;
}
var departmentCode = user.GetDepartmentCode();
if (string.IsNullOrEmpty(departmentCode))
{
return null;
}
var deptDto = await GetByCodeAsync(departmentCode).ConfigureAwait(false);
return deptDto;
}
[AllowAnonymous]
[HttpPost("update")]
public virtual async Task UpdateAsync(DepartmentCreateInput input)

Loading…
Cancel
Save