Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.going.server.domain.graph.controller;

import com.going.server.domain.graph.dto.graphDto;
import com.going.server.domain.graph.dto.graphListDto;
import com.going.server.domain.graph.service.graphService;
import com.going.server.global.response.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/graph")
@RequiredArgsConstructor
public class graphController {
private final graphService graphService;

@GetMapping()
@Operation(summary = "[메인화면] 그래프 리스트 조회", description = "메인화면에서 그래프 리스트를 조회합니다.")
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "그래프 리스트를 성공적으로 반환했습니다.",
content = @Content(
mediaType = "application/json",
schema = @Schema(example = "{\"message\":\"\"}")
)
)
})
public SuccessResponse<graphListDto> getGraphList() {
graphListDto result = graphService.getGraphList();
return SuccessResponse.of(result);
}

@DeleteMapping("/{graphId}")
@Operation(summary = "[메인화면] pdf파일 (지식그래프) 삭제", description = "워크 스페이스에서 지식 그래프 자체를 삭제하는 기능입니다.")
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "그래프가 성공적으로 삭제되었습니다.",
content = @Content(
mediaType = "application/json",
schema = @Schema(example = "{\"message\":\"\"}")
)
)
})
public SuccessResponse<?> deleteGraph(@PathVariable("graphId") Long graphId) {
graphService.deleteGraph(graphId);
return SuccessResponse.empty();
}

}
19 changes: 19 additions & 0 deletions src/main/java/com/going/server/domain/graph/dto/graphDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.going.server.domain.graph.dto;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Builder
public class graphDto {
private Long id;
private String title;
private Boolean easy;
private Boolean hard;

public static graphDto of(Long id, String title, Boolean easy, Boolean hard) {
return graphDto.builder().id(id).title(title).easy(easy).hard(hard).build();
}
}
17 changes: 17 additions & 0 deletions src/main/java/com/going/server/domain/graph/dto/graphListDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.going.server.domain.graph.dto;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
@Builder
public class graphListDto {
private List<graphDto> graph;
public static graphListDto of(List<graphDto> graph) {
return graphListDto.builder().graph(graph).build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.going.server.domain.graph.service;

import com.going.server.domain.graph.dto.graphDto;
import com.going.server.domain.graph.dto.graphListDto;

public interface graphService {
graphListDto getGraphList();
void deleteGraph(Long graphId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.going.server.domain.graph.service;

import com.going.server.domain.graph.dto.graphDto;
import com.going.server.domain.graph.dto.graphListDto;
import org.springframework.stereotype.Service;

@Service
public class graphServiceImpl implements graphService {

@Override
public graphListDto getGraphList() {
//TODO : DB에서 값 받아오는 코드 작성
return graphListDto.of(null);
}

@Override
public void deleteGraph(Long graphId) {
//TODO : graphId로 그래프 찾기
//TODO : 그래프 삭제하는 코드 작성
}
}