-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] ํ์๊ฐ์ API ๊ตฌํ
- Loading branch information
Showing
43 changed files
with
727 additions
and
83 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
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/umc/networkingService/domain/branch/repository/BranchRepository.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,9 @@ | ||
package com.umc.networkingService.domain.branch.repository; | ||
|
||
import com.umc.networkingService.domain.branch.entity.Branch; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface BranchRepository extends JpaRepository<Branch, UUID> { | ||
} |
13 changes: 13 additions & 0 deletions
13
...n/java/com/umc/networkingService/domain/branch/repository/BranchUniversityRepository.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,13 @@ | ||
package com.umc.networkingService.domain.branch.repository; | ||
|
||
import com.umc.networkingService.domain.branch.entity.BranchUniversity; | ||
import com.umc.networkingService.domain.university.entity.University; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
public interface BranchUniversityRepository extends JpaRepository<BranchUniversity, UUID> { | ||
|
||
Optional<BranchUniversity> findByUniversityAndIsActive(University university, Boolean isActive); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/umc/networkingService/domain/branch/service/BranchService.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,9 @@ | ||
package com.umc.networkingService.domain.branch.service; | ||
|
||
import com.umc.networkingService.domain.branch.entity.Branch; | ||
import com.umc.networkingService.global.common.base.EntityLoader; | ||
|
||
import java.util.UUID; | ||
|
||
public interface BranchService extends EntityLoader<Branch, UUID> { | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/umc/networkingService/domain/branch/service/BranchServiceImpl.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,23 @@ | ||
package com.umc.networkingService.domain.branch.service; | ||
|
||
import com.umc.networkingService.domain.branch.entity.Branch; | ||
import com.umc.networkingService.domain.branch.repository.BranchRepository; | ||
import com.umc.networkingService.global.common.exception.ErrorCode; | ||
import com.umc.networkingService.global.common.exception.RestApiException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.UUID; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class BranchServiceImpl implements BranchService{ | ||
|
||
private final BranchRepository branchRepository; | ||
|
||
@Override | ||
public Branch loadEntity(UUID id) { | ||
return branchRepository.findById(id) | ||
.orElseThrow(() -> new RestApiException(ErrorCode.EMPTY_BRANCH)); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/umc/networkingService/domain/branch/service/BranchUniversityService.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,8 @@ | ||
package com.umc.networkingService.domain.branch.service; | ||
|
||
import com.umc.networkingService.domain.branch.entity.Branch; | ||
import com.umc.networkingService.domain.university.entity.University; | ||
|
||
public interface BranchUniversityService { | ||
Branch findBranchByUniversity(University university); | ||
} |
25 changes: 25 additions & 0 deletions
25
...ain/java/com/umc/networkingService/domain/branch/service/BranchUniversityServiceImpl.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,25 @@ | ||
package com.umc.networkingService.domain.branch.service; | ||
|
||
import com.umc.networkingService.domain.branch.entity.Branch; | ||
import com.umc.networkingService.domain.branch.repository.BranchUniversityRepository; | ||
import com.umc.networkingService.domain.university.entity.University; | ||
import com.umc.networkingService.global.common.exception.ErrorCode; | ||
import com.umc.networkingService.global.common.exception.RestApiException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class BranchUniversityServiceImpl implements BranchUniversityService { | ||
|
||
private final BranchUniversityRepository branchUniversityRepository; | ||
|
||
@Override | ||
public Branch findBranchByUniversity(University university) { | ||
|
||
return branchUniversityRepository.findByUniversityAndIsActive(university, Boolean.TRUE) | ||
.orElseThrow(() -> new RestApiException(ErrorCode.EMPTY_BRANCH)) | ||
.getBranch(); | ||
|
||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
src/main/java/com/umc/networkingService/domain/member/controller/MemberController.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,42 @@ | ||
package com.umc.networkingService.domain.member.controller; | ||
|
||
import com.umc.networkingService.config.security.auth.CurrentMember; | ||
import com.umc.networkingService.config.security.jwt.JwtTokenProvider; | ||
import com.umc.networkingService.domain.member.dto.request.MemberSignUpRequest; | ||
import com.umc.networkingService.domain.member.dto.response.MemberSignUpResponse; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.domain.member.entity.SocialType; | ||
import com.umc.networkingService.domain.member.repository.MemberRepository; | ||
import com.umc.networkingService.domain.member.service.MemberService; | ||
import com.umc.networkingService.global.common.base.BaseResponse; | ||
import com.umc.networkingService.global.common.enums.Role; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
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 = "๋ฉค๋ฒ API", description = "๋ฉค๋ฒ ๊ด๋ จ API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/members") | ||
public class MemberController { | ||
|
||
private final MemberService memberService; | ||
@Operation(summary = "ํ์๊ฐ์ API", description = "์ต์ด ๋ฉค๋ฒ ์ ๋ณด๋ฅผ ๋ฑ๋กํ๋ API์ ๋๋ค.") | ||
@ApiResponses( value = { | ||
@ApiResponse(responseCode = "COMMON200", description = "์ฑ๊ณต"), | ||
@ApiResponse(responseCode = "UNIVERSITY001", description = "๋ํ๊ต๋ช ์ ์๋ชป ์ ๋ ฅํ์์ ๊ฒฝ์ฐ ๋ฐ์"), | ||
@ApiResponse(responseCode = "BRANCH001", description = "๋ํ๊ต๊ฐ ์ง๋ถ๋ ์ฐ๊ฒฐ๋์ด ์์ง ์์ ๊ฒฝ์ฐ ๋ฐ์") | ||
}) | ||
@PostMapping | ||
public BaseResponse<MemberSignUpResponse> signUp(@CurrentMember Member member, | ||
@Valid @RequestBody MemberSignUpRequest request) { | ||
return BaseResponse.onSuccess(memberService.signUp(member, request)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/umc/networkingService/domain/member/dto/request/MemberSignUpRequest.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,30 @@ | ||
package com.umc.networkingService.domain.member.dto.request; | ||
|
||
import com.umc.networkingService.global.common.enums.Part; | ||
import com.umc.networkingService.global.common.enums.Semester; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MemberSignUpRequest { | ||
@NotBlank(message = "์ด๋ฆ์ ํ์ ์ ๋ ฅ๊ฐ์ ๋๋ค.") | ||
private String name; | ||
@NotBlank(message = "๋๋ค์์ ํ์ ์ ๋ ฅ๊ฐ์ ๋๋ค.") | ||
private String nickname; | ||
@Size(min = 1, message = "์ต์ 1๊ฐ์ ํํธ๋ฅผ ์ ํํด์ผ ํฉ๋๋ค.") | ||
private List<Part> parts; | ||
@Size(min = 1, message = "์ต์ 1๊ฐ์ ๊ธฐ์๋ฅผ ์ ํํด์ผ ํฉ๋๋ค.") | ||
private List<Semester> semesters; | ||
private String universityName; | ||
private List<String> campusPositions; | ||
private List<String> centerPositions; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSignUpResponse.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.umc.networkingService.domain.member.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
import java.util.UUID; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class MemberSignUpResponse { | ||
private UUID memberId; | ||
} |
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
Oops, something went wrong.