-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/42organization/42gg.server.d…
…ev.v2 into dev
- Loading branch information
Showing
146 changed files
with
996 additions
and
235 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
8 changes: 8 additions & 0 deletions
8
gg-admin-repo/src/main/java/gg/admin/repo/comment/CommentAdminRepository.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 gg.admin.repo.comment; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import gg.data.party.Comment; | ||
|
||
public interface CommentAdminRepository extends JpaRepository<Comment, Long> { | ||
} |
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,22 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
group 'gg.auth' | ||
version '42gg' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
|
||
implementation 'io.jsonwebtoken:jjwt-api:0.11.2' | ||
implementation 'io.jsonwebtoken:jjwt-impl:0.11.2' | ||
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.2' | ||
|
||
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" | ||
|
||
testImplementation testFixtures(project(':gg-utils')) | ||
} |
2 changes: 1 addition & 1 deletion
2
...g/pingpong/api/user/user/dto/UserDto.java → gg-auth/src/main/java/gg/auth/UserDto.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
2 changes: 1 addition & 1 deletion
2
.../global/utils/argumentresolver/Login.java → .../java/gg/auth/argumentresolver/Login.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package gg.auth.config; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import gg.auth.argumentresolver.LoginMemberArgumentResolver; | ||
import gg.auth.utils.AuthTokenProvider; | ||
import gg.repo.user.UserRepository; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class AuthWebConfig implements WebMvcConfigurer { | ||
private final UserRepository userRepository; | ||
private final AuthTokenProvider tokenProvider; | ||
|
||
@Override | ||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { | ||
resolvers.add(new LoginMemberArgumentResolver(userRepository, tokenProvider)); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...rity/config/properties/AppProperties.java → ...ava/gg/auth/properties/AppProperties.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
4 changes: 2 additions & 2 deletions
4
...security/jwt/utils/AuthTokenProvider.java → ...java/gg/auth/utils/AuthTokenProvider.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
2 changes: 1 addition & 1 deletion
2
...pingpong/api/global/utils/HeaderUtil.java → ...c/main/java/gg/auth/utils/HeaderUtil.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package gg.pingpong.api.global.utils; | ||
package gg.auth.utils; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
package gg.data.party.type; | ||
|
||
import java.util.Locale; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum RoomType { | ||
OPEN, // Ordinal 0 | ||
START, // Ordinal 1 | ||
FINISH, // Ordinal 2 | ||
HIDDEN // Ordinal 3 | ||
OPEN("open", "방 시작 전"), | ||
START("live", "방 진행 중"), | ||
FINISH("end", "방 종료"), | ||
HIDDEN("end", "신고로 인한 가림 상태"), | ||
FAIL("end", "매칭 실패한 방"); | ||
|
||
private final String code; | ||
private final String desc; | ||
|
||
@JsonCreator | ||
public static RoomType getEnumFromValue(String value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
for (RoomType e : values()) { | ||
if (e.name().equals(value)) { | ||
return e; | ||
} else if (e.code.toUpperCase(Locale.ROOT).equals(value.toUpperCase(Locale.ROOT))) { | ||
return e; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
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
29 changes: 28 additions & 1 deletion
29
...gpong-api/src/main/java/gg/party/api/admin/comment/controller/CommentAdminController.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 |
---|---|---|
@@ -1,7 +1,34 @@ | ||
package gg.pingpong.api.party.admin.comment.controller; | ||
package gg.party.api.admin.comment.controller; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import gg.auth.UserDto; | ||
import gg.auth.argumentresolver.Login; | ||
import gg.party.api.admin.comment.controller.request.CommentUpdateAdminReqDto; | ||
import gg.party.api.admin.comment.service.CommentAdminService; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/party/admin/comments") | ||
public class CommentAdminController { | ||
private final CommentAdminService commentAdminService; | ||
|
||
/** | ||
* 댓글 숨김 | ||
* @param commentId 댓글 번호 | ||
* @return 숨김 성공 여부 | ||
*/ | ||
@PatchMapping("/{commentId}") | ||
public ResponseEntity<Void> hideComment(@PathVariable Long commentId, | ||
@RequestBody CommentUpdateAdminReqDto reqDto, @Login UserDto user) { | ||
commentAdminService.modifyHideComment(commentId, reqDto); | ||
return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...src/main/java/gg/party/api/admin/comment/controller/request/CommentUpdateAdminReqDto.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,10 @@ | ||
package gg.party.api.admin.comment.controller.request; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class CommentUpdateAdminReqDto { | ||
private Boolean isHidden; | ||
} |
29 changes: 29 additions & 0 deletions
29
gg-pingpong-api/src/main/java/gg/party/api/admin/comment/service/CommentAdminService.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,29 @@ | ||
package gg.party.api.admin.comment.service; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import gg.admin.repo.comment.CommentAdminRepository; | ||
import gg.data.party.Comment; | ||
import gg.party.api.admin.comment.controller.request.CommentUpdateAdminReqDto; | ||
import gg.utils.exception.party.CommentNotFoundException; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class CommentAdminService { | ||
private final CommentAdminRepository commentAdminRepository; | ||
|
||
/** | ||
* 댓글 숨김 | ||
* @param commentId 댓글 번호 | ||
* @exception CommentNotFoundException 유효하지 않은 댓글 | ||
*/ | ||
@Transactional | ||
public void modifyHideComment(Long commentId, CommentUpdateAdminReqDto reqDto) { | ||
Comment comment = commentAdminRepository.findById(commentId) | ||
.orElseThrow(CommentNotFoundException::new); | ||
comment.updateHidden(reqDto.getIsHidden()); | ||
} | ||
} |
54 changes: 53 additions & 1 deletion
54
gg-pingpong-api/src/main/java/gg/party/api/admin/room/controller/RoomAdminController.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 |
---|---|---|
@@ -1,7 +1,59 @@ | ||
package gg.pingpong.api.party.admin.room.controller; | ||
package gg.party.api.admin.room.controller; | ||
|
||
import javax.validation.Valid; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import gg.data.party.type.RoomType; | ||
import gg.party.api.admin.room.controller.request.RoomShowChangeReqDto; | ||
import gg.party.api.admin.room.controller.response.AdminRoomListResDto; | ||
import gg.party.api.admin.room.service.RoomAdminService; | ||
import gg.utils.exception.party.RoomNotFoundException; | ||
import gg.utils.exception.party.RoomStatNotFoundException; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/party/admin/rooms") | ||
public class RoomAdminController { | ||
|
||
private final RoomAdminService roomAdminService; | ||
|
||
/** | ||
* 방 Status 변경 | ||
* @param roomId 방 id | ||
* @param reqDto 바꿀 status | ||
* @exception RoomNotFoundException 유효하지 않은 방 입력 | ||
*/ | ||
@PatchMapping("/{roomId}") | ||
public ResponseEntity<Void> changeRoomVisibility(@PathVariable Long roomId, | ||
@Valid @RequestBody RoomShowChangeReqDto reqDto) throws RoomStatNotFoundException { | ||
|
||
RoomType roomType; | ||
try { | ||
roomType = RoomType.valueOf(reqDto.getStatus().toUpperCase()); | ||
} catch (IllegalArgumentException e) { | ||
throw new RoomStatNotFoundException(); | ||
} | ||
|
||
roomAdminService.modifyRoomStatus(roomId, roomType); | ||
return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); | ||
} | ||
|
||
/** | ||
* 방 전체 조회 | ||
* @return 방 정보 dto | ||
*/ | ||
@GetMapping | ||
public ResponseEntity<AdminRoomListResDto> adminAllRoomList() { | ||
AdminRoomListResDto adminRoomListResDto = roomAdminService.findAllRoomList(); | ||
return ResponseEntity.status(HttpStatus.OK).body(adminRoomListResDto); | ||
} | ||
} |
Oops, something went wrong.