Skip to content

Commit

Permalink
Chore : 테스트 할 수 있는 환경 구성
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-spear committed Jan 3, 2024
1 parent b6100a7 commit fb89a39
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 35 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:17-jdk
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# numble-banking-api
Numble Challenge - Banking API

### API
### 테스트

[링크](https://this-is-spear.github.io/hello-banking-api/src/main/resources/static/docs/index.html)에서 확인할 수 있습니다.
- 테스트 할 API는 [API 문서](https://this-is-spear.github.io/hello-banking-api/src/main/resources/static/docs/index.html)에서 확인 할 수 있습니다.
- 서버는 `run.sh` 를 실행하면 됩니다.

### Development Environment

Expand Down
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: "3.8"

services:
database:
container_name: mysql_db
image: mysql/mysql-server:8.0-aarch64
environment:
MYSQL_DATABASE: money_transfer_service
MYSQL_ROOT_HOST: '%'
MYSQL_ROOT_PASSWORD: password!
TZ: 'Asia/Seoul'
ports:
- "3306:3306"
volumes:
- ./mysql/conf.d:/etc/mysql/conf.d
command:
- "mysqld"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
- "--innodb_buffer_pool_size=256M"

application:
container_name: money-transfer
deploy:
replicas: 1
restart: on-failure
build:
context: ./
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://host.docker.internal:3306/money_transfer_service?characterEncoding=UTF-8&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_USERNAME: "root"
SPRING_DATASOURCE_PASSWORD: "password!"
depends_on:
database:
condition: service_healthy
Empty file added mysql/conf.d
Empty file.
13 changes: 13 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Gradle 빌드 실행
sudo ./gradlew clean build

# 빌드가 실패하면 스크립트 종료
if [ $? -ne 0 ]; then
echo "Gradle build failed. Exiting script."
exit 1
fi

# Docker Compose 실행
sudo docker-compose up -d
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Entity
@Getter
@ToString(onlyExplicitlyIncluded = true)
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class IdempotentRequestHistory extends BaseEntity {
@Id
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/money_transfer_service?characterEncoding=UTF-8&serverTimezone=Asia/Seoul
url: ${SPRING_DATASOURCE_URL:jdbc:mysql://localhost:3306/money_transfer_service?characterEncoding=UTF-8&serverTimezone=Asia/Seoul}
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: password!
username: ${SPRING_DATASOURCE_USERNAME:root}
password: ${SPRING_DATASOURCE_PASSWORD:password!}
jpa:
database: mysql
database-platform: org.hibernate.dialect.MySQLDialect
show-sql: true
hibernate:
ddl-auto: create
58 changes: 29 additions & 29 deletions src/main/resources/static/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ <h3 id="_기록_조회"><a class="link" href="#_기록_조회">기록 조회</a>
<h4 id="_http_request"><a class="link" href="#_http_request">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /account/850-7677-112404/history?_csrf=afxIBwiY4fQKlVHUwpH02j8DrE40vnfzI7-nR2_Ci71yaBm5W814Pzut08wnoTDt87zA6FwzgS8C3U7eGoaTdl_xs4hLXija HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /account/392-6355-379976/history?_csrf=A2IJuLxqwlOh2FKdI1cqnWk-cjDop6y477ZhpVQOFzwdZ7q_YlY8jooL8zeM6zSpEXoepVtaXwjewpqV3oEDwW02Ll4sBd_c HTTP/1.1
Host: 127.0.0.1:8080</code></pre>
</div>
</div>
Expand Down Expand Up @@ -512,10 +512,10 @@ <h4 id="_http_response"><a class="link" href="#_http_response">HTTP response</a>
"amount" : 20000
},
"fromAccountNumber" : {
"number" : "850-7677-112404"
"number" : "392-6355-379976"
},
"toAccountNumber" : {
"number" : "742-3975-124600"
"number" : "245-0824-866251"
},
"recordDate" : "2022-02-13T12:10:00"
}, {
Expand All @@ -524,10 +524,10 @@ <h4 id="_http_response"><a class="link" href="#_http_response">HTTP response</a>
"amount" : 5000
},
"fromAccountNumber" : {
"number" : "850-7677-112404"
"number" : "392-6355-379976"
},
"toAccountNumber" : {
"number" : "042-3545-569995"
"number" : "509-4766-574551"
},
"recordDate" : "2022-02-03T04:10:00"
}, {
Expand All @@ -536,10 +536,10 @@ <h4 id="_http_response"><a class="link" href="#_http_response">HTTP response</a>
"amount" : 10000
},
"fromAccountNumber" : {
"number" : "850-7677-112404"
"number" : "392-6355-379976"
},
"toAccountNumber" : {
"number" : "747-0165-603311"
"number" : "358-0552-451968"
},
"recordDate" : "2022-02-01T21:10:00"
}, {
Expand All @@ -548,10 +548,10 @@ <h4 id="_http_response"><a class="link" href="#_http_response">HTTP response</a>
"amount" : 100000
},
"fromAccountNumber" : {
"number" : "850-7677-112404"
"number" : "392-6355-379976"
},
"toAccountNumber" : {
"number" : "850-7454-030406"
"number" : "426-1609-807377"
},
"recordDate" : "2022-01-21T20:10:00"
}, {
Expand All @@ -560,10 +560,10 @@ <h4 id="_http_response"><a class="link" href="#_http_response">HTTP response</a>
"amount" : 15000
},
"fromAccountNumber" : {
"number" : "850-7677-112404"
"number" : "392-6355-379976"
},
"toAccountNumber" : {
"number" : "624-9020-659277"
"number" : "111-1947-554591"
},
"recordDate" : "2022-01-10T08:10:00"
} ]
Expand All @@ -578,9 +578,9 @@ <h3 id="_금액_입금"><a class="link" href="#_금액_입금">금액 입금</a>
<h4 id="_http_request_2"><a class="link" href="#_http_request_2">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /account/850-7677-112404/deposit?_csrf=MPbZP4AUEbRN_e7Y9qAWI-wQdJTOGMoB0VuGAILUkIggcUFABcfsCOUnII1gxdi9xY0iF911Wfb9IKss5j61NLLmorEVQiAm HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /account/392-6355-379976/deposit?_csrf=6J3YLhixz9JMbsEI0lO-CuQCiI_lCKOpyc-Tv6OYZLxqyV94jam5HS6EquRhCqdp5H6KO9NjpbeEMJCErazy3JevAdlc-mhM HTTP/1.1
Content-Type: application/json;charset=UTF-8
Idempotency-Key: ee39c0d9-f947-4077-a3b2-720b5cce8346
Idempotency-Key: 989e59ed-019c-4bc5-b4c3-35c1eca53972
Content-Length: 22
Host: 127.0.0.1:8080

