팀 목록 조회 API 구현 및 피드백 반영 및 task 기능 구현#14
Open
coding-quokka101 wants to merge 5 commits into
Open
Conversation
feat: Add Team API endpoints for team management
🔧 Changes
팀 목록 조회 API 구현
팀 생성 API 구현
팀 선택 API 구현 (JWT 토큰에 teamId, memberId 추가)
팀 멤버 목록 조회 API 구현
팀 카테고리 목록 조회 API 구현
Labels: backend feature
📋 Title
feat: Implement JWT-based authentication and add team context support
🔧 Changes
TaskController.java: @RequestHeader("X-User-Id") → @AuthenticationPrincipal AuthUser 변경 (모든 Task/Comment API)
AuthUserResponse.java: userId, teamId, memberId 필드 추가
JWT 토큰으로 사용자 식별 및 팀 컨텍스트 자동 처리
클라이언트의 userId 조작 방지로 보안 강화
Labels: backend security enhancement
aaxx98
reviewed
Jan 2, 2026
aaxx98
reviewed
Jan 2, 2026
## 작업 내용 ### 1. 팀 생성 기능 구현 * 팀 생성 API 구현 (`POST /api/team`) * `Team`, `TeamResponse` 기반 팀 생성 로직 추가 * `TeamController`, `TeamService`, `TeamServiceImpl` 구성 * 팀 목록 조회 API와 연동되는 기본 팀 데이터 저장 구조 완성 ### 2. Task 수정 UX 개선 * Task 수정 모드(`isEditing === true`)일 때 **댓글 영역 숨김 처리** * Task 상세 조회 시 읽기 모드에서만 댓글 표시되도록 UI 분기 ### 3. Task 댓글 기능 개선 * 댓글 작성자 프로필 표시 (이니셜 아바타) * 댓글 작성자 이름을 **팀 멤버 정보(member)** 기반으로 표시 * 로그인 사용자(memberId)와 댓글 작성자 비교하여 * 본인 댓글에만 수정 / 삭제 버튼 노출 ### 4. 로그인 연동 (JWT 기반) Task 페이지를 JWT 기반 인증 방식으로 변경하여 게시판과 동일한 패턴으로 통일했습니다. * JWT 토큰 기반 로그인 사용자 정보 조회 (`getMe`) * userId가 아닌 **memberId 기준**으로 권한 및 작성자 판단 * Task, Comment, Creator 판단 로직을 팀 멤버 기준으로 통일 ### 5. 팀 멤버 기반 권한 관리 구조 정비 * Task 생성자 / 댓글 작성자 판단 시 `memberId` 사용 * 팀 멤버 목록(`members`)을 기준으로: * 댓글 작성자 이름 매핑 * 담당자(assignee) 표시 * 추후 팀 권한 관리 확장을 고려한 구조 정리 --- ## 상세 내용 ### 팀 생성 * 팀 이름, 설명을 받아 `Team` 엔티티 생성 및 저장 * 생성 시 `uuid`, `createdAt` 자동 세팅 * 팀 생성 완료 후 `TeamResponse` 반환 ### Task / Comment UI & 권한 * Task 수정 중에는 댓글이 노출되지 않도록 처리하여 UX 개선 * 댓글 영역에서: * 작성자 프로필 이니셜 표시 * 작성자 이름을 팀 멤버 기준으로 출력 * 로그인 사용자(memberId)와 댓글 creatorId 비교하여 * 본인 댓글만 수정 / 삭제 가능 --- ## 테스트 ### 팀 관련 * `POST /api/team` 요청으로 팀 정상 생성 확인 * 팀 생성 후 팀 목록 조회 API에서 생성된 팀 확인 ### Task / Comment * Task 수정 시 댓글 영역 미노출 확인 * Task 조회 모드에서 댓글 정상 표시 확인 * 댓글 작성 / 수정 / 삭제 정상 동작 확인 * 로그인 사용자에 따라 댓글 수정·삭제 버튼 노출 여부 확인 --- ## 참고 * 추후 팀 생성 시 **팀 생성자 멤버 초대** 추가 구현 해야함 --- ## Backend ✅ TaskController: 모든 API에서 @AuthenticationPrincipal AuthUser 사용 ✅ TaskService: JWT의 teamId/memberId로 Task 생성/수정 ✅ TeamController: /api/team/members 엔드포인트 추가 (기존 MemberService 활용) ✅ AuthUserResponse: 보안 강화 - teamUuid만 노출, userId/teamId 제거 ✅ Benefits JWT 기반 보안 강화 (teamId 클라이언트 조작 방지) 게시판과 동일한 패턴으로 코드 일관성 향상 중복 코드 제거 (member API 통일) 프론트에서 teamId 관리 불필요
1. ErrorCode 패턴 적용 TaskErrorCode.java 추가 (common/error/code/) RuntimeException → 공통 Exception 사용 Auth/Post/User와 동일한 패턴 2. Activity Log 개선 ID 대신 멤버 이름 표시 getMemberName() 헬퍼 메서드 추가
## 주요 변경사항
1. **팀 생성 시 생성자를 TeamMember로 자동 추가**
2. **멤버 초대 시스템 구현**
- 이메일로 초대
- 초대 목록 조회
- 초대 수락
## 신규 파일 (5개)
- `MemberInvite.java` - 초대 Entity
- `InviteMemberRequest/Response.java` - DTO
- `MemberInviteRepository.java` + JPA 구현
## 수정 파일 (5개)
- `TeamService/Impl` - 생성자 멤버 추가 + 초대 로직
- `TeamController` - AuthUser 주입 + 초대 API
- `TeamMemberRepository` - save 메서드 추가
- `MemberService` - 초대 관련 메서드
## API
```
POST /api/team # 팀 생성 (생성자 자동 등록)
POST /api/team/invites # 멤버 초대
GET /api/team/invites # 초대 목록
POST /api/team/invites/{id}/accept # 초대 수락
```
## 참고
- 프론트는 아직 구현 X
aaxx98
reviewed
Jan 7, 2026
Contributor
aaxx98
left a comment
There was a problem hiding this comment.
피드백 수정사항 확인했습니다! 감사합니다.
추가로 HttpStatus의 import 패키지 수정 부탁드려요~
aaxx98
approved these changes
Jan 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Add Team API endpoints for team management
🔧 Changes
팀 목록 조회 API 구현
팀 생성 API 구현
팀 선택 API 구현 (JWT 토큰에 teamId, memberId 추가)
팀 멤버 목록 조회 API 구현
팀 카테고리 목록 조회 API 구현
Labels: backend feature
📋 Title
feat: Implement JWT-based authentication and add team context support 🔧 Changes
TaskController.java: @RequestHeader("X-User-Id") → @AuthenticationPrincipal AuthUser 변경 (모든 Task/Comment API) AuthUserResponse.java: userId, teamId, memberId 필드 추가 JWT 토큰으로 사용자 식별 및 팀 컨텍스트 자동 처리
클라이언트의 userId 조작 방지로 보안 강화
Labels: backend security enhancement