-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGroupResponseMapper.java
More file actions
70 lines (65 loc) · 2.28 KB
/
GroupResponseMapper.java
File metadata and controls
70 lines (65 loc) · 2.28 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
68
69
70
package com.ggang.be.api.mapper;
import com.ggang.be.api.group.dto.GroupResponse;
import com.ggang.be.api.group.dto.NearestGroupResponse;
import com.ggang.be.domain.constant.GroupType;
import com.ggang.be.domain.group.everyGroup.dto.EveryGroupDto;
import com.ggang.be.domain.group.onceGroup.dto.OnceGroupDto;
import com.ggang.be.domain.group.vo.NearestGroup;
public record GroupResponseMapper() {
public static GroupResponse fromOnceGroup(OnceGroupDto dto) {
return new GroupResponse(
dto.groupId(),
GroupType.ONCE.toString(),
dto.groupTitle(),
dto.location(),
dto.status(),
dto.isHost(),
dto.isApply(),
dto.currentPeopleCount(),
dto.maxPeopleCount(),
dto.introduction(),
dto.category(),
dto.coverImg(),
dto.weekDay(),
dto.weekDate() != null ? dto.weekDate() : null,
dto.gongbaekTimeSlotEntity().getStartTime(),
dto.gongbaekTimeSlotEntity().getEndTime()
);
}
public static GroupResponse fromEveryGroup(EveryGroupDto dto) {
return new GroupResponse(
dto.groupId(),
GroupType.WEEKLY.toString(),
dto.title(),
dto.location(),
dto.status(),
dto.isHost(),
dto.isApply(),
dto.currentPeopleCount(),
dto.maxPeopleCount(),
dto.introduction(),
dto.category(),
dto.coverImg(),
dto.gongbaekTimeSlotEntity().getWeekDay(),
null,
dto.gongbaekTimeSlotEntity().getStartTime(),
dto.gongbaekTimeSlotEntity().getEndTime()
);
}
public static NearestGroupResponse toNearestGroupResponse(
NearestGroup nearestGroup) {
return new NearestGroupResponse(
nearestGroup.groupId(),
nearestGroup.category(),
nearestGroup.groupType(),
nearestGroup.groupTitle(),
nearestGroup.weekDay(),
nearestGroup.weekDate().toString(),
nearestGroup.currentPeopleCount(),
nearestGroup.maxPeopleCount(),
nearestGroup.startTime(),
nearestGroup.endTime(),
nearestGroup.location()
);
}
}