diff options
author | Vitaly Takmazov | 2021-10-23 08:09:05 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2021-10-23 08:10:06 +0300 |
commit | 4b96a9b2e71b7a67effdd55b26ca532ff849d0ef (patch) | |
tree | 597a9b268622a10b440f3b119c529e624b8fdb62 /src/main/java/com/juick/www/api/Users.java | |
parent | 6b31c254b5a7ab6735c625459ba7936d9b2851e6 (diff) |
ImagesService -> StorageService
img_path -> storage_path property
Diffstat (limited to 'src/main/java/com/juick/www/api/Users.java')
-rw-r--r-- | src/main/java/com/juick/www/api/Users.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/com/juick/www/api/Users.java b/src/main/java/com/juick/www/api/Users.java index 0294ec53..49a4494f 100644 --- a/src/main/java/com/juick/www/api/Users.java +++ b/src/main/java/com/juick/www/api/Users.java @@ -63,9 +63,7 @@ public class Users { @Inject private WebApp webApp; @Inject - private ImagesService imagesService; - @Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}") - private String tmpDir; + private StorageService storageService; @Inject private ApplicationEventPublisher applicationEventPublisher; @@ -168,9 +166,9 @@ public class Users { @PostMapping("/api/me/upload") public void updateInfo(@Visitor User visitor, @RequestParam MultipartFile avatar) throws IOException { - String avatarTmpPath = HttpUtils.receiveMultiPartFile(avatar, tmpDir).getHost(); + String avatarTmpPath = HttpUtils.receiveMultiPartFile(avatar, storageService.getTemporaryDirectory()).getHost(); if (StringUtils.isNotEmpty(avatarTmpPath)) { - imagesService.saveAvatar(avatarTmpPath, visitor.getUid()); + storageService.saveAvatar(avatarTmpPath, visitor); applicationEventPublisher.publishEvent(new UpdateUserEvent(this, visitor)); } } |