This commit is contained in:
@@ -46,13 +46,7 @@ public class YandexSearchService {
|
||||
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
|
||||
}
|
||||
|
||||
public YandexSearchResponse searchByFileEntity(String fileId) throws IOException {
|
||||
FileEntity fileEntity = fileEntityRepository.findById(fileId)
|
||||
.orElseThrow(() -> {
|
||||
throw new NotValidFieldException("File not found", new BaseResponse(20007,
|
||||
MessageCode.FILE_NOT_FOUND.getCode(), MessageCode.FILE_NOT_FOUND.getDescription(),
|
||||
Map.of("fileId",fileId)));
|
||||
});
|
||||
public YandexSearchResponse searchByFileEntity(FileEntity fileEntity) throws IOException {
|
||||
byte[] fileBytes;
|
||||
|
||||
if (!isImageFile(fileEntity)) {
|
||||
@@ -67,7 +61,7 @@ public class YandexSearchService {
|
||||
} catch (IOException e) {
|
||||
throw new NotValidFieldException("File not found or cannot read file", new BaseResponse(20007,
|
||||
MessageCode.FILE_NOT_FOUND.getCode(), MessageCode.FILE_NOT_FOUND.getDescription(),
|
||||
Map.of("fileId", fileId,
|
||||
Map.of("fileId", fileEntity.getId(),
|
||||
"filePath", fileEntity.getFilePath())));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user