Skip to content

Commit

Permalink
Merge pull request #86 from playkuround/develop
Browse files Browse the repository at this point in the history
release(ver 2.0.2)
  • Loading branch information
redcarrot1 authored Mar 12, 2024
2 parents f1d1bfb + b1cebc9 commit 258db5d
Show file tree
Hide file tree
Showing 215 changed files with 7,391 additions and 1,790 deletions.
65 changes: 0 additions & 65 deletions .github/workflows/main.yml

This file was deleted.

16 changes: 11 additions & 5 deletions .github/workflows/server-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ jobs:

- name: injection application.yml
run: |
touch src/main/resources/application.yml
touch src/main/resources/application-prod.yml
touch src/main/resources/application-dev.yml
touch src/main/resources/application-test.yml
echo "${{ secrets.YML }}" > src/main/resources/application.yml
touch src/main/resources/application-prod-log.properties
touch src/main/resources/application-dev-log.properties
echo "${{ secrets.PROD_YML }}" > src/main/resources/application-prod.yml
echo "${{ secrets.DEV_YML }}" > src/main/resources/application-dev.yml
echo "${{ secrets.TEST_YML }}" > src/main/resources/application-test.yml
echo "${{ secrets.DEV_LOG_PROPERTIES }}" > src/main/resources/application-dev-log.properties
echo "${{ secrets.PROD_LOG_PROPERTIES }}" > src/main/resources/application-prod-log.properties
shell: bash

- name: Grant execute permission for gradlew
Expand All @@ -46,7 +52,7 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build

