Skip to content

Commit

Permalink
[v1] 프론트-백 연동 전 버전
Browse files Browse the repository at this point in the history
[chore] default 브랜치를 dev -> main으로 변경
  • Loading branch information
SoulTree-Lovers authored Aug 8, 2024
2 parents f795f25 + ab456d8 commit e22e76a
Show file tree
Hide file tree
Showing 130 changed files with 7,934 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: BugFix
about: 오류 해결 과정 기록
title: ''
labels: ":hammer_and_wrench: fix"
assignees: ''

---

## 💡Description
> description
## ✅ To Do List
- [ ] todo1
- [ ] todo2
- [ ] todo3

## Etc
> etc
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature
about: 기능구현, 리팩토링, 환경설정 등을 포함한 기본 템플릿
title: ''
labels: ''
assignees: ''

---

## 💡Description
> description
## ✅ To Do List
- [ ] todo1
- [ ] todo2
- [ ] todo3

## Etc
> etc
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## 개요
<!---- 변경 사항 및 관련 이슈에 대해 간단하게 작성해주세요. 어떻게보다 무엇을 왜 수정했는지 설명해주세요. -->

## PR
어떤 변경 사항이 있나요?

- [ ] 새로운 기능 추가
- [ ] 버그 수정
- [ ] 문서 수정
- [ ] 코드 포맷 변경, 세미콜론 누락, 코드 수정이 없는경우
- [ ] 코드 리팩토링
- [ ] 테스트 추가, 테스트 리팩토링
- [ ] 빌드 수정, 패키지 매니저 수정
- [ ] 파일, 폴더명 수정
- [ ] 파일, 폴더 삭제

## Checklist

- [ ] 커밋 메시지 컨벤션에 맞게 작성했습니다.
- [ ] 변경 사항에 대한 테스트를 했습니다.
- [ ] 필요 없는 import문이나 setter 등을 삭제했습니다.
- [ ] 기존의 코드에 영향이 없는 것을 확인했습니다.
46 changes: 46 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: server


on:
push:
branches:
- main

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Ensure resource directory exists
run: mkdir -p ./src/main/resources

- name : injection-yml
run : echo -E "${{ secrets.YML }}" > ./src/main/resources/application.yml

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Execute Gradle build and analyze
run: ./gradlew jib

