Skip to content

Commit

Permalink
Merge pull request #115 from dev-hooon/dev
Browse files Browse the repository at this point in the history
feat : main 브랜치 merge
  • Loading branch information
dlswns2480 authored Jan 18, 2024
2 parents 59aa4f8 + e7299bf commit 382a140
Show file tree
Hide file tree
Showing 163 changed files with 9,635 additions and 17 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: CI Backend

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]

permissions:
contents: read
checks: write
pull-requests: write
jobs:
build:

runs-on: ubuntu-latest
services:
redis:
image: redis:latest
ports:
- "6379:6379"
steps:
- uses: actions/checkout@v3

# 자바 버전 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# 빌드 시 캐시 적용
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# gradle 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

# 빌드
- name: Build with Gradle
run: ./gradlew build

# 테스트 결과 PR 코멘트에 등록
- name: Register the test results as PR comments
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'

# 테스트 실패시 코드 라인에 대한 체크 추가
- name: If test fail, add check comment on failed code line
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.html'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ out/
### VS Code ###
.vscode/
application.yaml
.DS_Store
.DS_Store
src/main/generated/**
72 changes: 69 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExt
}

repositories {
Expand All @@ -36,16 +37,81 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'

//test contrainer
testImplementation "org.testcontainers:testcontainers:1.19.2"
testImplementation "org.testcontainers:junit-jupiter:1.19.2"
testImplementation "org.testcontainers:mysql:1.19.2"
testImplementation 'org.testcontainers:jdbc:1.18.3'

// RestDocs
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'

testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

//OAuth2.0 Client
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'

//JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'

implementation group: 'org.json', name: 'json', version: '20231013'

//Query Dsl
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'

annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
}

//Query Dsl
def querydslDir = "src/main/generated"

sourceSets {
main.java.srcDirs += [querydslDir]
}

tasks.withType(JavaCompile) {
options.getGeneratedSourceOutputDirectory().set(file(querydslDir))
}

clean.doLast {
file(querydslDir).deleteDir()
}
//Query Dsl

tasks.named('test') {
outputs.dir snippetsDir
useJUnitPlatform()
}

tasks.named('asciidoctor') {
ext { // 전역 변수
snippetsDir = file('build/generated-snippets')
}

test {
outputs.dir snippetsDir
}

asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'

sources {//특정 파일만 html로 생성
include("**/index.adoc")
}
baseDirFollowsSourceFile() //다른 adoc 파일을 include할 때 경로를 baseDir로 맞춤
dependsOn test
}

bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}") {
into 'static/docs'
}
}
80 changes: 80 additions & 0 deletions src/docs/asciidoc/api/reservation/reservation.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[[reservation-create]]
=== 예약 선점 API

==== HTTP Request

include::{snippets}/member-reservation-controller-docs-test/pre-occupy/http-request.adoc[]
include::{snippets}/member-reservation-controller-docs-test/pre-occupy/request-fields.adoc[]

==== HTTP Response

include::{snippets}/member-reservation-controller-docs-test/pre-occupy/http-response.adoc[]
include::{snippets}/member-reservation-controller-docs-test/pre-occupy/response-fields.adoc[]

=== 가게 예약 API

==== HTTP Request

include::{snippets}/member-reservation-controller-docs-test/register/http-request.adoc[]
include::{snippets}/member-reservation-controller-docs-test/register/request-fields.adoc[]

==== HTTP Response

include::{snippets}/member-reservation-controller-docs-test/register/http-response.adoc[]
include::{snippets}/member-reservation-controller-docs-test/register/response-fields.adoc[]

=== 예약 전체 조회 API

==== HTTP Request

include::{snippets}/member-reservation-controller-docs-test/get-all/http-request.adoc[]

==== HTTP Response

include::{snippets}/member-reservation-controller-docs-test/get-all/http-response.adoc[]
include::{snippets}/member-reservation-controller-docs-test/get-all/response-fields.adoc[]

=== 예약 수정 API

==== HTTP Request

include::{snippets}/member-reservation-controller-docs-test/modify/http-request.adoc[]
include::{snippets}/member-reservation-controller-docs-test/modify/request-fields.adoc[]

==== HTTP Response

include::{snippets}/member-reservation-controller-docs-test/modify/http-response.adoc[]
include::{snippets}/member-reservation-controller-docs-test/modify/response-fields.adoc[]

=== 예약 삭제 API

==== HTTP Request

include::{snippets}/member-reservation-controller-docs-test/cancel/http-request.adoc[]

==== HTTP Response

include::{snippets}/member-reservation-controller-docs-test/cancel/http-response.adoc[]
include::{snippets}/member-reservation-controller-docs-test/cancel/response-fields.adoc[]

