260212_01_DOC: 프로젝트 전체에 구글 java 스타일 적용

This commit is contained in:
2026-02-12 11:24:10 +09:00
parent 6bd9b0902b
commit 774188088b
70 changed files with 3735 additions and 3388 deletions

View File

@@ -10,11 +10,18 @@ import com.kri.notihub.server.service.TemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
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.PutMapping;
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;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/api/v1/template")
@@ -22,69 +29,71 @@ import java.util.List;
@Tag(name = "Template", description = "템플릿 API")
public class TemplateController {
private final TemplateService templateService;
private final FileService fileService;
private final TemplateService templateService;
private final FileService fileService;
@Operation(summary = "템플릿 목록 조회")
@GetMapping("/list/{chnnlTy}/{itrntPrjctCd}")
public List<TemplateSummaryDto> getTemplateList(
@PathVariable ChannelType chnnlTy,
@PathVariable String itrntPrjctCd
) {
return templateService.getTemplateList(chnnlTy, itrntPrjctCd);
}
@Operation(summary = "템플릿 목록 조회")
@GetMapping("/list/{chnnlTy}/{itrntPrjctCd}")
public List<TemplateSummaryDto> getTemplateList(
@PathVariable ChannelType chnnlTy,
@PathVariable String itrntPrjctCd
) {
return templateService.getTemplateList(chnnlTy, itrntPrjctCd);
}
@Operation(summary = "템플릿 단건 조회")
@GetMapping("/{tmplatIdx}")
public TemplateDto getTemplate(@PathVariable long tmplatIdx) {
return templateService.getTemplate(tmplatIdx);
}
@Operation(summary = "템플릿 단건 조회")
@GetMapping("/{tmplatIdx}")
public TemplateDto getTemplate(@PathVariable long tmplatIdx) {
return templateService.getTemplate(tmplatIdx);
}
@Operation(summary = "템플릿 생성")
@PutMapping
public TemplateDto createTemplate(
@Valid @RequestBody TemplateBasicDto template,
RequestUserContext ctx
) {
TemplateDto newTmplat = templateService.createTemplate(template.getItrntPrjctCd(), template, ctx.getUserId());
@Operation(summary = "템플릿 생성")
@PutMapping
public TemplateDto createTemplate(
@Valid @RequestBody TemplateBasicDto template,
RequestUserContext ctx
) {
TemplateDto newTmplat = templateService.createTemplate(template.getItrntPrjctCd(), template,
ctx.getUserId());
String newHtml = fileService.syncOnSave(
newTmplat.getItrntPrjctCd(),
newTmplat.getTmplatIdx(),
newTmplat.getTmplatBody()
);
newTmplat.setTmplatBody(newHtml);
String newHtml = fileService.syncOnSave(
newTmplat.getItrntPrjctCd(),
newTmplat.getTmplatIdx(),
newTmplat.getTmplatBody()
);
newTmplat.setTmplatBody(newHtml);
templateService.updateTemplateBodyWithCreate(newTmplat);
templateService.updateTemplateBodyWithCreate(newTmplat);
return newTmplat;
}
return newTmplat;
}
@Operation(summary = "시나리오 이미지 업로드")
@PutMapping("/body-image/{itrntPrjctCd}")
public String uploadContactSenarioImage(@PathVariable String itrntPrjctCd, @RequestParam("file") MultipartFile file) {
return fileService.storeTempFile(itrntPrjctCd, file);
}
@Operation(summary = "시나리오 이미지 업로드")
@PutMapping("/body-image/{itrntPrjctCd}")
public String uploadContactSenarioImage(@PathVariable String itrntPrjctCd,
@RequestParam("file") MultipartFile file) {
return fileService.storeTempFile(itrntPrjctCd, file);
}
@Operation(summary = "템플릿 수정")
@PatchMapping
public TemplateDto updateTemplate(
@Valid @RequestBody TemplateDto template,
RequestUserContext ctx
) {
String newHtml = fileService.syncOnSave(
template.getItrntPrjctCd(),
template.getTmplatIdx(),
template.getTmplatBody()
);
template.setTmplatBody(newHtml);
@Operation(summary = "템플릿 수정")
@PatchMapping
public TemplateDto updateTemplate(
@Valid @RequestBody TemplateDto template,
RequestUserContext ctx
) {
String newHtml = fileService.syncOnSave(
template.getItrntPrjctCd(),
template.getTmplatIdx(),
template.getTmplatBody()
);
template.setTmplatBody(newHtml);
return templateService.updateTemplate(template, ctx.getUserId());
}
return templateService.updateTemplate(template, ctx.getUserId());
}
@Operation(summary = "템플릿 삭제(소프트 삭제)")
@DeleteMapping("/{tmplatIdx}")
public void deleteTemplate(@PathVariable long tmplatIdx, RequestUserContext ctx) {
templateService.deleteTemplate(tmplatIdx, ctx.getUserId());
}
@Operation(summary = "템플릿 삭제(소프트 삭제)")
@DeleteMapping("/{tmplatIdx}")
public void deleteTemplate(@PathVariable long tmplatIdx, RequestUserContext ctx) {
templateService.deleteTemplate(tmplatIdx, ctx.getUserId());
}
}