Skip to content

Commit

Permalink
release: v0.0.1 (#33)
Browse files Browse the repository at this point in the history
* feat: ๋„๋ฉ”์ธ ์—”ํ‹ฐํ‹ฐ ์ƒ์„ฑ (#2)

* feat/#1: BaseTimeEntity ์ƒ์„ฑ

* feat/#1: Contact Entity ์ƒ์„ฑ

* feat/#1: Store Entity ์ƒ์„ฑ

* feat/#1: Recommendation Entity ์ƒ์„ฑ

* feat/#1: StoreImage Entity ์ƒ์„ฑ

* feat/#1: Theme Entity ์ƒ์„ฑ

* feat/#1: SongForm Entity ์ƒ์„ฑ

* chore/#1: ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€ ์ธก์ • ์ œ์™ธ ์„ค์ • (์ œ๊ฑฐ ์˜ˆ์ •)

* chore/#1: sonarCloud projectKey ์ˆ˜์ •

* chore: ์„œ๋ธŒ ๋ชจ๋“ˆ ํŒจํ‚ค์ง€๋ช… ๋ณ€๊ฒฝ

* feat: ๋ฉ”์ธ ํŽ˜์ด์ง€ ๋งค์žฅ ๋ชฉ๋ก ์กฐํšŒ API ๊ตฌํ˜„ (#8)

* feat/#3: StoreRepository.findAllByOrderByCreatedAtAsc ๊ตฌํ˜„

* feat/#3: StoreService.findSimpleStores ๊ตฌํ˜„

* feat/#3: stores ์ •๋ ฌ ๊ธฐ์ค€์„ storeId ๋กœ ๋ณ€๊ฒฝ

* feat/#3: DataBaseCleaner ๊ตฌํ˜„

* feat/#3: StoreController.findSimpleStores ๊ตฌํ˜„

* feat/#3: test application.yml ์ถ”๊ฐ€

* feat/#3: ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€ ๋Œ€์ƒ์— domain ํŒจํ‚ค์ง€ ์ถ”๊ฐ€

* feat/#3: ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€ ๋Œ€์ƒ์— vo ํŒจํ‚ค์ง€ ์ œ์™ธ

* chore: jacoco ๋ ˆํฌํŠธ๋ฅผ sonarcloud ์— ๋ฐ˜์˜ (#10)

* chore/#9: jacoco ๋ ˆํฌํŠธ๋ฅผ sonarcloud ์— ๋ฐ˜์˜

* chore/#9: ci run ์— jacocoTestReport ์ถ”๊ฐ€

* feat: ๋งค์žฅ ๋ชฉ๋ก ์กฐํšŒ API ๊ตฌํ˜„ (#11)

* feat/#4: StoreRepository.findAllByRegionOrderByStoreIdAsc ๊ตฌํ˜„

* feat/#4: StoreService.findStores ๊ตฌํ˜„

* feat/#4: Store ์— Theme, SongForm ์ •๋ณด ์ถ”๊ฐ€

* feat/#4: StoreController.storeService ๊ตฌํ˜„

* feat/#4: jacocoExcludePatterns ์ถ”๊ฐ€

* feat/#4: jacoco ์„ค์ • ๋ณ€๊ฒฝ

* feat: ์Œ์•… ์ถ”์ฒœ API ๊ตฌํ˜„ (#12)

* feat/#5: PhoneNumber ์ƒ์„ฑ

* feat/#5: RecommendationInformation ์ƒ์„ฑ

* feat/#5: Recommendation ์ƒ์„ฑ

* feat/#5: RecommendationRepository ์ƒ์„ฑ

* feat/#5: RecommendationService.registerRecommendation ๊ตฌํ˜„

* feat/#5: RecommendationController.registerRecommendation ๊ตฌํ˜„

* feat/#5: ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€ ๋Œ€์ƒ์— recommendation ํŒจํ‚ค์ง€ ์ถ”๊ฐ€

* feat: ๋ฌธ์˜ API ๊ตฌํ˜„ (#13)

* feat/#6: ContactUserName ์ƒ์„ฑ

* feat/#6: ContactContent ์ƒ์„ฑ

* feat/#6: Contact ์ƒ์„ฑ

* feat/#6: ContactRepository ์ƒ์„ฑ

* feat/#6: ContactService.registerContact ๊ตฌํ˜„

* feat/#6: ContactController.registerContact ๊ตฌํ˜„

* feat/#6: ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€ ๋Œ€์ƒ์— contact ํŒจํ‚ค์ง€ ์ถ”๊ฐ€

* feat: ๋ฌธ์˜ ๋“ฑ๋ก, ์Œ์•… ์ถ”์ฒœ ๋ฉ”์ผ ํ‘ธ์‰ฌ ์•Œ๋ฆผ ๊ธฐ๋Šฅ ๊ตฌํ˜„ (#14)

* feat/#7: MailService.sendMail ๊ตฌํ˜„

* feat/#7: ๋ฌธ์˜ ๋“ฑ๋ก, ์Œ์•… ์ถ”์ฒœ ์š”์ฒญ ์‹œ ์ด๋ฉ”์ผ ์•Œ๋ฆผ ์ „์†ก ๊ธฐ๋Šฅ ์ถ”๊ฐ€

* chore: dev, prod profile ์„ค์ • (#16)

* chore: ๊ฐœ๋ฐœ ์„œ๋ฒ„ ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์ž‘์„ฑ (#18)

* chore/#17: ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์ž‘์„ฑ

* chore/#17: CD ์„ค์ •

* chore: CodeDeploy ์„ค์ •ํŒŒ์ผ ๋ณ€๊ฒฝ (#20)

* chore: appspec.yml ์˜คํƒ€ ์ˆ˜์ •

* chore: owner ์ˆ˜์ •

* chore: ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ •

* chore: ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ •

* docs: API ๋ฌธ์„œํ™” (#23)

* docs/#21: RestDocs ์˜์กด์„ฑ ์ถ”๊ฐ€ ๋ฐ BaseControllerTest ์ƒ์„ฑ

* docs/#21: Controller ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ ๋ฐ ๋ฌธ์„œํ™”

* docs/#21: ์ฃผ์„ ์ œ๊ฑฐ

* docs/#21: index.html ์ƒ์„ฑ

* chore: ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ • (#25)

* refactor/#22: ๋ฉ”์ผ ํ‘ธ์‰ฌ ์•Œ๋ฆผ ๋ถ„๋ฆฌ (#27)

* refactor/#22: MailSendEvent, MailSendListener ์ƒ์„ฑ

* refactor/#22: AsyncConfig ์ƒ์„ฑ

* refactor/#22: SpringMailService.sendMail @async ์ ์šฉ ๋ฐ ์žฌ์‹œ๋„ ๋ฉ”์นด๋‹ˆ์ฆ˜ ๊ตฌํ˜„

* refactor/#22: EventPublisher ๋ฅผ ์‚ฌ์šฉํ•œ ๋ฉ”์ผ ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ

* refactor/#22: ๋ฉ”์ผ ์ „์†ก ์žฌ์‹œ๋„ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ถ”๊ฐ€

* feat: ์•Œ๋ฆผ(Notification) ์—”ํ‹ฐํ‹ฐ ์ƒ์„ฑ (#28)

* chore: ๋กœ๊ทธ์— ์‹œ๊ฐ„์ด ๋‚˜์˜ค๋„๋ก ๋ฐฐํฌ ์ŠคํŠธ๋ฆฝํŠธ ์ˆ˜์ • (#30)

* chore: ๋ฐฐํฌ ํ™˜๊ฒฝ ์„ค์ • (#32)
  • Loading branch information
pushedrumex authored Feb 22, 2024
1 parent 251929f commit 8d9fa9e
Show file tree
Hide file tree
Showing 83 changed files with 4,293 additions and 6 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CD

on:
push:
branches: [ "main" ]

env:
S3_BUCKET_NAME: verby-bucket
PROJECT_NAME: indp-server

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ACTIONS_TOKEN }}
submodules: true

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

- name: Build with Gradle
run: ./gradlew clean build

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

- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
aws-access-key-id: ${{ secrets.AWS_ACCESS }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS }}

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip

- name: Code Deploy
run: |
aws deploy create-deployment \
--application-name verby-deploy \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name verby-dev \
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip \
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/main/resources/sever-secrets"]
path = src/main/resources/sever-secrets
url = https://github.com/team-verby/sever-secrets.git
[submodule "src/main/resources/server-secrets"]
path = src/main/resources/server-secrets
url = https://github.com/team-verby/server-secrets.git
18 changes: 18 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/app/indp-server
overwrite: true

permissions:
- object: /
pattern: "**"
owner: ubuntu
group: ubuntu

hooks:
ApplicationStart:
- location: scripts/deploy.sh
timeout: 180
runas: ubuntu
49 changes: 47 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ plugins {

id "org.sonarqube" version "4.4.1.3373"
id 'jacoco'

id "org.asciidoctor.jvm.convert" version "3.3.2"
}

group = 'com.verby'
Expand All @@ -18,6 +20,7 @@ configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExt
}

repositories {
Expand All @@ -32,13 +35,54 @@ dependencies {
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'io.rest-assured:rest-assured:5.4.0'
implementation 'org.springframework.boot:spring-boot-starter-mail:3.2.2'

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

test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}

// RestDocs
ext {
snippetsDir = file("build/generated-snippets")
}

test {
outputs.dir snippetsDir
}

asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'
dependsOn test
}

asciidoctor.doFirst {
delete file('src/main/resources/static/docs')
}

task copyDocument(type: Copy) {
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}

build {
dependsOn copyDocument
}

bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}

// Jacoco
def jacocoDir = layout.buildDirectory.dir("reports/")

Expand All @@ -55,7 +99,8 @@ def jacocoExcludePatterns = [
"**/*Interceptor*",
"**/*Filter*",
"**/*Resolver*",
"**/resources/**"
"**/resources/**",
"**/common/**"
]

def excludedClassFilesForReport(classDirectories, jacocoExcludePatterns) {
Expand Down Expand Up @@ -106,7 +151,7 @@ jacocoTestCoverageVerification {
// SonarCloud
sonar {
properties {
property "sonar.projectKey", "team-verby_test-repository"
property "sonar.projectKey", "team-verby_indp-server"
property "sonar.organization", "team-verby"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.exclusions", jacocoExcludePatterns.join(",")
Expand Down
35 changes: 35 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
PROJECT_ROOT=/home/ubuntu/app
PROJECT_NAME=indp-server
APPLICATION_NAME=indp

DEPLOY_PATH=$PROJECT_ROOT/deploy

APP_LOG=$DEPLOY_PATH/application.log
ERROR_LOG=$DEPLOY_PATH/deploy-error.log
DEPLOY_LOG=$DEPLOY_PATH/deploy.log

mkdir $DEPLOY_PATH

echo "------------------------------------------------------------------------------------" >> $DEPLOY_LOG

echo "[ $(date +%c) ] Build ํŒŒ์ผ ๋ณต์‚ฌ" >> $DEPLOY_LOG
cp $PROJECT_ROOT/$PROJECT_NAME/build/libs/*.jar $DEPLOY_PATH/

echo "[ $(date +%c) ] ํ˜„์žฌ ๊ตฌ๋™ ์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ pid ํ™•์ธ" >> $DEPLOY_LOG
CURRENT_PID=$(pgrep -f $APPLICATION_NAME)

echo "[ $(date +%c) ] ํ˜„์žฌ ๊ตฌ๋™ ์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ pid: $CURRENT_PID" >> $DEPLOY_LOG
if [ -z "$CURRENT_PID" ]; then
echo "[ $(date +%c) ] ํ˜„์žฌ ๊ตฌ๋™ ์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์—†์œผ๋ฏ€๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค." >> $DEPLOY_LOG
else
echo "[ $(date +%c) ] kill -15 $CURRENT_PID" >> $DEPLOY_LOG
kill -15 "$CURRENT_PID"
sleep 5
fi

echo "[ $(date +%c) ] ์ƒˆ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฐฐํฌ" >> $DEPLOY_LOG

JAR_NAME=$(ls -tr "$DEPLOY_PATH" | grep jar | tail -n 1)

echo "[ $(date +%c) ] JAR Name: $JAR_NAME" >> $DEPLOY_LOG
nohup java -jar $DEPLOY_PATH/"$JAR_NAME" --spring.profiles.active=prod > $APP_LOG 2> $ERROR_LOG &
52 changes: 52 additions & 0 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
= Indp Application API Document
:doctype: book
:source-highlighter: highlightjs
:sectlinks:
:toc: left
:toclevels: 3

== ๋งค์žฅ (Store)

=== ๋งค์žฅ ๋ชฉ๋ก ์กฐํšŒ (๊ฐ„๋‹จ ์ •๋ณด)

==== Request

operation::store-controller-test/find-simple-stores[snippets='http-request,query-parameters']

==== Response

operation::store-controller-test/find-simple-stores[snippets='http-response,response-fields']

=== ๋งค์žฅ ๋ชฉ๋ก ์กฐํšŒ

==== Request

operation::store-controller-test/find-stores[snippets='http-request,query-parameters']

==== Response

operation::store-controller-test/find-stores[snippets='http-response,response-fields']

== ์Œ์•… ์ถ”์ฒœ (Recommendation)

=== ์Œ์•… ์ถ”์ฒœํ•˜๊ธฐ

==== Request

operation::recommendation-controller-test/register-recommendation[snippets='http-request,request-fields']

==== Response

operation::recommendation-controller-test/register-recommendation[snippets='http-response,response-headers']

== ๋ฌธ์˜ (Contact)

=== ๋ฌธ์˜ํ•˜๊ธฐ

==== Request

operation::contact-controller-test/register-contact[snippets='http-request,request-fields']

==== Response

operation::contact-controller-test/register-contact[snippets='http-response,response-headers']
5 changes: 5 additions & 0 deletions src/main/java/com/verby/indp/domain/common/dto/PageInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.verby.indp.domain.common.dto;

public record PageInfo(long totalElements, boolean hasNext) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.verby.indp.domain.common.entity;

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

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseTimeEntity {

@CreatedDate
@Column(name = "created_at", updatable = false)
protected LocalDateTime createdAt;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.verby.indp.domain.common.event;

import com.verby.indp.domain.notification.dto.Mail;

public record MailSendEvent(
Mail mail
) {
}
18 changes: 18 additions & 0 deletions src/main/java/com/verby/indp/domain/common/vo/Address.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.verby.indp.domain.common.vo;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Embeddable
@AllArgsConstructor
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED)
public class Address {

@Column(name = "address")
private String address;

}
51 changes: 51 additions & 0 deletions src/main/java/com/verby/indp/domain/common/vo/PhoneNumber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.verby.indp.domain.common.vo;

import static java.util.Objects.isNull;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import java.util.Objects;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Embeddable
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED)
public class PhoneNumber {

private static final String PHONE_NUMBER_PATTERN = "^[0-9]+$";
private static final int MAX_PHONE_NUMBER_SIZE = 50;

@Column(name = "phone_number")
private String phoneNumber;

public PhoneNumber(String phoneNumber) {
validatePhoneNumber(phoneNumber);

this.phoneNumber = phoneNumber;
}

private void validatePhoneNumber(String phoneNumber) {
validateBlank(phoneNumber);
validateSize(phoneNumber);
validateValue(phoneNumber);
}

private void validateSize(String phoneNumber) {
if (phoneNumber.length() > MAX_PHONE_NUMBER_SIZE) {
throw new IllegalArgumentException("์ „ํ™” ๋ฒˆํ˜ธ์˜ ํฌ๊ธฐ๋Š” ์ตœ๋Œ€ 50์ž ์ž…๋‹ˆ๋‹ค.");
}
}

private void validateValue(String phoneNumber) {
if (!phoneNumber.matches(PHONE_NUMBER_PATTERN)) {
throw new IllegalArgumentException("์ „ํ™” ๋ฒˆํ˜ธ๋Š” ์ˆซ์ž๋งŒ ์ž…๋ ฅ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.");
}
}

private void validateBlank(String phoneNumber) {
if (isNull(phoneNumber) || phoneNumber.isBlank()) {
throw new IllegalArgumentException("์ „ํ™” ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
}
}
}
Loading

0 comments on commit 8d9fa9e

Please sign in to comment.