- name: Deliver File
- name: Deliver JAR File
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
Expand All @@ -67,7 +73,7 @@ jobs:
script: |
SOURCE_DIR=source/build/libs
FILE_NAME=`find $SOURCE_DIR/*.jar -printf "%f\n"`
PID=`pgrep -f $FILE_NAME.jar | head -n 1`
PID=$(sudo lsof -Fp -i TCP:8080 | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')
if [ -z "$PID" ]; then
echo "#### THERE IS NO PROCESS ####"
Expand All @@ -78,4 +84,4 @@ jobs:
echo "#### RUN $SOURCE_DIR/$FILE_NAME ####"
sudo nohup java -jar $SOURCE_DIR/$FILE_NAME 1>$SOURCE_DIR/stdout.out 2>$SOURCE_DIR/stderr.out 2>&1 &
sudo nohup java -jar -Dspring.profiles.active="prod" $SOURCE_DIR/$FILE_NAME 1>$SOURCE_DIR/stdout.out 2>$SOURCE_DIR/stderr.out 2>&1 &
6 changes: 3 additions & 3 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:

- name: injection application.yml
run: |
touch src/main/resources/application.yml
touch src/main/resources/application-dev.yml
touch src/main/resources/application-test.yml
echo "${{ secrets.YML }}" > src/main/resources/application.yml
echo "${{ secrets.DEV_YML }}" > src/main/resources/application-dev.yml
echo "${{ secrets.TEST_YML }}" > src/main/resources/application-test.yml
shell: bash

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew clean build
run: ./gradlew clean build --info
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ out/

**/.DS_Store

log/
logs/

application.yml
application-test.yml
application-dev.yml
application-prob.yml
application-prod.yml
application-local.yml

application-dev-log.properties
application-prod-log.properties
53 changes: 34 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
# 플레이쿠라운드(PlayKUround)

> 건국대학교 교내 건물 탐험 랭킹 앱
## Intro
<img src="https://github.com/playkuround/playkuround-server/assets/51076814/dccb9bf1-2e1b-40a9-b19c-8401e26fe82a" width="190" />

<img src="https://user-images.githubusercontent.com/46523628/217736490-7cdbdc67-2354-4519-b0cb-5ec7f071f084.png" width="190" height="400"/> |
<img src="https://user-images.githubusercontent.com/46523628/217739730-164e384b-d96e-4c65-b8a4-fb8c4a404474.png" width="190" height="400"/> |
<img src="https://user-images.githubusercontent.com/46523628/217740527-69d3deb4-8e65-4285-afe3-14f27d76f088.png" width="190" height="400"/> |
<img src="https://user-images.githubusercontent.com/46523628/217740801-05b058b7-7a69-4762-9a6b-160c5005ddea.png" width="190" height="400"/>
무료했던 학교 생활, 공강시간에 새로운 활기를 불어 넣고 싶진 않으신가요? <br>
플레이쿠라운드는 건국대학교를 배경으로 각종 미니게임을 진행하는 아케이드 게임입니다.<br>

## Environment
- Java 11
- Spring-Boot
- Gradle
### Link
<a href="https://play.google.com/store/apps/details?id=com.umc.playkuround">
<img src="https://img.shields.io/badge/android-%2334A853.svg?style=for-the-badge&logo=Android&logoColor=white" alt="Android"/>
</a>

<a href="https://www.instagram.com/playkuround_">
<img src="https://img.shields.io/badge/instagram-%23E4405F.svg?style=for-the-badge&logo=Instagram&logoColor=white" alt="Instagram"/>
</a>

<a href="https://litt.ly/playkuround">
<img src="https://img.shields.io/badge/Linktree-%2343E55E.svg?style=for-the-badge&logo=Linktree&logoColor=white" alt="Linktree"/>
</a>

인스타그램에 설명서와 다양한 꿀팁들이 존재합니다! (귀여운 덕쿠도 더 많이 볼 수 있다는 사실 😊) <br>
또한 디버깅 및 오류, 건의 사항(사용자 피드백) 및 건대 아카이브를 받고 있으니 많은 관심 부탁드립니다!💪

## Capture Playing Application
<img src="https://github.com/playkuround/playkuround-server/assets/51076814/a0d00550-8471-4f03-b92f-d3fe137665c1" width="190"/> |
<img src="https://github.com/playkuround/playkuround-server/assets/51076814/f319e711-71af-4dad-8878-24ab786c6377" width="190"/> |
<img src="https://github.com/playkuround/playkuround-server/assets/51076814/66539156-27bf-4ac3-a64b-883293b60c32" width="190"/> |

<img src="https://github.com/playkuround/playkuround-server/assets/51076814/9ff2a877-ef43-473c-a377-28cec2bff911" width="190"/> |
<img src="https://github.com/playkuround/playkuround-server/assets/51076814/e3a3c347-0a75-4ce8-8553-776819ec611e" width="190"/> |
<img src="https://github.com/playkuround/playkuround-server/assets/51076814/a6d0e3f5-fe40-48fa-ac6f-7297ee7d7137" width="190"/> |

## Server Stack
- Java 17
- Spring Boot 3.1.3
- AWS EC2
- AWS RDS

## Skills
- Spring Data JPA
- Spring Boot Actuator
- Spring Boot Mail
- Redis
- MySQL
- H2 Database
- JUnit
- Jascypt
- AWS ElastiCache for Redis
- Prometheus, Grafana
30 changes: 29 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'org.springframework.boot' version '3.1.3'
id 'io.spring.dependency-management' version '1.1.3'
id 'java'
id 'jacoco'
}

group = 'com.playkuround'
Expand Down Expand Up @@ -31,8 +32,11 @@ dependencies {
implementation 'javax.xml.bind:jaxb-api:2.3.1'

compileOnly 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

Expand All @@ -44,6 +48,13 @@ dependencies {
testImplementation 'org.springframework.security:spring-security-test'

implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'

implementation 'it.ozimov:embedded-redis:0.7.2'

implementation 'io.github.vaneproject:badwordfiltering:1.0.0'

implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand All @@ -53,6 +64,23 @@ tasks.named('test') {
jar {
enabled = false
}

test {
systemProperties(System.getProperties())
}
}

jacocoTestReport {
dependsOn test

reports {
html.required.set(true)
}

afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/dto"
])
}))
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
package com.playkuround.playkuroundserver.domain.adventure.api;

