Skip to content

Commit

Permalink
refacor: JPA제거 및 redis Reactive로 통일
Browse files Browse the repository at this point in the history
  • Loading branch information
van1164 committed Jun 6, 2024
1 parent da0c8b0 commit fcdc188
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 302 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.van1164.security

import com.van1164.common.redis.RedisR2dbcService
import com.van1164.common.redis.RedisService
import com.van1164.common.security.PrincipalDetails
import com.van1164.common.util.Utils.logger
import com.van1164.user.UserService
Expand All @@ -16,7 +16,7 @@ import reactor.core.publisher.Mono
@Component(value = "authenticationSuccessHandler")
class OAuthSuccessHandlerReactive(
val userService: UserService,
val redisService: RedisR2dbcService,
val redisService: RedisService,
val jwtTokenProvider: JwtTokenProvider,
) : ServerAuthenticationSuccessHandler {
override fun onAuthenticationSuccess(
Expand Down
1 change: 0 additions & 1 deletion user/src/main/kotlin/com/van1164/user/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import reactor.core.publisher.Mono


@Service
@EnableR2dbcRepositories(basePackageClasses = [UserRepository::class])
class UserService(
val userRepository: UserRepository
) {
Expand Down
4 changes: 4 additions & 0 deletions user/src/main/kotlin/com/van1164/user/config/UserConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.van1164.user.config

class UserConfig {
}
1 change: 0 additions & 1 deletion util/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test")
implementation("org.springframework.boot:spring-boot-starter-data-redis-reactive")
implementation("com.amazonaws:aws-java-sdk-s3:1.12.638")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
}

tasks.test {
Expand Down
4 changes: 4 additions & 0 deletions util/src/main/kotlin/com/van1164/common/config/R2dbcConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.van1164.common.config

class R2dbcConfig {
}
21 changes: 0 additions & 21 deletions util/src/main/kotlin/com/van1164/common/domain/BaseEntity.kt

This file was deleted.

22 changes: 2 additions & 20 deletions util/src/main/kotlin/com/van1164/common/domain/LiveStream.kt
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
package com.van1164.common.domain

import com.van1164.common.dto.StreamDTO
import jakarta.persistence.*
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.annotation.Id
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*


@Entity
@Table(name = "live_stream")
data class LiveStream(

@Column(name = "title")
var title : String,
@Column(name = "description")
var description : String,

@Column(name = "user_name")
val userName : String,

@Column(name = "stream_key")
val streamKey : String,

@CreatedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_date", nullable = false)
val createdDate : LocalDateTime= LocalDateTime.now(),
val createdDate : LocalDateTime = LocalDateTime.now(),

@Column(name = "on_air")
var onAir : Boolean = false,

@Id
@org.springframework.data.annotation.Id
@GeneratedValue(strategy = GenerationType.AUTO)
val id : Long? = null,

@Column(name = "good")
var good : Int = 0,

@Column(name = "bad")
var bad : Int = 0,

){
Expand Down
69 changes: 32 additions & 37 deletions util/src/main/kotlin/com/van1164/common/domain/SubComment.kt
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
package com.van1164.common.domain

import com.van1164.common.domain.comment.Comment
import jakarta.persistence.*
import lombok.ToString
import java.util.*


@Entity
@Table(name = "sub_comment")
data class SubComment(
@Column(name = "message")
val message: String,

@ManyToOne
@ToString.Exclude
@JoinColumn(name = "user_id")
val user: User,

@ManyToOne
@ToString.Exclude
@JoinColumn(name = "comment_id")
val comment: Comment,


@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_at", nullable = false)
val createDate : Date,

@Column(name = "good")
var good: Int = 0,

@Column(name = "bad")
var bad: Int = 0,

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "sub_comment_id")
val id: Long? = null
)
//@Entity
//@Table(name = "sub_comment")
//data class SubComment(
// @Column(name = "message")
// val message: String,
//
// @ManyToOne
// @ToString.Exclude
// @JoinColumn(name = "user_id")
// val user: User,
//
// @ManyToOne
// @ToString.Exclude
// @JoinColumn(name = "comment_id")
// val comment: Comment,
//
//
// @Temporal(TemporalType.TIMESTAMP)
// @Column(name = "created_at", nullable = false)
// val createDate : Date,
//
// @Column(name = "good")
// var good: Int = 0,
//
// @Column(name = "bad")
// var bad: Int = 0,
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "sub_comment_id")
// val id: Long? = null
//)
38 changes: 0 additions & 38 deletions util/src/main/kotlin/com/van1164/common/domain/User.kt

This file was deleted.

4 changes: 2 additions & 2 deletions util/src/main/kotlin/com/van1164/common/domain/UserR2dbc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package com.van1164.common.domain

import com.van1164.common.dto.OAuthProvider
import com.van1164.common.dto.Role
import jakarta.persistence.Table
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.annotation.Id
//import org.springframework.data.relational.core.mapping.Table
import java.time.LocalDateTime

@Table(name = "user_r2dbc")
//@Table(name = "user_r2dbc")
data class UserR2dbc(

val userId: String,
Expand Down
47 changes: 0 additions & 47 deletions util/src/main/kotlin/com/van1164/common/domain/Video.kt

This file was deleted.

2 changes: 0 additions & 2 deletions util/src/main/kotlin/com/van1164/common/domain/VideoLike.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.van1164.common.domain

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table

@Table("video_like")
data class VideoLike(

val videoId : Long,
Expand Down
3 changes: 1 addition & 2 deletions util/src/main/kotlin/com/van1164/common/domain/VideoView.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.van1164.common.domain

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table

@Table("video_view")

data class VideoView(

val videoId : Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.van1164.common.domain.comment

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table

@Table("comment_bad")
data class CommentBad(
val commentId : Long,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.van1164.common.domain.comment

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table

@Table("comment_like")
data class CommentLike(

val commentId : Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class RedisConfig {
redisTemplate.connectionFactory = redisConnectionFactory()
redisTemplate.keySerializer = StringRedisSerializer()
redisTemplate.valueSerializer = StringRedisSerializer()
redisTemplate.setEnableTransactionSupport(true)
redisTemplate.afterPropertiesSet()
return redisTemplate
}
Expand Down

This file was deleted.

Loading

0 comments on commit fcdc188

Please sign in to comment.