Skip to content

Commit b4f8300

Browse files
authored
✨ [feat] 메인화면 그래프 관련 api 구조 셋팅 (#48)
* 🔨 [setting] 그래프 리스트 조회 api 구조 셋팅 * 📝 [comment]스웨거 문서화를 위한 코드 작성 * 🔨 [setting]그래프 삭제 api 코드 구조 셋팅
1 parent 16bb880 commit b4f8300

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.going.server.domain.graph.controller;
2+
3+
import com.going.server.domain.graph.dto.graphDto;
4+
import com.going.server.domain.graph.dto.graphListDto;
5+
import com.going.server.domain.graph.service.graphService;
6+
import com.going.server.global.response.SuccessResponse;
7+
import io.swagger.v3.oas.annotations.Operation;
8+
import io.swagger.v3.oas.annotations.media.Content;
9+
import io.swagger.v3.oas.annotations.media.Schema;
10+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
11+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
12+
import lombok.RequiredArgsConstructor;
13+
import org.springframework.web.bind.annotation.*;
14+
15+
@RestController
16+
@RequestMapping("/graph")
17+
@RequiredArgsConstructor
18+
public class graphController {
19+
private final graphService graphService;
20+
21+
@GetMapping()
22+
@Operation(summary = "[메인화면] 그래프 리스트 조회", description = "메인화면에서 그래프 리스트를 조회합니다.")
23+
@ApiResponses({
24+
@ApiResponse(
25+
responseCode = "200",
26+
description = "그래프 리스트를 성공적으로 반환했습니다.",
27+
content = @Content(
28+
mediaType = "application/json",
29+
schema = @Schema(example = "{\"message\":\"\"}")
30+
)
31+
)
32+
})
33+
public SuccessResponse<graphListDto> getGraphList() {
34+
graphListDto result = graphService.getGraphList();
35+
return SuccessResponse.of(result);
36+
}
37+
38+
@DeleteMapping("/{graphId}")
39+
@Operation(summary = "[메인화면] pdf파일 (지식그래프) 삭제", description = "워크 스페이스에서 지식 그래프 자체를 삭제하는 기능입니다.")
40+
@ApiResponses({
41+
@ApiResponse(
42+
responseCode = "200",
43+
description = "그래프가 성공적으로 삭제되었습니다.",
44+
content = @Content(
45+
mediaType = "application/json",
46+
schema = @Schema(example = "{\"message\":\"\"}")
47+
)
48+
)
49+
})
50+
public SuccessResponse<?> deleteGraph(@PathVariable("graphId") Long graphId) {
51+
graphService.deleteGraph(graphId);
52+
return SuccessResponse.empty();
53+
}
54+
55+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.going.server.domain.graph.dto;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
@Getter
8+
@Setter
9+
@Builder
10+
public class graphDto {
11+
private Long id;
12+
private String title;
13+
private Boolean easy;
14+
private Boolean hard;
15+
16+
public static graphDto of(Long id, String title, Boolean easy, Boolean hard) {
17+
return graphDto.builder().id(id).title(title).easy(easy).hard(hard).build();
18+
}
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.going.server.domain.graph.dto;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.List;
8+
9+
@Getter
10+
@Setter
11+
@Builder
12+
public class graphListDto {
13+
private List<graphDto> graph;
14+
public static graphListDto of(List<graphDto> graph) {
15+
return graphListDto.builder().graph(graph).build();
16+
}
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.going.server.domain.graph.service;
2+
3+
import com.going.server.domain.graph.dto.graphDto;
4+
import com.going.server.domain.graph.dto.graphListDto;
5+
6+
public interface graphService {
7+
graphListDto getGraphList();
8+
void deleteGraph(Long graphId);
9+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.going.server.domain.graph.service;
2+
3+
import com.going.server.domain.graph.dto.graphDto;
4+
import com.going.server.domain.graph.dto.graphListDto;
5+
import org.springframework.stereotype.Service;
6+
7+
@Service
8+
public class graphServiceImpl implements graphService {
9+
10+
@Override
11+
public graphListDto getGraphList() {
12+
//TODO : DB에서 값 받아오는 코드 작성
13+
return graphListDto.of(null);
14+
}
15+
16+
@Override
17+
public void deleteGraph(Long graphId) {
18+
//TODO : graphId로 그래프 찾기
19+
//TODO : 그래프 삭제하는 코드 작성
20+
}
21+
}

0 commit comments

Comments
 (0)