- name: Run scripts in server
uses: appleboy/ssh-action@master
with:
key: ${{ secrets.PRIVATE_KEY }}
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USERNAME }}
script: ${{ secrets.SCRIPT }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ out/

### VS Code ###
.vscode/

### Setting File ###
src/main/resources/**
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# BackEnd
<div align="center">

# 빈주머니즈_Spring
![빈주머니즈_커버_대지 1 사본](https://github.com/user-attachments/assets/744ef4c6-87cd-4db9-9c0b-f848231a203c)


<img src="https://img.shields.io/badge/Spring-6DB33F?style=for-the-badge&logo=Spring&logoColor=white"> ![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge&logo=openjdk&logoColor=white) ![MySQL](https://img.shields.io/badge/mysql-4479A1.svg?style=for-the-badge&logo=mysql&logoColor=white) ![IntelliJ IDEA](https://img.shields.io/badge/IntelliJIDEA-000000.svg?style=for-the-badge&logo=intellij-idea&logoColor=white) ![Postman](https://img.shields.io/badge/Postman-FF6C37?style=for-the-badge&logo=postman&logoColor=white)

<img src="https://github.com/user-attachments/assets/98dd17ec-9019-48f0-b5cb-00a9d0af8e9c" width="100" height="100"/>

## Team
|<img src="https://avatars.githubusercontent.com/u/41982054?v=4" width="150" height="150"/>|<img src="https://avatars.githubusercontent.com/u/54972879?v=4" width="150" height="150"/>|<img src="https://avatars.githubusercontent.com/u/96693842?v=4" width="150" height="150"/>|<img src="https://avatars.githubusercontent.com/u/106878778?v=4" width="150" height="150"/>|<img src="https://avatars.githubusercontent.com/u/107318116?v=4" width="150" height="150"/>|<img src="https://avatars.githubusercontent.com/u/162525176?v=4" width="150" height="150"/>|
|:-:|:-:|:-:|:-:|:-:|:-:|
|JeongJun Min<br/>[@m3k0813](https://github.com/m3k0813)|SeungMin Kang<br/>[@SoulTree-Lovers](https://github.com/SoulTree-Lovers)|류효경<br/>[@ryogaeng](https://github.com/ryogaeng)|강재혁<br/>[@ggamD00](https://github.com/ggamD00)|[@JunRain2](https://github.com/JunRain2)|이창준<br/>[@wnd01jun](https://github.com/wnd01jun)|
21 changes: 21 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.2.7'
id 'io.spring.dependency-management' version '1.1.5'
id 'com.google.cloud.tools.jib' version '3.4.3'
}

group = 'com.bbteam'
Expand All @@ -26,6 +27,8 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' //Swagger
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
Expand All @@ -36,3 +39,21 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

jib {
from {
image = 'openjdk:17-alpine'
platforms {
platform {
architecture = 'amd64'
os = 'linux'
}
}
}
to {
image = 'binjumeoniz1/binjumeoniz:latest'
}
container {
jvmFlags = ['-Dspring.profiles.active=dev']
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@SpringBootApplication
@EnableJpaAuditing
public class BudgetbuddiesApplication {

public static void main(String[] args) {
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/com/bbteam/budgetbuddies/apiPayload/ApiResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.bbteam.budgetbuddies.apiPayload;


import com.bbteam.budgetbuddies.apiPayload.code.BaseCode;
import com.bbteam.budgetbuddies.apiPayload.code.status.SuccessStatus;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
@JsonPropertyOrder({"isSuccess", "code", "message", "result"})
public class ApiResponse<T> {
@JsonProperty("isSuccess")
private final Boolean isSuccess;
private final String code;
private final String message;
@JsonInclude(JsonInclude.Include.NON_NULL)
private T result;

public static <T> ApiResponse<T> onSuccess(T result){
return new ApiResponse<>(true, SuccessStatus._OK.getCode(), SuccessStatus._OK.getMessage(), result);

}

public static <T> ApiResponse<T> of(BaseCode code, T result){
return new ApiResponse<>(true, code.getReasonHttpStatus().getCode(),
code.getReasonHttpStatus().getMessage(), result);
}


public static <T> ApiResponse<T> onFailure(String code, String message, T data){
return new ApiResponse<>(false, code,message, data);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.bbteam.budgetbuddies.apiPayload.code;

public interface BaseCode {

ReasonDto getReason();

ReasonDto getReasonHttpStatus();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.bbteam.budgetbuddies.apiPayload.code;

public interface BaseErrorCode {

ErrorReasonDto getReason();

ErrorReasonDto getReasonHttpStatus();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.bbteam.budgetbuddies.apiPayload.code;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Builder
@Getter
@AllArgsConstructor
public class ErrorReasonDto {
String message;
String code;
Boolean isSuccess;
HttpStatus httpStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.bbteam.budgetbuddies.apiPayload.code;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Builder
@AllArgsConstructor
@Getter
public class ReasonDto {
String message;
String code;
Boolean isSuccess;
HttpStatus httpStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.bbteam.budgetbuddies.apiPayload.code.status;

import com.bbteam.budgetbuddies.apiPayload.code.BaseErrorCode;
import com.bbteam.budgetbuddies.apiPayload.code.ErrorReasonDto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
@AllArgsConstructor
public enum CommonErrorStatus implements BaseErrorCode {

_INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "COMMON500", "서버에러"),
_BAD_REQUEST(HttpStatus.BAD_REQUEST, "COMMON400", "잘못된 요청입니다."),
_UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "COMMON401", "인증이 필요합니다"),
_FORBIDDEN(HttpStatus.FORBIDDEN, "COMMON403", "금지된 요청입니다."),;

private final HttpStatus httpStatus;
private final String code;
private final String message;


@Override
public ErrorReasonDto getReason() {
return ErrorReasonDto.builder()
.message(message)
.code(code)
.isSuccess(false)
.build();
}

@Override
public ErrorReasonDto getReasonHttpStatus() {
return ErrorReasonDto.builder()
.message(message)
.code(code)
.isSuccess(false)
.httpStatus(httpStatus)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.bbteam.budgetbuddies.apiPayload.code.status;

import com.bbteam.budgetbuddies.apiPayload.code.BaseErrorCode;
import com.bbteam.budgetbuddies.apiPayload.code.ErrorReasonDto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
@AllArgsConstructor
public enum ErrorStatus implements BaseErrorCode {


_INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "COMMON500", "서버에러"),
_BAD_REQUEST(HttpStatus.BAD_REQUEST, "COMMON400", "잘못된 요청입니다."),
_UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "COMMON401", "인증이 필요합니다"),
_FORBIDDEN(HttpStatus.FORBIDDEN, "COMMON403", "금지된 요청입니다."),
USER_NOT_FOUND(HttpStatus.BAD_REQUEST, "USER4001", "사용자가 없습니다."),
NICKNAME_NOT_EXIST(HttpStatus.BAD_REQUEST, "MEMBER4002", "닉네임은 필수입니다."),
COMMENT_NOT_FOUND(HttpStatus.BAD_REQUEST, "COMMENT4001", "해당 댓글이 없습니다.") ,
ARTICLE_NOT_FOUND(HttpStatus.NOT_FOUND, "ARTICLE4002", "게시글이 없습니다."),
TEMP_EXCEPTION(HttpStatus.BAD_REQUEST, "TEMP4001", "test"),
FOOD_CATEGORY_NOT_FOUND(HttpStatus.NOT_FOUND, "FOOD_CATEGORY4004", "해당하는 음식 카테고리가 없습니다."),
STORE_NOT_FOUND(HttpStatus.NOT_FOUND, "STORE4004", "해당하는 가게는 존재하지 않습니다."),
MISSION_ALREADY_ACCEPT(HttpStatus.BAD_REQUEST, "MISSION4001", "해당 미션은 이미 수주되었습니다."),
REVIEW_ALREADY_EXIST(HttpStatus.BAD_REQUEST, "REVIEW4001","해당 가게에 리뷰를 이미 작성하셨습니다."),
PAGE_LOWER_ZERO(HttpStatus.BAD_REQUEST, "PAGE4001", "요청된 페이지가 0보다 작습니다."),
MISSION_NOT_FOUND(HttpStatus.NOT_FOUND, "MISSION4004", "해당 미션이 존재하지 않습니다."),
MISSION_ALREADY_COMPLETE(HttpStatus.BAD_REQUEST, "MISSION4001", "해당 미션은 이미 완료된 미션입니다.");


private HttpStatus httpStatus;
private String code;
private String message;


@Override
public ErrorReasonDto getReason() {
return ErrorReasonDto.builder()
.message(message)
.code(code)
.isSuccess(false)
.build();
}

@Override
public ErrorReasonDto getReasonHttpStatus() {
return ErrorReasonDto.builder()
.message(message)
.code(code)
.isSuccess(false)
.httpStatus(httpStatus)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.bbteam.budgetbuddies.apiPayload.code.status;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
@AllArgsConstructor
public enum SuccessStatus {
_OK(HttpStatus.OK, "200", "okay");

private final HttpStatus httpStatus;
private final String code;
private final String message;
}
Loading

0 comments on commit e22e76a

Please sign in to comment.