-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/Dev-backend' into build/#10-back…
…end-cicd
- Loading branch information
Showing
20 changed files
with
191 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/env | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ langchain==0.0.332 | |
python-dotenv==1.0.0 | ||
openai==0.28.0 | ||
uvicorn==0.28.0 | ||
pika | ||
fastapi | ||
pika==1.3.2 | ||
fastapi==0.110.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
backend/core/src/main/java/com/rollthedice/backend/global/advice/ExceptionAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.rollthedice.backend.global.advice; | ||
|
||
import com.rollthedice.backend.global.jwt.exception.NotFoundTokenException; | ||
import org.springframework.http.HttpEntity; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class ExceptionAdvice { | ||
@ExceptionHandler(NotFoundTokenException.class) | ||
public ResponseEntity<HttpEntity> notFoundTokenException() { | ||
return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
backend/core/src/main/java/com/rollthedice/backend/global/config/RedisConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.rollthedice.backend.global.config; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | ||
|
||
@Configuration | ||
public class RedisConfig { | ||
@Value("${spring.data.redis.host}") | ||
private String host; | ||
|
||
@Value("${spring.data.redis.port}") | ||
private int port; | ||
|
||
@Bean | ||
public RedisConnectionFactory redisConnectionFactory() { | ||
return new LettuceConnectionFactory(host, port); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...re/src/main/java/com/rollthedice/backend/global/jwt/exception/NotFoundTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.rollthedice.backend.global.jwt.exception; | ||
|
||
public class NotFoundTokenException extends RuntimeException { | ||
public NotFoundTokenException() { | ||
} | ||
|
||
public NotFoundTokenException(String message) { | ||
super(message); | ||
} | ||
|
||
public NotFoundTokenException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...nd/core/src/main/java/com/rollthedice/backend/global/jwt/refresh/domain/RefreshToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.rollthedice.backend.global.jwt.refresh.domain; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.redis.core.RedisHash; | ||
import org.springframework.data.redis.core.TimeToLive; | ||
import org.springframework.data.redis.core.index.Indexed; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@RedisHash(value = "refreshToken") | ||
public class RefreshToken { | ||
|
||
@Id | ||
private String email; | ||
|
||
@Indexed | ||
private String refreshToken; | ||
|
||
@TimeToLive() | ||
private Long expirationPeriod; | ||
|
||
public RefreshToken(String email) { | ||
this.email = email; | ||
} | ||
|
||
public void createRefreshToken(String refreshToken, Long expiration) { | ||
this.refreshToken = refreshToken; | ||
this.expirationPeriod = expiration; | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
...in/java/com/rollthedice/backend/global/jwt/refresh/repository/RefreshTokenRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.rollthedice.backend.global.jwt.refresh.repository; | ||
|
||
import com.rollthedice.backend.global.jwt.refresh.domain.RefreshToken; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface RefreshTokenRepository extends CrudRepository<RefreshToken, String> { | ||
Optional<RefreshToken> findByRefreshToken(String refreshToken); | ||
} |
Oops, something went wrong.