diff options
author | crupest <crupest@outlook.com> | 2021-01-07 20:12:00 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-01-07 20:12:00 +0800 |
commit | ffe44ba70c9e5c6a01179c7e2f4185543cbc441c (patch) | |
tree | 67128b91d6cfd08c54c9e745e7bf2abbdf1f20f4 /BackEnd/Timeline/Services/UserService.cs | |
parent | 5ad1b1f0191ee1131e7808c8fcb0484ba29c0d4d (diff) | |
download | timeline-ffe44ba70c9e5c6a01179c7e2f4185543cbc441c.tar.gz timeline-ffe44ba70c9e5c6a01179c7e2f4185543cbc441c.tar.bz2 timeline-ffe44ba70c9e5c6a01179c7e2f4185543cbc441c.zip |
refactor: Make mapper a service. Fix #202.
Diffstat (limited to 'BackEnd/Timeline/Services/UserService.cs')
-rw-r--r-- | BackEnd/Timeline/Services/UserService.cs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/BackEnd/Timeline/Services/UserService.cs b/BackEnd/Timeline/Services/UserService.cs index d341759c..288d208c 100644 --- a/BackEnd/Timeline/Services/UserService.cs +++ b/BackEnd/Timeline/Services/UserService.cs @@ -115,7 +115,7 @@ namespace Timeline.Services public async Task<UserEntity> GetUser(long id)
{
- var user = await _databaseContext.Users.Where(u => u.Id == id).Include(u => u.Permissions).SingleOrDefaultAsync();
+ var user = await _databaseContext.Users.Where(u => u.Id == id).SingleOrDefaultAsync();
if (user == null)
throw new UserNotExistException(id);
@@ -125,7 +125,7 @@ namespace Timeline.Services public async Task<List<UserEntity>> GetUsers()
{
- return await _databaseContext.Users.Include(u => u.Permissions).ToListAsync();
+ return await _databaseContext.Users.ToListAsync();
}
public async Task<UserEntity> CreateUser(string username, string password)
@@ -153,8 +153,6 @@ namespace Timeline.Services _logger.LogInformation(Log.Format(LogDatabaseCreate, ("Id", newEntity.Id), ("Username", username)));
- await _databaseContext.Entry(newEntity).Collection(e => e.Permissions).LoadAsync();
-
return newEntity;
}
@@ -172,7 +170,7 @@ namespace Timeline.Services CheckNicknameFormat(param.Nickname, nameof(param));
}
- var entity = await _databaseContext.Users.Where(u => u.Id == id).Include(u => u.Permissions).SingleOrDefaultAsync();
+ var entity = await _databaseContext.Users.Where(u => u.Id == id).SingleOrDefaultAsync();
if (entity == null)
throw new UserNotExistException(id);
|