diff --git a/src/main/java/com/neorang/neims/issue/domain/Label.java b/src/main/java/com/neorang/neims/issue/domain/Label.java index ce3355b..7f298cb 100644 --- a/src/main/java/com/neorang/neims/issue/domain/Label.java +++ b/src/main/java/com/neorang/neims/issue/domain/Label.java @@ -1,12 +1,18 @@ package com.neorang.neims.issue.domain; import com.neorang.neims.globals.BaseEntity; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; import javax.persistence.*; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) public class Label extends BaseEntity { @Id @@ -21,4 +27,11 @@ public class Label extends BaseEntity { @Enumerated(EnumType.STRING) private Color color; + @Builder + public Label(long labelId, String label, Color color) { + this.labelId = labelId; + this.label = label; + this.color = color; + } + } diff --git a/src/main/java/com/neorang/neims/issue/dto/LabelForm.java b/src/main/java/com/neorang/neims/issue/dto/LabelForm.java new file mode 100644 index 0000000..a19b606 --- /dev/null +++ b/src/main/java/com/neorang/neims/issue/dto/LabelForm.java @@ -0,0 +1,32 @@ +package com.neorang.neims.issue.dto; + +import com.neorang.neims.issue.domain.Color; +import com.neorang.neims.issue.domain.Label; +import lombok.Builder; +import lombok.Getter; + +@Getter +public class LabelForm { + + private long labelId; + + private String label; + + private Color color; + + @Builder + public LabelForm(long labelId, String label, Color color) { + this.labelId = labelId; + this.label = label; + this.color = color; + } + + public Label toEntity() { + return Label.builder() + .labelId(labelId) + .label(label) + .color(color) + .build(); + } + +} diff --git a/src/main/java/com/neorang/neims/issue/repository/LabelRepository.java b/src/main/java/com/neorang/neims/issue/repository/LabelRepository.java new file mode 100644 index 0000000..ba816b6 --- /dev/null +++ b/src/main/java/com/neorang/neims/issue/repository/LabelRepository.java @@ -0,0 +1,7 @@ +package com.neorang.neims.issue.repository; + +import com.neorang.neims.issue.domain.Label; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface LabelRepository extends JpaRepository { +} diff --git a/src/main/java/com/neorang/neims/issue/service/LabelService.java b/src/main/java/com/neorang/neims/issue/service/LabelService.java new file mode 100644 index 0000000..4bf3c10 --- /dev/null +++ b/src/main/java/com/neorang/neims/issue/service/LabelService.java @@ -0,0 +1,16 @@ +package com.neorang.neims.issue.service; + +import com.neorang.neims.issue.domain.Label; +import com.neorang.neims.issue.dto.LabelForm; + +public interface LabelService { + + Label create(LabelForm form); + + Label update(LabelForm form); + + Label findById(long issueId); + + void delete(long issueId); + +} diff --git a/src/test/java/com/neorang/neims/issue/service/LabelServiceTest.java b/src/test/java/com/neorang/neims/issue/service/LabelServiceTest.java new file mode 100644 index 0000000..b42c954 --- /dev/null +++ b/src/test/java/com/neorang/neims/issue/service/LabelServiceTest.java @@ -0,0 +1,31 @@ +package com.neorang.neims.issue.service; + +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@Slf4j +@SpringBootTest +class LabelServiceTest { + + @Autowired + LabelService labelService; + + @Test + void create() { + } + + @Test + void update() { + } + + @Test + void findById() { + } + + @Test + void delete() { + } + +} \ No newline at end of file