Expand Down Expand Up @@ -611,9 +611,9 @@ <h3 id="_금액_출금"><a class="link" href="#_금액_출금">금액 출금</a>
<h4 id="_http_request_3"><a class="link" href="#_http_request_3">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /account/850-7677-112404/withdraw?_csrf=OeV8KmWmT_UqqoA4AZ5KcgjxrlcI6zAUfO2vlmzMqc8-eMkaAIEYEgeRKcUHmOQAZbN-Sz_DgzU_31Y5ToibpVWtzfkNT6h4 HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /account/392-6355-379976/withdraw?_csrf=dnEnHEvIQDtXqPsoM9KoINEGilFJS6rrXRxPejC-BBiQAID5R0YWei79dQt6m8pJA_-cQuJlp2l9L53GOyx3GASINXukZrLI HTTP/1.1
Content-Type: application/json;charset=UTF-8
Idempotency-Key: c75ff696-b02a-457b-bacb-6f782a077404
Idempotency-Key: d12e01c7-3b7e-4ee4-881b-fcb4ac8dedfe
Content-Length: 22
Host: 127.0.0.1:8080

Expand Down Expand Up @@ -644,14 +644,14 @@ <h3 id="_계좌_이체"><a class="link" href="#_계좌_이체">계좌 이체</a>
<h4 id="_http_request_4"><a class="link" href="#_http_request_4">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /account/850-7677-112404/transfer?_csrf=pKIDtjegX032qiY_tufMW0jCaddIINgMwE3apygOiGXJ5j11xZNgh1bDaCnbnx8L0Mr4aimjRLYtErkhoS7rlBBr6Vb41VhN HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /account/392-6355-379976/transfer?_csrf=tssZ8kGRgIkZfkkgwTGQtGYT0ZlKMN_RmcD0TZeINowyqft8ga4skSSj47o0SigT8hyk0QUg_KEoA7v8-KHCLPPsALtRn8kY HTTP/1.1
Content-Type: application/json;charset=UTF-8
Idempotency-Key: 8893c4cc-92f1-48f8-a61a-5bdcbc04ded5
Idempotency-Key: 3581bd6d-53ef-4e8e-bed5-5776582a52c7
Content-Length: 84
Host: 127.0.0.1:8080