=== 예약 노쇼, 취소 처리 API

==== HTTP Request

include::{snippets}/owner-reservation-controller-docs-test/noshow-and-cancel/http-request.adoc[]
include::{snippets}/owner-reservation-controller-docs-test/noshow-and-cancel/request-fields.adoc[]

==== HTTP Response

include::{snippets}/owner-reservation-controller-docs-test/noshow-and-cancel/http-response.adoc[]

=== 예약 정보 전체 조회 API

==== HTTP Request

include::{snippets}/owner-reservation-controller-docs-test/get-all-reservation/http-request.adoc[]

==== HTTP Response

include::{snippets}/owner-reservation-controller-docs-test/get-all-reservation/http-response.adoc[]
include::{snippets}/owner-reservation-controller-docs-test/get-all-reservation/response-fields.adoc[]
78 changes: 78 additions & 0 deletions src/docs/asciidoc/api/waiting/waiting.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[[waiting-create]]
=== 웨이팅 등록 API

==== HTTP Request

include::{snippets}/member-waiting-controller-docs-test/create-waiting/http-request.adoc[]
include::{snippets}/member-waiting-controller-docs-test/create-waiting/request-fields.adoc[]

==== HTTP Response

include::{snippets}/member-waiting-controller-docs-test/create-waiting/http-response.adoc[]
include::{snippets}/member-waiting-controller-docs-test/create-waiting/response-fields.adoc[]

=== 회원 진행 중인 웨이팅 조회 API

==== HTTP Request

include::{snippets}/member-waiting-controller-docs-test/get-waiting/http-request.adoc[]

==== HTTP Response

include::{snippets}/member-waiting-controller-docs-test/get-waiting/http-response.adoc[]
include::{snippets}/member-waiting-controller-docs-test/get-waiting/response-fields.adoc[]

=== 회원 웨이팅 이력 조회 API

==== HTTP Request

include::{snippets}/member-waiting-controller-docs-test/get-member-waiting-history/http-request.adoc[]

==== HTTP Response

include::{snippets}/member-waiting-controller-docs-test/get-member-waiting-history/http-response.adoc[]
include::{snippets}/member-waiting-controller-docs-test/get-member-waiting-history/response-fields.adoc[]

=== 웨이팅 지연 API

==== HTTP Request

include::{snippets}/member-waiting-controller-docs-test/postpone-waiting/http-request.adoc[]

==== HTTP Response

include::{snippets}/member-waiting-controller-docs-test/postpone-waiting/http-response.adoc[]
include::{snippets}/member-waiting-controller-docs-test/postpone-waiting/response-fields.adoc[]

=== 웨이팅 취소 API

==== HTTP Request

include::{snippets}/member-waiting-controller-docs-test/cancel-waiting/http-request.adoc[]

==== HTTP Response

include::{snippets}/member-waiting-controller-docs-test/cancel-waiting/http-response.adoc[]
include::{snippets}/member-waiting-controller-docs-test/cancel-waiting/response-fields.adoc[]

=== 웨이팅 입장 API

==== HTTP Request

include::{snippets}/owner-waiting-controller-docs-test/entry-waiting/http-request.adoc[]

==== HTTP Response

include::{snippets}/owner-waiting-controller-docs-test/entry-waiting/http-response.adoc[]
include::{snippets}/owner-waiting-controller-docs-test/entry-waiting/response-fields.adoc[]

=== 가게 웨이팅 조회 API

==== HTTP Request

include::{snippets}/owner-waiting-controller-docs-test/get-shop-all-waiting/http-request.adoc[]

==== HTTP Response

include::{snippets}/owner-waiting-controller-docs-test/get-shop-all-waiting/http-response.adoc[]
include::{snippets}/owner-waiting-controller-docs-test/get-shop-all-waiting/response-fields.adoc[]
19 changes: 19 additions & 0 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ifndef::snippets[]
:snippets: ../../build/generated-snippets
endif::[]
= Catch Table REST API 문서
:doctype: book
:icons: font
:source-highlighter: highlightjs
:toc: left
:toclevels: 2
:sectlinks:

[[CatchTable-API]]
== Waiting API

include::api/waiting/waiting.adoc[]

== Reservation API

include::api/reservation/reservation.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

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

@EnableJpaAuditing
@SpringBootApplication
public class CatchtableApplication {

Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/prgrms/catchtable/common/BaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.prgrms.catchtable.common;

import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseEntity {

@CreatedDate
private LocalDateTime createdAt;

@LastModifiedDate
private LocalDateTime updatedAt;

}
Loading

0 comments on commit 382a140

Please sign in to comment.