Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.0 #35

Merged
merged 58 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
acc52cb
Feat/user (#1)
cocoquiet Aug 9, 2024
405481a
Fix/user (#2)
cocoquiet Aug 10, 2024
7bd6d19
Feat/history (#4)
LAPLACE4A Aug 10, 2024
1cd8784
Fix/admin (#5)
cocoquiet Aug 10, 2024
0857d3a
Feat/admin (#7)
cocoquiet Aug 10, 2024
33f67f9
Feat: User 속성 추가 및 API 최적화 (#8)
cocoquiet Aug 11, 2024
8028cc9
Implement password management features (#10)
NishthaLath Aug 13, 2024
d5f2445
Feat/post (#11)
LAPLACE4A Aug 18, 2024
665df3b
add/ci (#18)
Village-GG-Water Aug 24, 2024
7114812
fix ci.yml
Village-GG-Water Aug 24, 2024
df04bea
Fix/history (#19)
LAPLACE4A Aug 24, 2024
8c9f151
Fix/post (#20)
NishthaLath Aug 26, 2024
ae3e7ab
Fix/password (#21)
LAPLACE4A Sep 2, 2024
102d05c
Fix/user (#22)
LAPLACE4A Sep 7, 2024
73db79a
Fix/admin (#23)
LAPLACE4A Sep 25, 2024
9ee620d
Feat/login (#24)
LAPLACE4A Sep 30, 2024
5771924
fix: login redirect loop, auth logic, add DTO (#26)
LAPLACE4A Oct 1, 2024
771ee8b
fix: post null annotation, CORS setting (#27)
LAPLACE4A Oct 2, 2024
51328de
Fix/cors (#28)
LAPLACE4A Oct 4, 2024
6936da5
Feat: Change config from h2-database to mysql
cocoquiet Oct 5, 2024
65ed5e8
Fix: Delete ouath2
cocoquiet Oct 6, 2024
aa75391
Feat: Modify mysql properties to env variable
cocoquiet Oct 6, 2024
4886c3c
Feat: Add EnvConfig
cocoquiet Oct 6, 2024
8f98e03
chore: modify application properties
LAPLACE4A Oct 10, 2024
9923ed9
fix: login, get user auth err
LAPLACE4A Oct 10, 2024
0e0e7eb
fix: users/id get controller logic
LAPLACE4A Oct 10, 2024
a70640c
fix: security filterchain
LAPLACE4A Oct 10, 2024
4f43b18
fix: user api auth check logic
LAPLACE4A Oct 10, 2024
f907b1a
fix: admin delete logic
LAPLACE4A Oct 10, 2024
c4a2111
fix: env db connection
LAPLACE4A Oct 11, 2024
9ea46a2
feat: jwt refresh token rotation
LAPLACE4A Oct 12, 2024
9c3ca54
fix: test dependency setting
Village-GG-Water Nov 2, 2024
80a1a82
test: add history api test
Village-GG-Water Nov 2, 2024
4df0d6d
chore: testHistory value
Village-GG-Water Nov 2, 2024
6ed4627
chore: history test merhod name
Village-GG-Water Nov 2, 2024
bde9986
fix: history test value matching
Village-GG-Water Nov 2, 2024
72046c1
test: add admin api test
Village-GG-Water Nov 2, 2024
bef63df
test: user api test wip
Village-GG-Water Nov 2, 2024
b8d2b22
test: user api test complete
Village-GG-Water Nov 2, 2024
1fd95c0
fix: test id variables
Village-GG-Water Nov 2, 2024
db69b58
fix: vaildation code, post api annotation
LAPLACE4A Nov 3, 2024
c0124ce
feat: post service logic with controller fix
LAPLACE4A Nov 3, 2024
2e418c7
Feat/log (#33)
LAPLACE4A Nov 4, 2024
2c7be6d
Delete unneccessary controller
LAPLACE4A Nov 6, 2024
fa4a947
fix: user delete method
LAPLACE4A Nov 6, 2024
c624e2a
fix: user test
Village-GG-Water Nov 7, 2024
9c57cb3
fix: admin, user delete method
LAPLACE4A Nov 7, 2024
cb4d6b9
chore: spring boot update, delete unneccessary import
LAPLACE4A Nov 7, 2024
84aaa7d
fix: admin user delete method
LAPLACE4A Nov 7, 2024
298dd48
fix: create post err
LAPLACE4A Nov 7, 2024
0802e79
fix: post user profile_image
LAPLACE4A Nov 7, 2024
92630a4
fix: post content, service name
LAPLACE4A Nov 7, 2024
a2cf87f
fix: user profile image size
LAPLACE4A Nov 7, 2024
f140adf
Create Dockerfile
Village-GG-Water Nov 8, 2024
6b21773
Create docker-entrypoint.sh
Village-GG-Water Nov 8, 2024
dd68f9d
Update README.md
Village-GG-Water Nov 8, 2024
2deddfb
Create cd.yml
Village-GG-Water Nov 8, 2024
c55ecf4
chore: edit cd.yml
Village-GG-Water Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CD

on:
push:
branches:
- main
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
deploy:
if: ${{ github.event_name == 'push' && github.actor != 'github-actions[bot]' }}
runs-on: 'self-hosted'
steps:
- name: Check out code
uses: actions/[email protected]

- name: Build with Gradle Wrapper
run: |
chmod +x ./gradlew
./gradlew clean build -x test

- name: Stop running service
run: docker compose down be --rmi local

- name: Start service
run: docker compose up be -d

86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# 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

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

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

#path에 gradle/caches 생기는대로 추가 예정
- name: Cache Gradle
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

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

- name: Generate Environment Variables File
run: |
echo "JWT_SECRET=$JWT_SECRET" >> .env
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

- name: Build with Gradle Wrapper
run: |
chmod +x ./gradlew
./gradlew build
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# with:
# gradle-version: '8.9'
#
# - name: Build with Gradle 8.9
# run: gradle build

dependency-submission:

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
HELP.md
.gradle
logs/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
.env

### STS ###
.apt_generated
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM bellsoft/liberica-openjdk-alpine:17

CMD ["./gradlew", "clean", "build"]

VOLUME /tmp

ARG JAR_FILE=build/libs/*-SNAPSHOT.jar

ENV DOCKERIZE_VERSION v0.8.0
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

COPY ${JAR_FILE} app.jar
COPY docker-entrypoint.sh docker-entrypoint.sh

RUN touch .env

RUN chmod +x docker-entrypoint.sh
ENTRYPOINT ./docker-entrypoint.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ git push origin dev

## 사용하는 프레임워크/라이브러리

### SpringBoot 3.3.2 + MySQL
### SpringBoot 3.3.5 + MySQL
20 changes: 19 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.2'
id 'org.springframework.boot' version '3.3.5'
id 'io.spring.dependency-management' version '1.1.6'
}

Expand All @@ -25,10 +25,28 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'com.mysql:mysql-connector-j'
implementation 'io.github.cdimascio:java-dotenv:5.2.2'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
developmentOnly 'org.springframework.boot:spring-boot-devtools'

testImplementation 'org.testcontainers:testcontainers'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'
testImplementation 'org.testcontainers:jdbc'
testImplementation 'org.springframework.security:spring-security-test'
}

tasks.named('test') {
Expand Down
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
echo "wait mysql server"
dockerize -wait tcp://kiw_mysql:3306 -timeout 20s

echo "start spring boot server"
java -jar /app.jar
31 changes: 31 additions & 0 deletions http/admin.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### GET request
GET localhost:8080/admin
Content-Type: application/json

### POST request
POST localhost:8080/admin
Content-Type: application/json

{
"student_id": 2024123456,
"generation": "2022.1",
"role": "president",
"description": "I am the president of the student council."
}

### GET request
GET localhost:8080/admin/2024123456

### PUT request
PUT localhost:8080/admin/2024123456
Content-Type: application/json

{
"student_id": 2024123456,
"generation": "2022.1",
"role": "vice-president",
"description": "I am the vice-president of the student council."
}

### DELETE request
DELETE localhost:8080/admin/2024123456
84 changes: 84 additions & 0 deletions http/users.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
### GET request
GET localhost:8080/users
Content-Type: application/json

### POST request
POST localhost:8080/users
Content-Type: application/json

{
"student_id": 2024123456,
"name": "홍길동",
"email": "[email protected]",
"profile_picture": "https://example.com/knu.jpg",
"generation": "2022.1",
"major": "asdf"
}

### POST request
GET localhost:8080/users/2024123456

### PUT request
PUT localhost:8080/users/2024123456
Content-Type: application/json

{
"name": "심청이",
"email": "[email protected]",
"profile_picture": "https://example.com/simcom.jpg",
"generation": "2022.1",
"major": "심컴"
}

### DELETE request
DELETE localhost:8080/users/2024123456

### Signup
POST http://localhost:8080/users/signup
Content-Type: application/json

{
"studentId": 2024123456,
"name": "홍길동",
"email": "[email protected]",
"profilePicture": "https://example.com/knu.jpg",
"generation": "2022.1",
"major": "asdf",
"password": "password123"
}

###

### Login
POST http://localhost:8080/users/login
Content-Type: application/json

{
"studentId": 2024123456,
"password": "password123"
}

###

### Get All Users
GET http://localhost:8080/users

###

### Get User by ID
GET http://localhost:8080/users/1

###

### Update User
PUT http://localhost:8080/users/1
Content-Type: application/json

{
"name": "John Doe Updated"
}

###

### Delete User
DELETE http://localhost:8080/users/1
Binary file added local.mv.db
Binary file not shown.
Loading
Loading