Skip to content

Commit

Permalink
feat: Team 도메인 수정 및 일급 컬렉션화 (9oormthon-univ#18) (9oormthon-univ#19)
Browse files Browse the repository at this point in the history
* feat: 결제 기능 요구사항 반영

* feat: Team 도메인 수정 및 일급 컬렉션화 (#3)
  • Loading branch information
LEEJaeHyeok97 authored Nov 18, 2024
1 parent e3c17c4 commit ba8331b
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.jangburich.domain.team.application;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class TeamService {


}
16 changes: 16 additions & 0 deletions src/main/java/com/jangburich/domain/team/domain/Team.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.jangburich.domain.team.domain;

import jakarta.persistence.Embedded;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -29,12 +32,25 @@ public class Team extends BaseEntity {
@Column(name = "name")
private String name;

@Column(name = "description")
private String description;

@Column(name = "secret_code")
private String secretCode;

@Embedded
private TeamLeader teamLeader;

@Column(name = "point")
private Integer point;

@Column(name = "member_limit")
private Integer memberLimit;

@Enumerated(EnumType.STRING)
@Column(name = "team_type")
private TeamType teamType;

@ManyToMany(mappedBy = "teams")
private Set<User> users = new HashSet<>();

Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/jangburich/domain/team/domain/TeamLeader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.jangburich.domain.team.domain;

import jakarta.persistence.Embeddable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;

@Embeddable
@Getter
@NoArgsConstructor
public class TeamLeader {
private Long user_id;
private String accountNumber;

public TeamLeader(Long user_id, String accountNumber) {
this.user_id = user_id;
this.accountNumber = accountNumber;
}

public boolean isSameLeader(Long userId) {
return this.user_id.equals(userId);
}
}
22 changes: 22 additions & 0 deletions src/main/java/com/jangburich/domain/team/domain/TeamType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.jangburich.domain.team.domain;

public enum TeamType {
INDIVIDUAL("개인"),
GATHERING("모임"),
FAMILY("가족"),
COMPANY("회사"),
CLUB("동아리"),
ALUMNI("동호회"),
STUDENT_ASSOCIATION("학생회"),
OTHER("기타");

private final String description;

TeamType(String description) {
this.description = description;
}

public String getDescription() {
return description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.jangburich.domain.team.dto.request;

public record RegisterTeamRequest() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.jangburich.domain.team.presentation;

import com.jangburich.domain.team.application.TeamService;
import com.jangburich.domain.team.dto.request.RegisterTeamRequest;
import com.jangburich.global.payload.Message;
import com.jangburich.global.payload.ResponseCustom;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Team", description = "Team API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/teams")
public class TeamController {

private final TeamService teamService;

@PostMapping
public ResponseCustom<Message> registerTeam(
Authentication authentication,
@RequestBody RegisterTeamRequest registerTeamRequest
) {
return ResponseCustom.OK();
}
}

0 comments on commit ba8331b

Please sign in to comment.