-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminController.java
More file actions
231 lines (218 loc) · 9.19 KB
/
AdminController.java
File metadata and controls
231 lines (218 loc) · 9.19 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
package com.acon.server.admin.api.controller;
import com.acon.server.admin.api.response.CsrfTokenResponse;
import com.acon.server.admin.api.response.DashboardResponse;
import com.acon.server.admin.application.service.AdminService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin")
public class AdminController {
private final AdminService adminService;
@GetMapping(path = "/csrf", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<CsrfTokenResponse> getCsrfToken(CsrfToken csrfToken) {
return ResponseEntity.ok(
CsrfTokenResponse.of(
csrfToken.getHeaderName(),
csrfToken.getParameterName(),
csrfToken.getToken()
)
);
}
@GetMapping(path = "/dashboard", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<DashboardResponse> getDashboard() {
return ResponseEntity.ok(adminService.getDashboard());
}
@GetMapping(path = "/spots", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSpots(
@RequestParam(required = false) String query,
@RequestParam(required = false) String queryTarget,
@RequestParam(required = false) List<String> status,
@RequestParam(required = false) String missingField) {
List<Map<String, Object>> spotList = List.of(
Map.of(
"id", 1L,
"userNickname", "김성민",
"spotName", "커피 리브레 서교동",
"spotStatus", "PENDING",
"spotType", "CAFE",
"updatedAt", "2025-08-06T10:00:00"
),
Map.of(
"id", 2L,
"userNickname", "김시은",
"spotName", "프릳츠 커피 컴퍼니 도화점",
"spotStatus", "PENDING",
"spotType", "CAFE",
"updatedAt", "2025-08-06T10:15:00"
),
Map.of(
"id", 3L,
"userNickname", "김유림",
"spotName", "빈브라더스 성수동",
"spotStatus", "PENDING",
"spotType", "CAFE",
"updatedAt", "2025-08-06T10:30:00"
),
Map.of(
"id", 4L,
"userNickname", "김창균",
"spotName", "스시효 청담",
"spotStatus", "PENDING",
"spotType", "RESTAURANT",
"updatedAt", "2025-08-06T10:45:00"
),
Map.of(
"id", 5L,
"userNickname", "박지현",
"spotName", "홍연참치 논현",
"spotStatus", "PENDING",
"spotType", "RESTAURANT",
"updatedAt", "2025-08-06T11:00:00"
),
Map.of(
"id", 6L,
"userNickname", "이상일",
"spotName", "리틀넥 성수 브런치",
"spotStatus", "PENDING",
"spotType", "RESTAURANT",
"updatedAt", "2025-08-06T11:15:00"
),
Map.of(
"id", 7L,
"userNickname", "이수민",
"spotName", "로리스 더 프라임 립 강남",
"spotStatus", "PENDING",
"spotType", "RESTAURANT",
"updatedAt", "2025-08-06T11:30:00"
)
);
return ResponseEntity.ok(Map.of("spotList", spotList));
}
@GetMapping(path = "/spots/{spotId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSpotDetail(@PathVariable Long spotId) {
Map<String, Object> response = new HashMap<>();
response.put("spotStatus", "PENDING");
response.put("spotId", 1L);
response.put("userNickname", "김성민");
response.put("updatedAt", "2025-08-06T14:30:00");
response.put("spotName", "커피 리브레 서교동");
response.put("address", "서울 마포구 서교동 453-32");
response.put("localAcornCount", 12);
response.put("basicAcornCount", 40);
response.put("spotType", "CAFE");
response.put("spotFeature", "WORK_FRIENDLY");
response.put("openingHourList", List.of(
Map.of(
"dayOfWeek", "MONDAY",
"closed", false,
"startTime", "10:00",
"endTime", "22:00",
"breakStartTime", "15:00",
"breakEndTime", "16:00"
),
Map.of(
"dayOfWeek", "TUESDAY",
"closed", false,
"startTime", "10:00",
"endTime", "22:00",
"breakStartTime", "15:00",
"breakEndTime", "16:00"
),
Map.of(
"dayOfWeek", "WEDNESDAY",
"closed", false,
"startTime", "10:00",
"endTime", "22:00",
"breakStartTime", "15:00",
"breakEndTime", "16:00"
),
Map.of(
"dayOfWeek", "THURSDAY",
"closed", false,
"startTime", "10:00",
"endTime", "22:00",
"breakStartTime", "15:00",
"breakEndTime", "16:00"
),
Map.of(
"dayOfWeek", "FRIDAY",
"closed", false,
"startTime", "10:00",
"endTime", "23:00",
"breakStartTime", "15:00",
"breakEndTime", "16:00"
),
Map.of(
"dayOfWeek", "SATURDAY",
"closed", false,
"startTime", "11:00",
"endTime", "23:00",
"breakStartTime", "16:00",
"breakEndTime", "17:00"
),
Map.of(
"dayOfWeek", "SUNDAY",
"closed", true
)
));
response.put("signatureMenuList", List.of(
Map.of(
"name", "콜드브루",
"price", 5500
),
Map.of(
"name", "수제 바닐라라떼",
"price", 6200
)
));
response.put("recommendedMenuList", List.of(
Map.of(
"name", "콜드브루",
"recommendationCount", 21
),
Map.of(
"name", "말차라떼",
"recommendationCount", 12
)
));
response.put("menuboardImageList", List.of(
"https://cdn.example.com/menu/menu_1_1.jpg",
"https://cdn.example.com/menu/menu_1_2.jpg"
));
response.put("spotImageList", List.of(
"https://cdn.example.com/spot/spot_1_1.jpg",
"https://cdn.example.com/spot/spot_1_2.jpg"
));
return ResponseEntity.ok(response);
}
@PatchMapping(path = "/spots/{spotId}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Void> updateSpotDetail(
@PathVariable Long spotId,
@RequestBody Map<String, Object> updateRequest) {
return ResponseEntity.ok().build();
}
@PostMapping(path = "/spots/{spotId}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Void> updateSpotStatus(
@PathVariable Long spotId,
@RequestBody Map<String, String> statusRequest) {
return ResponseEntity.ok().build();
}
}