Skip to content

Commit

Permalink
Actions (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bayle0627 authored Jan 2, 2025
1 parent fb22f4d commit 4390423
Show file tree
Hide file tree
Showing 20 changed files with 170 additions and 128 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ name: Kotlin Lint Check
on:
push:
branches:
- actions
- main
- develop
pull_request:
branches:
- actions
- main
- develop

Expand All @@ -18,14 +20,39 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

# 1. Docker 및 Docker Compose 설치
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
# 2. Docker Compose로 DB 시작
- name: Start Database with Docker Compose
run: |
docker-compose up -d mysql
working-directory: .

# 3. DB 준비 시간 대기
- name: Wait for Database
run: |
until nc -z localhost 3306; do
echo "Waiting for the database to be ready..."
sleep 5
done
# 4. Java 환경 설정
- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'amazon-corretto'# 필요한 Java 버전 설정

- name: Install dependencies
run: ./gradlew clean build # Gradle 의존성 설치 및 빌드
distribution: 'corretto'

# 5. Gradle 의존성 설치 및 Ktlint 검사 실행
- name: Run Ktlint
run: ./gradlew ktlintCheck # Ktlint 검사 실행
run: ./gradlew ktlintCheck

# 6. Docker Compose 정리
- name: Stop Database
run: |
docker-compose down
working-directory: .
57 changes: 29 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
plugins {
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25"
id("org.springframework.boot") version "3.4.1"
id("io.spring.dependency-management") version "1.1.7"
kotlin("plugin.jpa") version "1.9.25"
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25"
id("org.springframework.boot") version "3.4.1"
id("io.spring.dependency-management") version "1.1.7"
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
kotlin("plugin.jpa") version "1.9.25"
}

group = "com.wafflestudio.toyproject"
version = "0.0.1-SNAPSHOT"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.mindrot:jbcrypt:0.4")
implementation("com.mysql:mysql-connector-j:8.2.0")
implementation("io.jsonwebtoken:jjwt-api:0.11.5")
implementation("io.jsonwebtoken:jjwt-impl:0.11.5")
implementation("io.jsonwebtoken:jjwt-jackson:0.11.5")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
testImplementation("org.springframework.boot:spring-boot-starter-test")
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.mindrot:jbcrypt:0.4")
implementation("com.mysql:mysql-connector-j:8.2.0")
implementation("io.jsonwebtoken:jjwt-api:0.11.5")
implementation("io.jsonwebtoken:jjwt-impl:0.11.5")
implementation("io.jsonwebtoken:jjwt-jackson:0.11.5")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
}
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}

allOpen {
annotation("jakarta.persistence.Entity")
annotation("jakarta.persistence.MappedSuperclass")
annotation("jakarta.persistence.Embeddable")
annotation("jakarta.persistence.Entity")
annotation("jakarta.persistence.MappedSuperclass")
annotation("jakarta.persistence.Embeddable")
}

