Skip to content

Commit

Permalink
[Merge] recruit-dev <- dev merge (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimhan-nah authored Mar 30, 2024
2 parents 307954e + 45e83f3 commit e4be599
Show file tree
Hide file tree
Showing 92 changed files with 3,198 additions and 518 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build/
gg-pingpong-api/src/main/resources/application.yml
.DS_Store
python
/logs
**/logs


### STS ###
Expand Down
128 changes: 103 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@ https://42gg.kr/

- 4기: 2023.08.01 ~ 2023.09.21

- 5기 : 2023.11.01 ~ 2024.01.31

## ⚡️ 프로젝트 아키텍처
<img alt="systemArchitecture" src="https://github.com/42organization/42gg.server.dev.v2/assets/67796301/c51e8d73-d8f2-4f5e-935c-325ec263857e" >&nbsp;&nbsp;&nbsp;&nbsp;
![gg-5th-architecture](https://github.com/42organization/42gg.server.dev.v2/assets/33301153/f801e7b5-d579-467b-9ad0-2bfec506dcaa)



## ⚡️ 3기 진행 사항
## ⚡️ 팀소개
### 3기
<details>
<summary> 3기 진행 사항</summary>
<div markdown="1">

### ⚡️⚡ 로그인 연동 추가
- v1에서 지원하지 않던 카카오계정 연동 기능 추가(좌 : v1, 우: v2) </br></br>
Expand Down Expand Up @@ -77,30 +85,9 @@ https://42gg.kr/
<img width=80% alt="dockerPs" src="https://github.com/42organization/42gg.server.dev.v2/assets/67796301/7da03342-14ed-47c7-9183-a68ad663109c" >&nbsp;&nbsp;&nbsp;&nbsp;
</div>

## ⚡️ 4기 진행 사항
### ⚡️⚡ DB table 구조 변경
- 상점, 티어 등 서비스 확장을 위한 DB 재설계
<img width="1103" alt="ERD V3" src="https://github.com/8luerose/42GG_Server/assets/105616046/a1eb2c31-53cc-4c12-94ff-5ca51ec2d522">

### ⚡️⚡ 재화 시스템 추가
- 출석, 게임 승패에 연관해 재화 시스템 추가
<img width="400" alt="attendance" src="https://github.com/42organization/42gg.server.dev.v2/assets/95139402/caa564c8-cb1b-45eb-975c-9e685911e764">

### ⚡️⚡ 상점, 아이템 서비스 추가
- 유저 요구사항을 반영한 기능 확장
<img width="629" alt="스크린샷 2023-09-23 오후 11 48 01" src="https://github.com/8luerose/42GG_Server/assets/105616046/77ce958b-5901-4638-9833-ab27cc182e88">
<img width="689" alt="스크린샷 2023-09-23 오후 11 48 18" src="https://github.com/8luerose/42GG_Server/assets/105616046/f953cbc4-9d97-4485-b318-4fe73e3e3222">

### ⚡️⚡ 티어 시스템 추가
- 랭킹전 활성화를 위한 티어 시스템 추가
<img width="400" alt="tier" src="https://github.com/42organization/42gg.server.dev.v2/assets/95139402/342e0013-13e0-4482-84b5-4381df0498cf">

### ⚡️⚡ 관리자 페이지 구현
- 원활한 운영을 위한 관리자 기능 추가
<img width="400" alt="admin" src="https://github.com/42organization/42gg.server.dev.v2/assets/95139402/59756773-48f3-463a-91e4-6bb263aac2f5">
</div>
</details>

## ⚡️ 팀소개
### 3기
<table>
<thead>
<tr>
Expand Down Expand Up @@ -129,7 +116,37 @@ https://42gg.kr/

</table>



### 4기
<details>
<summary> 4기 진행 사항</summary>
<div markdown="1">

### ⚡️⚡ DB table 구조 변경
- 상점, 티어 등 서비스 확장을 위한 DB 재설계
<img width="1103" alt="ERD V3" src="https://github.com/8luerose/42GG_Server/assets/105616046/a1eb2c31-53cc-4c12-94ff-5ca51ec2d522">

### ⚡️⚡ 재화 시스템 추가
- 출석, 게임 승패에 연관해 재화 시스템 추가
<img width="400" alt="attendance" src="https://github.com/42organization/42gg.server.dev.v2/assets/95139402/caa564c8-cb1b-45eb-975c-9e685911e764">

### ⚡️⚡ 상점, 아이템 서비스 추가
- 유저 요구사항을 반영한 기능 확장
<img width="629" alt="스크린샷 2023-09-23 오후 11 48 01" src="https://github.com/8luerose/42GG_Server/assets/105616046/77ce958b-5901-4638-9833-ab27cc182e88">
<img width="689" alt="스크린샷 2023-09-23 오후 11 48 18" src="https://github.com/8luerose/42GG_Server/assets/105616046/f953cbc4-9d97-4485-b318-4fe73e3e3222">

### ⚡️⚡ 티어 시스템 추가
- 랭킹전 활성화를 위한 티어 시스템 추가
<img width="400" alt="tier" src="https://github.com/42organization/42gg.server.dev.v2/assets/95139402/342e0013-13e0-4482-84b5-4381df0498cf">

### ⚡️⚡ 관리자 페이지 구현
- 원활한 운영을 위한 관리자 기능 추가
<img width="400" alt="admin" src="https://github.com/42organization/42gg.server.dev.v2/assets/95139402/59756773-48f3-463a-91e4-6bb263aac2f5">

</div>
</details>

<table>
<thead>
<tr>
Expand Down Expand Up @@ -157,8 +174,66 @@ https://42gg.kr/

</table>

### 5기
<details>
<summary> 5기 진행 사항</summary>
<div markdown="1">

### ⚡️⚡ 토너먼트 개발
<img width="437" alt="5th-tournament" src="https://github.com/42organization/42gg.server.dev.v2/assets/33301153/edae9ab7-b871-4c33-9d2a-d571615b9a6f">

### ⚡️⚡ 테스트 커버리지 개선 (2024-03-19 기준)
### 전체 68% -> 74%
<img width="878" alt="5th-test-coverage-total" src="https://github.com/42organization/42gg.server.dev.v2/assets/33301153/a479b541-c93c-45bb-a75f-ecaa2332ab16">

### 단위 테스트 0% -> 30%
<img width="1312" alt="5th-test-coverage-unit" src="https://github.com/42organization/42gg.server.dev.v2/assets/33301153/1eeb1495-d500-4345-b1d2-ba1cfe4ec6c4">


### ⚡️⚡ 아키텍처 변경
### BEFORE
<img alt="systemArchitecture" src="https://github.com/42organization/42gg.server.dev.v2/assets/67796301/c51e8d73-d8f2-4f5e-935c-325ec263857e" >&nbsp;&nbsp;&nbsp;&nbsp;
### AFTER
![gg-5th-architecture](https://github.com/42organization/42gg.server.dev.v2/assets/33301153/f801e7b5-d579-467b-9ad0-2bfec506dcaa)

### ⚡️⚡ DB table 구조 변경
![image](https://github.com/42organization/42gg.server.dev.v2/assets/33301153/d4c68d74-590c-41db-9c47-0bdd4f249bc3)


</div>
</details>

<table>
<thead>
<tr>
<td align=center>🏓</td>
<td align=center>🏓</td>
<td align=center>🏓</td>
<td align=center>🏓</td>
<td align=center>🏓</td>
</tr>
</thead>
<tr>
<td align=center><a href="https://github.com/kokomong2">고승준 @kokomong2</a></td>
<td align=center><a href="https://github.com/Kimhan-nah">김한나 @Kimhan-nah</a></td>
<td align=center><a href="https://github.com/Newsujin">박수진 @Newsujin</a></td>
<td align=center><a href="https://github.com/SONGS4RI"> 이자훈 @SONGS4RI</a></td>
<td align=center><a href="https://github.com/middlefitting">정승철 @middlefitting</a></td>
</tr>
<tr>
<td align=center>토너먼트 개발, <br> 테스트 커버리지 개선</td>
<td align=center>팀장, 토너먼트 개발, <br> 테스트 커버리지 개선</td>
<td align=center>토너먼트 개발, <br> 테스트 커버리지 개선</td>
<td align=center>토너먼트 개발, <br> 테스트 커버리지 개선</td>
<td align=center>인프라 담당, <br> 테스트 커버리지 개선</td>
</tr>
</table>

## ⚡️ 필요 파일
<details>
<summary> application.yml </summary>
<div markdown="1">

다음과 같은 양식의 "application.yml"파일이 "src/main/resources/"경로에 필요합니다.
```
spring:
Expand Down Expand Up @@ -319,3 +394,6 @@ app:
refreshTokenExpiry: ""
```

</div>
</details>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

public interface CategoryAdminRepository extends JpaRepository<Category, Long> {
Boolean existsByName(String categoryName);

Category findByName(String categoryName);
}
1 change: 0 additions & 1 deletion gg-data/src/main/java/gg/data/party/GameTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ public void modifyTemplateDetails(String gameName, Integer maxGamePeople, Intege
public void modifyCategory(Category category) {
this.category = category;
}

}
16 changes: 6 additions & 10 deletions gg-data/src/main/java/gg/data/party/PartyPenalty.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,17 @@ public PartyPenalty(User user, String penaltyType, String message, LocalDateTime
this.penaltyTime = penaltyTime;
}

public void updatePenaltyTime(Integer penaltyTime) {
this.penaltyTime = penaltyTime;
}

public void updateMessage(String message) {
this.message = message;
}

public void updatePenaltyType(String penaltyType) {
this.penaltyType = penaltyType;
public static boolean isOnPenalty(PartyPenalty partyPenalty) {
if (partyPenalty == null) {
return false;
}
return LocalDateTime.now().isBefore(partyPenalty.getStartTime().plusMinutes(partyPenalty.getPenaltyTime()));
}

public void update(String penaltyType, String message, Integer penaltyTime) {
this.penaltyType = penaltyType;
this.message = message;
this.penaltyTime = penaltyTime;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ public void del() {
public Boolean isEnd() {
return LocalDateTime.now().isAfter(this.endTime);
}

public void setFinish(Boolean finish) {
this.isFinish = finish;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gg.party.api.admin.category.controller;

import javax.validation.Valid;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -25,7 +27,7 @@ public class CategoryAdminController {
* @return 추가 성공 여부
*/
@PostMapping
public ResponseEntity<Void> categoryAdd(@RequestBody CategoryAddAdminReqDto reqDto) {
public ResponseEntity<Void> categoryAdd(@RequestBody @Valid CategoryAddAdminReqDto reqDto) {
categoryAdminService.addCategory(reqDto);
return ResponseEntity.status(HttpStatus.CREATED).build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package gg.party.api.admin.category.controller.request;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED)
public class CategoryAddAdminReqDto {
@NotBlank(message = "카테고리 이름은 비어 있을 수 없습니다.")
@Size(min = 1, max = 10, message = "카테고리 이름은 1자 이상 10자 이하이어야 합니다.")
private String categoryName;

public CategoryAddAdminReqDto(String category) {
this.categoryName = category;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CategoryAdminService {
/**
* 카테고리 추가
* @param reqDto 추가할 카테고리 이름
* @exception CategoryDuplicateException 중복된 카테고리
* @throws CategoryDuplicateException 중복된 카테고리 - 409
*/
@Transactional
public void addCategory(CategoryAddAdminReqDto reqDto) {
Expand All @@ -35,20 +35,20 @@ public void addCategory(CategoryAddAdminReqDto reqDto) {

/**
* 카테고리 삭제
* 삭제 시 기존에 room에 연결되어 있던 카테고리는 default(1) 로 변경
* 삭제 시 기존에 room에 연결되어 있던 카테고리는 etc 로 변경
* @param categoryId 삭제할 카테고리 id
* @exception CategoryNotFoundException 유효하지 않은 카테고리
* @exception DefaultCategoryNeedException default 카테고리 존재 x 또는 default 카테고리 삭제 요청
* @throws CategoryNotFoundException 유효하지 않은 카테고리 - 404
* @throws DefaultCategoryNeedException default 카테고리 존재 x 또는 default 카테고리 삭제 요청 - 400
*/
@Transactional
public void removeCategory(Long categoryId) {
Category category = categoryAdminRepository.findById(categoryId)
.orElseThrow(CategoryNotFoundException::new);

Category defaultCategory = categoryAdminRepository.findById(DefaultCategoryNeedException.DEFAULT_CATEGORY_ID)
.orElseThrow(DefaultCategoryNeedException::new);
Category defaultCategory = categoryAdminRepository.findByName(
DefaultCategoryNeedException.DEFAULT_CATEGORY_NAME);

if (category.equals(defaultCategory)) {
if (defaultCategory == null || category.equals(defaultCategory)) {
throw new DefaultCategoryNeedException();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package gg.party.api.admin.comment.controller.request;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CommentUpdateAdminReqDto {
private Boolean isHidden;

public CommentUpdateAdminReqDto(Boolean isHidden) {
this.isHidden = isHidden;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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.ChangeSameStatusException;
import gg.utils.exception.party.CommentNotFoundException;
import lombok.RequiredArgsConstructor;

Expand All @@ -18,12 +19,16 @@ public class CommentAdminService {
/**
* 댓글 숨김
* @param commentId 댓글 번호
* @exception CommentNotFoundException 유효하지 않은 댓글
* @throws CommentNotFoundException 유효하지 않은 댓글 입력 - 404
* @throws ChangeSameStatusException 같은 상태로 변경 - 409
*/
@Transactional
public void modifyHideComment(Long commentId, CommentUpdateAdminReqDto reqDto) {
Comment comment = commentAdminRepository.findById(commentId)
.orElseThrow(CommentNotFoundException::new);
if (reqDto.getIsHidden() == comment.isHidden()) {
throw new ChangeSameStatusException();
}
comment.updateHidden(reqDto.getIsHidden());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ public ResponseEntity<PartyPenaltyListAdminResDto> penaltyList(@ModelAttribute @
*/
@PatchMapping("/{penaltyId}")
public ResponseEntity<Void> modifyAdminPenalty(@PathVariable Long penaltyId,
@RequestBody PartyPenaltyAdminReqDto reqDto) {
@RequestBody @Valid PartyPenaltyAdminReqDto reqDto) {
partyPenaltyAdminService.modifyAdminPenalty(penaltyId, reqDto);
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}

/**
* 패널티 부여
*/
@PostMapping()
@PostMapping
public ResponseEntity<Void> addAdminPenalty(
@RequestBody PartyPenaltyAdminReqDto reqDto) {
@RequestBody @Valid PartyPenaltyAdminReqDto reqDto) {
partyPenaltyAdminService.addAdminPenalty(reqDto);
return ResponseEntity.status(HttpStatus.CREATED).build();
}
Expand Down
Loading

0 comments on commit e4be599

Please sign in to comment.