refactor: more consistent field names, also in STYLE.md
This commit is contained in:
parent
344a0071e5
commit
c77ee660ca
14 changed files with 86 additions and 71 deletions
|
@ -6,7 +6,7 @@ using Foxnouns.Backend.Services;
|
|||
|
||||
namespace Foxnouns.Backend.Jobs;
|
||||
|
||||
public class UserAvatarUpdateInvocable(DatabaseContext db, ObjectStorageService objectStorage, ILogger logger)
|
||||
public class UserAvatarUpdateInvocable(DatabaseContext db, ObjectStorageService objectStorageService, ILogger logger)
|
||||
: IInvocable, IInvocableWithPayload<AvatarUpdatePayload>
|
||||
{
|
||||
private readonly ILogger _logger = logger.ForContext<UserAvatarUpdateInvocable>();
|
||||
|
@ -36,13 +36,13 @@ public class UserAvatarUpdateInvocable(DatabaseContext db, ObjectStorageService
|
|||
image.Seek(0, SeekOrigin.Begin);
|
||||
var prevHash = user.Avatar;
|
||||
|
||||
await objectStorage.PutObjectAsync(Path(id, hash), image, "image/webp");
|
||||
await objectStorageService.PutObjectAsync(Path(id, hash), image, "image/webp");
|
||||
|
||||
user.Avatar = hash;
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
if (prevHash != null && prevHash != hash)
|
||||
await objectStorage.RemoveObjectAsync(Path(id, prevHash));
|
||||
await objectStorageService.RemoveObjectAsync(Path(id, prevHash));
|
||||
|
||||
_logger.Information("Updated avatar for user {UserId}", id);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class UserAvatarUpdateInvocable(DatabaseContext db, ObjectStorageService
|
|||
return;
|
||||
}
|
||||
|
||||
await objectStorage.RemoveObjectAsync(Path(user.Id, user.Avatar));
|
||||
await objectStorageService.RemoveObjectAsync(Path(user.Id, user.Avatar));
|
||||
|
||||
user.Avatar = null;
|
||||
await db.SaveChangesAsync();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue