feat: 가계부·게시판 백엔드 API 구현
- com.sb.web 패키지로 재구성: account / auth / board / user / admin / common - 가계부(account): 내역(필터), 계좌·순자산, 예산, 분류, 정기 거래, 투자 포트폴리오 (종목·매매 이력, 이동평균 평단·실현/평가손익) - MyBatis + MariaDB + Redis 세션, BCrypt - 스키마 자동 초기화(db/*.sql, 멱등), 사용자별 데이터 격리(member_id) - 문서: docs/BACKEND.md, .env.example Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9243a41385
commit
2a2f81dc32
@@ -0,0 +1,83 @@
|
||||
package com.sb.web.admin.controller;
|
||||
|
||||
import com.sb.web.board.dto.BoardSettingRequest;
|
||||
import com.sb.web.board.dto.BoardSettingResponse;
|
||||
import com.sb.web.board.dto.TagCategoryRequest;
|
||||
import com.sb.web.board.dto.TagCategoryResponse;
|
||||
import com.sb.web.board.dto.TagRequest;
|
||||
import com.sb.web.board.dto.TagResponse;
|
||||
import com.sb.web.board.service.TagService;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 관리자 태그 관리 API. (/api/admin/** — AdminInterceptor 로 ADMIN 권한 필요)
|
||||
* GET /tag-categories 카테고리+태그 목록
|
||||
* POST /tag-categories 카테고리 생성
|
||||
* PUT /tag-categories/{id} 카테고리 수정
|
||||
* DELETE /tag-categories/{id} 카테고리 삭제(소속 태그 포함)
|
||||
* POST /tags 태그 생성
|
||||
* PUT /tags/{id} 태그 수정
|
||||
* DELETE /tags/{id} 태그 삭제
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/admin")
|
||||
@RequiredArgsConstructor
|
||||
public class AdminTagController {
|
||||
|
||||
private final TagService tagService;
|
||||
|
||||
@GetMapping("/tag-categories")
|
||||
public List<TagCategoryResponse> categories() {
|
||||
return tagService.listGrouped();
|
||||
}
|
||||
|
||||
@PostMapping("/tag-categories")
|
||||
public ResponseEntity<TagCategoryResponse> createCategory(@Valid @RequestBody TagCategoryRequest req) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(tagService.createCategory(req));
|
||||
}
|
||||
|
||||
@PutMapping("/tag-categories/{id}")
|
||||
public TagCategoryResponse updateCategory(@PathVariable Long id, @Valid @RequestBody TagCategoryRequest req) {
|
||||
return tagService.updateCategory(id, req);
|
||||
}
|
||||
|
||||
@DeleteMapping("/tag-categories/{id}")
|
||||
public ResponseEntity<Void> deleteCategory(@PathVariable Long id) {
|
||||
tagService.deleteCategory(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@PostMapping("/tags")
|
||||
public ResponseEntity<TagResponse> createTag(@Valid @RequestBody TagRequest req) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(tagService.createTag(req));
|
||||
}
|
||||
|
||||
@PutMapping("/tags/{id}")
|
||||
public TagResponse updateTag(@PathVariable Long id, @Valid @RequestBody TagRequest req) {
|
||||
return tagService.updateTag(id, req);
|
||||
}
|
||||
|
||||
@DeleteMapping("/tags/{id}")
|
||||
public ResponseEntity<Void> deleteTag(@PathVariable Long id) {
|
||||
tagService.deleteTag(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
/* ===== 게시판 설정 (사용할 태그 카테고리) ===== */
|
||||
|
||||
@GetMapping("/board-setting")
|
||||
public BoardSettingResponse boardSetting() {
|
||||
return tagService.getBoardSetting();
|
||||
}
|
||||
|
||||
@PutMapping("/board-setting")
|
||||
public BoardSettingResponse updateBoardSetting(@RequestBody BoardSettingRequest req) {
|
||||
return tagService.setBoardSetting(req.getTagCategoryId());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user