{
"toAccountNumber" : "850-7677-112404",
"toAccountNumber" : "392-6355-379976",
"amount" : {
"amount" : 20000
}
Expand Down Expand Up @@ -680,7 +680,7 @@ <h3 id="_이체_대상_확인"><a class="link" href="#_이체_대상_확인">이
<h4 id="_http_request_5"><a class="link" href="#_http_request_5">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /account/850-7677-112404/transfer/targets HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /account/392-6355-379976/transfer/targets HTTP/1.1
Host: 127.0.0.1:8080</code></pre>
</div>
</div>
Expand All @@ -704,19 +704,19 @@ <h4 id="_http_response_5"><a class="link" href="#_http_response_5">HTTP response
"name" : "name1",
"email" : "member1@email.com",
"accountNumber" : {
"number" : "464-0302-900631"
"number" : "682-2485-454471"
}
}, {
"name" : "name2",
"email" : "member2@email.com",
"accountNumber" : {
"number" : "758-4846-349518"
"number" : "598-6513-982615"
}
}, {
"name" : "name3",
"email" : "member3@email.com",
"accountNumber" : {
"number" : "326-9571-076141"
"number" : "911-9317-784044"
}
} ]
}</code></pre>
Expand All @@ -735,7 +735,7 @@ <h3 id="_회원가입"><a class="link" href="#_회원가입">회원가입</a></h
<h4 id="_http_request_6"><a class="link" href="#_http_request_6">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /members/register?_csrf=34sve9Temr7aMJhUb4f1Qo0jvovlJtyHrl7vkIIMeArL9rRCvbpJTLLtrI73AKFsCqrBe7QRk7PSE-Sqy2yMpLdtHGjzkNV7 HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">POST /members/register?_csrf=pauP98MiCD0pkD1j8xSkdYi0BZmx3gEGGvNulkG4ZgpfVlqqlMi5waITawsE81hTwjmQFr_QKPuI6Dcrf8NY8HGIBDw-Yj-Z HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 82
Host: 127.0.0.1:8080
Expand Down Expand Up @@ -769,7 +769,7 @@ <h3 id="_사용자_조회"><a class="link" href="#_사용자_조회">사용자
<h4 id="_http_request_7"><a class="link" href="#_http_request_7">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /members/me?_csrf=UnsqoFc6E4ihDSmx3pI8-hibQkTM1xsghACkwoSvy1eIttfHY0pOxG8LdbqMPhnQ7r8Iziyob33-5HoNszCToLeerW-41-Sh HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /members/me?_csrf=1btyhtbOPqL6ctQNrMlIcPxO0vs6FqwJFGur4hAjKLhSC6WUt9oT4uGtWMTXSuQ_leR8E5kv_8INd8okIg3J0SIRTtlgM5On HTTP/1.1
Host: 127.0.0.1:8080</code></pre>
</div>
</div>
Expand Down Expand Up @@ -812,7 +812,7 @@ <h4 id="_http_request_8"><a class="link" href="#_http_request_8">HTTP request</a
Host: 127.0.0.1:8080
Content-Length: 102

