Skip to content

Commit

Permalink
Merge pull request #114 from Na-o-man/refact/#113/downloadTag_logic_r…
Browse files Browse the repository at this point in the history
…etactoring

[Refact] : 다운로드 태그 추가 시 사진의 url을 통해 업데이트 함
  • Loading branch information
bflykky authored Aug 13, 2024
2 parents 787bca3 + 06f8279 commit 6cb17da
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,18 @@ public List<Long> deletePhotoEsByShareGroupId(Long shareGroupId) {
}

//특정 사진에 특정 맴버 다운로드 태그 추가
public void addDownloadTag(List<PhotoEs> photoEs, Long memberId){
List<FieldValue> fieldValueList = photoEs.stream()
.map(photo -> FieldValue.of(photo.getName()))
public void addDownloadTag(List<String> photoUrlList, Long memberId){
List<FieldValue> fieldValueList = photoUrlList.stream()
.map(FieldValue::of)
.toList();
String routing = photoEs.get(0).getShareGroupId().toString();
Map<String, JsonData> params = new HashMap<>();
params.put("memberId", JsonData.of(memberId));
try {
elasticsearchClient.updateByQuery(u -> u
.index("photos_es")
.routing(routing)
.query(q -> q
.terms(t -> t
.field("name")
.field("url")
.terms(te -> te.value(fieldValueList))
)
)
Expand Down

0 comments on commit 6cb17da

Please sign in to comment.