Skip to content

Commit

Permalink
envers 실습
Browse files Browse the repository at this point in the history
  • Loading branch information
injun.son committed Dec 30, 2022
1 parent 8d29ca6 commit 7d3a64d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.springframework.cloud:spring-cloud-starter")
implementation("org.springframework.data:spring-data-envers")

implementation("org.springframework.boot:spring-boot-starter-cache")
implementation("com.github.ben-manes.caffeine:caffeine:3.1.1")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.example.sokdak.member.controller

import com.example.sokdak.member.dto.request.ChangeRoleRequest
import com.example.sokdak.member.dto.request.CreateMemberRequest
import com.example.sokdak.member.dto.response.ChangeRoleResponse
import com.example.sokdak.member.dto.response.CreateMemberResponse
import com.example.sokdak.member.dto.response.FindMemberResponse
import com.example.sokdak.member.service.MemberService
Expand All @@ -25,4 +27,9 @@ class MemberController(
fun findMemberById(@PathVariable id: Long): ResponseEntity<FindMemberResponse> {
return ResponseEntity.ok(memberService.findMemberById(id))
}

@PatchMapping("/role")
fun changeRole(@RequestBody request: ChangeRoleRequest): ResponseEntity<ChangeRoleResponse> {
return ResponseEntity.ok(memberService.changeRole(request))
}
}
2 changes: 2 additions & 0 deletions src/main/kotlin/com/example/sokdak/member/domain/Member.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.example.sokdak.member.domain

import org.hibernate.envers.Audited
import javax.persistence.*

@Audited
@Entity
class Member(
@Embedded
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:h2:mem:db;MODE=MYSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
url: jdbc:h2:tcp://localhost/~/test
driver-class-name: org.h2.Driver
username: sa

Expand Down

0 comments on commit 7d3a64d

Please sign in to comment.