This commit is contained in:
2024-07-18 03:13:32 +07:00
parent d2eee41ed6
commit d9c3bfa35e
49 changed files with 3037 additions and 232 deletions

View File

@ -86,6 +86,7 @@ namespace Yuna.Website.Server.Services.DeviceService
if(propValue.TryGetDouble(out var value))
{
value = Math.Round(value, 2);
result.Add(prop.Id, value.ToString());
continue;
}
@ -123,5 +124,11 @@ namespace Yuna.Website.Server.Services.DeviceService
var result = await _deviceRepository.GetList();
return result ?? [];
}
public async Task<IReadOnlyList<Device>> GetList(long userId)
{
var result = await _deviceRepository.GetList(userId);
return result ?? [];
}
}
}

View File

@ -6,6 +6,7 @@ namespace Yuna.Website.Server.Services.DeviceService
{
public Task<Device?> GetById(long id);
public Task<IReadOnlyList<Device>> GetList();
public Task<IReadOnlyList<Device>> GetList(long userId);
public Task<Device?> Create(Device device);
//public Task<User?> Update(User user);
public Task<Device?> Delete(long id);

View File

@ -19,6 +19,7 @@ namespace Yuna.Website.Server.Services.TokenService
{
new(ClaimTypes.Name, user.UserName),
new(ClaimTypes.NameIdentifier, user.Id.ToString()),
new(ClaimTypes.Role, user.IsAdmin.ToString())
};
return new ClaimsIdentity(claims, "Cookies");