Skip to content

Commit

Permalink
[api-server-v1] fix: DTO 어노테이션 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
gdtknight committed Oct 5, 2023
1 parent c03618c commit a85ef45
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.UUID;
import javax.persistence.Lob;
import kr.joberchip.core.block.*;
import kr.joberchip.core.page.SharePage;
import kr.joberchip.server.v1._utils.BlockType;
Expand All @@ -13,7 +14,7 @@ public record BlockResponseDTO(
BlockType type,
String title,
String description,
String src,
@Lob String src,
Integer x,
Integer y,
Integer w,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package kr.joberchip.server.v1.block.controller.dto;

import kr.joberchip.core.block.ImageBlock;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

public record ImageBlockDTO(
@RequestParam String title,
@RequestParam String description,
@RequestPart String title,
@RequestPart String description,
@RequestPart MultipartFile attachedImage,
@RequestParam Integer x,
@RequestParam Integer y,
@RequestParam Integer w,
@RequestParam Integer h,
@RequestParam Boolean visible) {
@RequestPart Integer x,
@RequestPart Integer y,
@RequestPart Integer w,
@RequestPart Integer h,
@RequestPart Boolean visible) {

public ImageBlock toEntity() {
return ImageBlock.of(title, description, x, y, w, h, visible);
return ImageBlock.of(title, description, x, y, w, h);
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package kr.joberchip.server.v1.block.controller.dto;

import kr.joberchip.core.block.LinkBlock;
import org.springframework.web.bind.annotation.RequestParam;

public record LinkBlockDTO(
@RequestParam String title,
@RequestParam String link,
@RequestParam Integer x,
@RequestParam Integer y,
@RequestParam Integer w,
@RequestParam Integer h,
@RequestParam Boolean visible) {
String title, String link, Integer x, Integer y, Integer w, Integer h, Boolean visible) {

public LinkBlock toEntity() {
return LinkBlock.of(title, link, x, y, w, h);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package kr.joberchip.server.v1.block.controller.dto;

import kr.joberchip.core.block.VideoBlock;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

public record VideoBlockDTO(
@RequestParam String title,
@RequestParam String description,
@RequestParam String videoLink,
@RequestPart String title,
@RequestPart String description,
@RequestPart String videoLink,
@RequestPart MultipartFile attachedVideo,
@RequestParam Integer x,
@RequestParam Integer y,
@RequestParam Integer w,
@RequestParam Integer h,
@RequestParam Boolean visible) {
@RequestPart Integer x,
@RequestPart Integer y,
@RequestPart Integer w,
@RequestPart Integer h,
@RequestPart Boolean visible) {

public VideoBlock toEntity() {
if (videoLink == null || "".equalsIgnoreCase(videoLink)) return VideoBlock.of(title, description, x, y, w, h);
if (videoLink == null || "".equalsIgnoreCase(videoLink))
return VideoBlock.of(title, description, x, y, w, h);

return VideoBlock.of(title, description, videoLink, x, y, w, h);
}
Expand Down

0 comments on commit a85ef45

Please sign in to comment.