import com.playkuround.playkuroundserver.domain.adventure.api.request.AdventureSaveRequest;
import com.playkuround.playkuroundserver.domain.adventure.api.response.AdventureSaveResponse;
import com.playkuround.playkuroundserver.domain.adventure.application.AdventureService;
import com.playkuround.playkuroundserver.domain.adventure.dto.AdventureSaveDto;
import com.playkuround.playkuroundserver.domain.adventure.dto.ResponseFindAdventure;
import com.playkuround.playkuroundserver.domain.adventure.dto.ResponseMostVisitedUser;
import com.playkuround.playkuroundserver.domain.badge.dto.NewlyRegisteredBadge;
import com.playkuround.playkuroundserver.domain.score.domain.ScoreType;
import com.playkuround.playkuroundserver.global.common.response.ApiResponse;
import com.playkuround.playkuroundserver.global.security.UserDetailsImpl;
import com.playkuround.playkuroundserver.global.util.ApiUtils;
import com.playkuround.playkuroundserver.global.util.Location;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/api/adventures")
@Tag(name = "Adventure", description = "Adventure API")
public class AdventureApi {

private final AdventureService adventureService;

@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public ApiResponse<?> saveAdventure(@AuthenticationPrincipal UserDetailsImpl userDetails,
@RequestBody @Valid AdventureSaveDto.Request request) {
adventureService.saveAdventure(userDetails.getUser(), request);
return ApiUtils.success(null);
@Operation(summary = "탐험하기", description = "탐험 점수를 저장합니다. 새롭게 얻은 뱃지가 있을 시 반환됩니다. " +
"새로 추가된 뱃지는 DB에 자동 반영됩니다. scoreType은 별도 문서 참고")
public ApiResponse<AdventureSaveResponse> saveAdventure(@AuthenticationPrincipal UserDetailsImpl userDetails,
@RequestBody @Valid AdventureSaveRequest request) {
ScoreType scoreType = ScoreType.fromString(request.getScoreType());
Location location = new Location(request.getLatitude(), request.getLongitude());
AdventureSaveDto adventureSaveDto
= new AdventureSaveDto(userDetails.getUser(), request.getLandmarkId(), location, request.getScore(), scoreType);
NewlyRegisteredBadge newlyRegisteredBadge = adventureService.saveAdventure(adventureSaveDto);
return ApiUtils.success(AdventureSaveResponse.from(newlyRegisteredBadge));
}

@GetMapping
public ApiResponse<ResponseFindAdventure> findAdventureByUserEmail(@AuthenticationPrincipal UserDetailsImpl userDetails) {
ResponseFindAdventure adventureByUserEmail = adventureService.findAdventureByUserEmail(userDetails.getUser());
return ApiUtils.success(adventureByUserEmail);

}

@GetMapping("/{landmarkId}/most")
public ApiResponse<ResponseMostVisitedUser> findMemberMostAdventure(@AuthenticationPrincipal UserDetailsImpl userDetails,
@PathVariable Long landmarkId) {
ResponseMostVisitedUser memberMostLandmark = adventureService.findMemberMostLandmark(userDetails.getUser(), landmarkId);
return ApiUtils.success(memberMostLandmark);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.playkuround.playkuroundserver.domain.adventure.api.request;

import com.playkuround.playkuroundserver.domain.score.domain.ScoreType;
import com.playkuround.playkuroundserver.global.validation.Latitude;
import com.playkuround.playkuroundserver.global.validation.Longitude;
import com.playkuround.playkuroundserver.global.validation.ValidEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
@AllArgsConstructor
public class AdventureSaveRequest {

@NotNull(message = "랜드마크id는 필수입니다.")
@Schema(description = "랜드마크ID", example = "4", requiredMode = Schema.RequiredMode.REQUIRED)
private Long landmarkId;

@Latitude
@Schema(description = "위도", example = "37.1413", requiredMode = Schema.RequiredMode.REQUIRED)
private Double latitude;

@Longitude
@Schema(description = "경도", example = "130.1413", requiredMode = Schema.RequiredMode.REQUIRED)
private Double longitude;

@NotNull(message = "점수는 필수입니다.")
@Schema(description = "점수", example = "110", requiredMode = Schema.RequiredMode.REQUIRED)
private Long score;

@ValidEnum(enumClass = ScoreType.class, message = "잘못된 점수 타입입니다.")
@Schema(description = "점수타입(별도문서 참고)", example = "QUIZ", requiredMode = Schema.RequiredMode.REQUIRED)
private String scoreType;
}
Loading

0 comments on commit 258db5d

Please sign in to comment.