tasks.withType<Test> {
useJUnitPlatform()
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wafflestudio.toyproject.memo_with_tags
package com.wafflestudio.toyproject.memoWithTags

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
Expand All @@ -7,5 +7,5 @@ import org.springframework.boot.runApplication
class MemoWithTagsApplication

fun main(args: Array<String>) {
runApplication<MemoWithTagsApplication>(*args)
runApplication<MemoWithTagsApplication>(*args)
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
package com.wafflestudio.toyproject.memo_with_tags.memo.controller
package com.wafflestudio.toyproject.memoWithTags.memo.controller

import com.wafflestudio.toyproject.memo_with_tags.memo.service.MemoService
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestParam
import com.wafflestudio.toyproject.memoWithTags.memo.service.MemoService
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
import java.time.Instant

@RestController
class MemoController(
private val memoService: MemoService
) {
@PostMapping("/api/v1/memo")
fun createMemo(@RequestBody request: CreateMemoRequest): MemoDto {
fun createMemo(@RequestBody request: CreateMemoResponse): MemoDto {
return MemoDto("", emptyList())
}

@PutMapping("/api/v1/memo/{memoId}")
fun updateMemo(@PathVariable memoId: Long, @RequestBody request: UpdateMemoRequest): MemoDto {
fun updateMemo(@PathVariable memoId: Long, @RequestBody request: UpdateMemoResponse): MemoDto {
return MemoDto("", emptyList())
}

@DeleteMapping("/api/v1/memo/{memoId}")
Expand All @@ -42,4 +47,4 @@ data class UpdateMemoResponse(
val tags: List<Long>,
val createdAt: Instant,
val updatedAt: Instant
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.wafflestudio.toyproject.memoWithTags.memo.persistence

class MemoEntity
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wafflestudio.toyproject.memoWithTags.memo.service

import org.springframework.stereotype.Service

@Service
class MemoService
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.wafflestudio.toyproject.memoWithTags.tag.controller

import com.wafflestudio.toyproject.memoWithTags.tag.service.TagService
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController

@RestController
class TagController(
private val tagService: TagService
) {
@GetMapping("/api/v1/tag")
fun getTags(): List<TagDto> {
return emptyList() // 빈 리스트 반환
}

@PostMapping("/api/v1/tag")
fun createTag(@RequestBody request: CreateTagRequest): TagDto {
return TagDto(0L, "", "") // 기본값으로 TagDto 반환
}

@PutMapping("/api/v1/tag/{tagId}")
fun updateTag(@PathVariable id: Long, @RequestBody request: UpdateTagRequest): TagDto {
return TagDto(0L, "", "") // 기본값으로 TagDto 반환
}

@DeleteMapping("/api/v1/tag/{tagId}")
fun deleteTag(@PathVariable id: Long) {
// 반환 타입이 Unit이므로 아무 작업 없이 비워 둬도 OK
}
}

data class TagDto(
val id: Long,
val name: String,
val color: String
)

data class CreateTagRequest(
val name: String,
val color: String
)

data class UpdateTagRequest(
val name: String,
val color: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.wafflestudio.toyproject.memoWithTags.tag.persistence

class TagEntity
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wafflestudio.toyproject.memoWithTags.tag.service

import org.springframework.stereotype.Service

@Service
class TagService
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
package com.wafflestudio.toyproject.memo_with_tags.user.contoller
package com.wafflestudio.toyproject.memoWithTags.user.controller

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController

@RestController
class UserController(
class UserController {

) {
@GetMapping("/api/v1/auth/register")
fun register(@RequestBody request: RegisterRequest): RegisterResponse {

return RegisterResponse("", "", 0L) // 기본값으로 RegisterResponse 반환
}

@PostMapping("/api/v1/auth/login")
fun login(@RequestBody request: LoginRequest): LoginResponse {

return LoginResponse("", "", 0L) // 기본값으로 LoginResponse 반환
}

@PostMapping("/api/v1/auth/logout")
fun logout(@RequestBody request: LogoutRequest) {

// 반환 타입이 Unit이므로 아무 작업 없이 비워 둬도 OK
}

@PostMapping("/api/v1/auth/verify-email")
fun verifyEmail(@RequestBody request: VerifyEmailRequest) {

// 반환 타입이 Unit이므로 아무 작업 없이 비워 둬도 OK
}

@PostMapping("/api/v1/auth/forgot-password")
fun forgotPassword(@RequestBody request: ForgotPasswordRequest) {

// 반환 타입이 Unit이므로 아무 작업 없이 비워 둬도 OK
}

@PostMapping("/api/v1/auth/reset-password")
fun resetPassword(@RequestBody request: ResetPasswordRequest) {

// 반환 타입이 Unit이므로 아무 작업 없이 비워 둬도 OK
}

@PostMapping("/api/v1/auth/refresh-token")
fun refreshToken(): RefreshTokenResponse {

return RefreshTokenResponse("", "", 0L) // 기본값으로 RefreshTokenResponse 반환
}

}

data class RegisterRequest(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.wafflestudio.toyproject.memoWithTags.user.persistence

class UserEntity
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.wafflestudio.toyproject.memoWithTags.user.service

class UserService

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4390423

Please sign in to comment.