Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ out/
.env.*
!.env.example
application-secret.yml

### oh-my-claudecode ###
.omc/
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '2.3.21'
id 'org.jetbrains.kotlin.plugin.spring' version '2.3.21'
id 'org.jetbrains.kotlin.plugin.jpa' version '2.3.21'
id 'org.springframework.boot' version '4.1.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.google.cloud.tools.jib' version '3.5.3'
Expand Down Expand Up @@ -34,7 +35,10 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly 'com.h2database:h2'
Comment thread
swonny marked this conversation as resolved.
Outdated
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
testImplementation platform('io.kotest:kotest-bom:6.1.5')
testImplementation 'io.kotest:kotest-runner-junit5'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.mogumogu.momogo.global.config

import org.springframework.context.annotation.Configuration
import org.springframework.data.jpa.repository.config.EnableJpaAuditing

@Configuration
@EnableJpaAuditing
class JpaConfig
22 changes: 22 additions & 0 deletions src/main/kotlin/com/mogumogu/momogo/global/entity/BaseEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mogumogu.momogo.global.entity

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

@MappedSuperclass
@EntityListeners(AuditingEntityListener::class)
abstract class BaseEntity {

@CreatedDate
@Column(updatable = false, nullable = false)
lateinit var createdAt: LocalDateTime

@LastModifiedDate
@Column(nullable = false)
lateinit var updatedAt: LocalDateTime
}
9 changes: 9 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ spring:
config:
activate:
on-profile: dev
datasource:
url: jdbc:postgresql://${DB_HOST}:${DB_PORT:5432}/${DB_NAME}
driver-class-name: org.postgresql.Driver
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
jpa:
hibernate:
ddl-auto: validate
show-sql: false

server:
shutdown: graceful
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ spring:
config:
activate:
on-profile: local
datasource:
url: jdbc:h2:mem:momogo;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driver-class-name: org.h2.Driver
username: sa
password:
h2:
console:
enabled: true
path: /h2-console
jpa:
hibernate:
ddl-auto: create-drop
show-sql: true
properties:
hibernate:
format_sql: true

logging:
level:
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ spring:
config:
activate:
on-profile: prod
datasource:
url: jdbc:postgresql://${DB_HOST}:${DB_PORT:5432}/${DB_NAME}
driver-class-name: org.postgresql.Driver
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
jpa:
hibernate:
ddl-auto: validate
show-sql: false

server:
shutdown: graceful
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ spring:
on-profile: test
main:
banner-mode: off
datasource:
url: jdbc:h2:mem:momogo-test;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driver-class-name: org.h2.Driver
username: sa
password:
jpa:
hibernate:
ddl-auto: create-drop
show-sql: false

logging:
level:
Expand Down