-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSpDetailRes.java
More file actions
67 lines (64 loc) · 2.06 KB
/
SpDetailRes.java
File metadata and controls
67 lines (64 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.pitchain.sp.application.res;
import com.pitchain.common.annotation.S3Url;
import com.pitchain.sp.infrastucture.dto.SpWithLikeDto;
import com.pitchain.bm.domain.Bm;
import com.pitchain.company.domain.Company;
import com.pitchain.member.domain.Member;
import com.pitchain.sp.domain.Sp;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import java.util.List;
@Builder
public record SpDetailRes(
@NotNull
Long bmId,
@NotBlank
String bmName,
@NotBlank
@S3Url
String companyProfileImgURL,
@NotBlank
String companyName,
@NotBlank
String companyAddress,
@NotBlank
String spURL,
@NotBlank
@S3Url
String thumbnailImgURL,
@NotNull
Long views,
@NotBlank
String name,
@NotBlank
String mainCategory,
@NotNull
List<String> subCategories,
@NotNull
Boolean isLiked,
@NotNull
Long likeCnt
) {
public static SpDetailRes createRes(SpWithLikeDto spWithLikeDto, Long likeCnt, List<String> subCategories) {
Sp sp = spWithLikeDto.getSp();
Bm bm = sp.getBm();
Company company = bm.getCompany();
Member member = company.getMember();
return SpDetailRes.builder()
.bmId(sp.getBm().getId())
.bmName(bm.getName())
.companyProfileImgURL(member.getProfileImgKey()) //추후에 JSON 직렬화 처리됨
.companyName(member.getName())
.companyAddress(company.getAddress())
.spURL(sp.getSpKey())
.thumbnailImgURL(sp.getThumbnailImgKey()) //추후에 JSON 직렬화 처리됨
.views(sp.getViews())
.name(sp.getName())
.mainCategory(bm.getMainCategory().getKoreanName())
.subCategories(subCategories)
.isLiked(spWithLikeDto.isLiked())
.likeCnt(likeCnt)
.build();
}
}