-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Modagbul/fix/auth
Feat: 소모임 수정 및 요청 메서드
- Loading branch information
Showing
12 changed files
with
182 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/moing/backend/domain/team/application/dto/request/UpdateTeamRequest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.moing.backend.domain.team.application.dto.request; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.Size; | ||
|
||
@AllArgsConstructor | ||
@Builder | ||
@NoArgsConstructor | ||
@Getter | ||
public class UpdateTeamRequest { | ||
@NotBlank(message = "name 을 입력해 주세요.") | ||
@Size(min = 1, max = 10, message = "name 은 최소 1개, 최대 10개의 문자만 입력 가능합니다.") | ||
private String name; | ||
|
||
@NotBlank(message = "introduction 을 입력해 주세요.") | ||
@Size(min = 1, max = 300, message = "introduction 은 최소 1개, 최대 300개의 문자만 입력 가능합니다.") | ||
private String introduction; | ||
|
||
@NotBlank(message = "profileImgUrl 을 입력해 주세요.") | ||
private String profileImgUrl; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/moing/backend/domain/team/application/dto/response/UpdateTeamResponse.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.moing.backend.domain.team.application.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@Builder | ||
public class UpdateTeamResponse { | ||
private Long teamId; | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/moing/backend/domain/team/application/service/UpdateTeamUserCase.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.moing.backend.domain.team.application.service; | ||
|
||
import com.moing.backend.domain.member.domain.entity.Member; | ||
import com.moing.backend.domain.member.domain.service.MemberGetService; | ||
import com.moing.backend.domain.team.application.dto.request.UpdateTeamRequest; | ||
import com.moing.backend.domain.team.application.dto.response.UpdateTeamResponse; | ||
import com.moing.backend.domain.team.domain.entity.Team; | ||
import com.moing.backend.domain.team.domain.service.TeamGetService; | ||
import com.moing.backend.domain.team.exception.NotAuthByTeamException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class UpdateTeamUserCase { | ||
|
||
private final MemberGetService memberGetService; | ||
private final TeamGetService teamGetService; | ||
private final CheckLeaderUserCase checkLeaderUserCase; | ||
|
||
public UpdateTeamResponse updateTeam(UpdateTeamRequest updateTeamRequest, String socialId, Long teamId){ | ||
Member member = memberGetService.getMemberBySocialId(socialId); | ||
Team team=teamGetService.getTeamByTeamId(teamId); | ||
if (checkLeaderUserCase.isTeamLeader(member, team)) { | ||
team.updateTeam(updateTeamRequest.getName(), updateTeamRequest.getIntroduction(), updateTeamRequest.getProfileImgUrl()); | ||
} else { | ||
throw new NotAuthByTeamException(); | ||
} | ||
return new UpdateTeamResponse(team.getTeamId()); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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