Archived
Add file upload routes.
This commit is contained in:
@@ -11,19 +11,25 @@ import org.codiki.core.entities.dto.UserDTO;
|
||||
import org.codiki.core.entities.persistence.User;
|
||||
import org.codiki.core.repositories.UserRepository;
|
||||
import org.codiki.core.security.TokenService;
|
||||
import org.codiki.core.services.FileUploadService;
|
||||
import org.codiki.core.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
public class AccountService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
/**
|
||||
* Check the user credentials and generate him a token if they are correct.
|
||||
*
|
||||
@@ -68,4 +74,12 @@ public class AccountService {
|
||||
"Le mot de passe saisi ne correspond pas au votre.");
|
||||
}
|
||||
}
|
||||
|
||||
public String uploadFile(final MultipartFile pFile) {
|
||||
return fileUploadService.uploadProfileImage(pFile);
|
||||
}
|
||||
|
||||
public Resource loadAvatar(final String pAvatarFileName) {
|
||||
return fileUploadService.loadAvatar(pAvatarFileName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user