_csrf=pvbSQimhJP2LCIPYEL-Dc6CpLhG0Q8ELUyEpJsbY9NoZSHw6ksDqJx6VEp6mO-LvI5K3EJDIAymEIvEmMkQfQ6fhx-t4LBkK</code></pre>
_csrf=D-TPusyG751k3y_3_WkSylvesR6PO8f0AiD0wywlzTp_NnN4OdL4jq6-jvxJ7BbPyEQm_zronCa8XfbZYxXNoRRBrl5HVxdB</code></pre>
</div>
</div>
</div>
Expand Down Expand Up @@ -842,7 +842,7 @@ <h4 id="_http_request_9"><a class="link" href="#_http_request_9">HTTP request</a
Host: 127.0.0.1:8080
Content-Length: 102

_csrf=9Pd-A3hTIMERbGsS6gfBRve8jfR8qhRZ9Kpr5LpYjCqQRAW7w8dPYUFlEfI8XA503Sr1IpPYoM1Fnix0l8xe14hg7h2oJ2OL</code></pre>
_csrf=8SWw0I5aNyJGbLzMaKYoqJbzKW7nXc6YDI0zBpbPPxu9LUr2kBeG5u9iVUdrXd30CYscmaHEBA_Ta6y1ab5WMvWpXHrfS3PG</code></pre>
</div>
</div>
</div>
Expand Down Expand Up @@ -872,7 +872,7 @@ <h4 id="_http_request_10"><a class="link" href="#_http_request_10">HTTP request<
Host: 127.0.0.1:8080
Content-Length: 102

_csrf=iLrlEA-fxuoPAtNN2JvdnZvS502L33FdCq0eSpbdGqqTHcZxvYzUJm38_okiYLZ8vrbpr6KzynXuvhNwaZkte_Pre5OiLaJF</code></pre>
_csrf=TOvcszaXbs-w9rDfK21pKOtzrsmnsYSojEgjq5asDl6Y6h_4f425ggOmXK6dz9TvHkBdHNsWg_CXhuCFuH4ayfCZO2362nnB</code></pre>
</div>
</div>
</div>
Expand All @@ -897,7 +897,7 @@ <h3 id="_친구_목록_조회"><a class="link" href="#_친구_목록_조회">친
<h4 id="_http_request_11"><a class="link" href="#_http_request_11">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /members/friends?_csrf=AweIcwrK3hnNO8M3HCMvRk91n6-RBC9rl6hvmtK1BbKlkoZkMTLpRDv57i7gWfFWKA4bcX9Ess2oMRxG85Fb-eGMNIPDpONV HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /members/friends?_csrf=f88i-ogrmA68K9wZXA3NFKRn6lPlPGAZ5iuVnLTPQeurWWIRGfZAmLsS_TeRHOl_aiD5LZ1VxzGDCAU01hzxrdf8JNPIb1sm HTTP/1.1
Host: 127.0.0.1:8080</code></pre>
</div>
</div>
Expand Down Expand Up @@ -937,7 +937,7 @@ <h3 id="_친구_신청_목록_조회"><a class="link" href="#_친구_신청_목
<h4 id="_http_request_12"><a class="link" href="#_http_request_12">HTTP request</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /members/friends/requests?_csrf=TerAKsV_WjqAgII27M5-Jh2_GbDDFpbI8OJWoE8YmSHogoe7eN_2GfQbb1itsLMH1eNKFiuGNImiLqTlw4Zlkywv-hDYtuaL HTTP/1.1
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">GET /members/friends/requests?_csrf=6XOio0ycsrcXIs_TdprVm2-8SXU4EkdwC4RtQ70q1ZZ7d9dHj0SWmi3_hoQ6EP2yRrfh-FrZZBdcIX5dabUJeosTtKJNROV0 HTTP/1.1
Host: 127.0.0.1:8080</code></pre>
</div>
</div>
Expand Down

0 comments on commit fb89a39

Please sign in to comment.