-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
136 additions
and
49 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
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,15 @@ | ||
services: | ||
app: | ||
image: cross-puzzle | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
ports: | ||
- 8080:8080 | ||
depends_on: | ||
- redis | ||
|
||
redis: | ||
image: redis | ||
ports: # 바인딩할 포트:내부 포트 | ||
- 8379:8379 |
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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/example/crosspuzzleserver/controller/puzzle/PuzzleController.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
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
8 changes: 0 additions & 8 deletions
8
src/main/java/com/example/crosspuzzleserver/service/PuzzleGen/PuzzleGenService.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
src/main/java/com/example/crosspuzzleserver/service/puzzle/HitsImpl.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,29 @@ | ||
package com.example.crosspuzzleserver.service.puzzle; | ||
|
||
import com.example.crosspuzzleserver.service.puzzle.spi.Hits; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import redis.clients.jedis.JedisPooled; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class HitsImpl implements Hits { | ||
|
||
JedisPooled jedis = new JedisPooled("redis", 6379); | ||
|
||
private static final int EXPIRE_TIME = 60 * 60 * 24; //하루 | ||
|
||
@Override | ||
public boolean isHit(String cookieValue, String boardId) { | ||
String key = cookieValue + boardId; | ||
if (jedis.get(key) == null) { | ||
jedis.set(key, boardId); | ||
jedis.expire(key, EXPIRE_TIME); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/crosspuzzleserver/service/puzzle/PuzzleGen/PuzzleGenService.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,8 @@ | ||
package com.example.crosspuzzleserver.service.puzzle.PuzzleGen; | ||
|
||
|
||
public interface PuzzleGenService { | ||
|
||
public void generatePuzzle(); | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...eserver/service/PuzzleGen/WordPuzzle.java → .../service/puzzle/PuzzleGen/WordPuzzle.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
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
6 changes: 6 additions & 0 deletions
6
src/main/java/com/example/crosspuzzleserver/service/puzzle/spi/Hits.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,6 @@ | ||
package com.example.crosspuzzleserver.service.puzzle.spi; | ||
|
||
public interface Hits { | ||
|
||
public boolean isHit(String cookieValue, String boardId); | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/example/crosspuzzleserver/util/cookie/CookieService.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,29 @@ | ||
package com.example.crosspuzzleserver.util.cookie; | ||
|
||
import java.time.Duration; | ||
import java.util.UUID; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseCookie; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Slf4j | ||
@Service | ||
public class CookieService { | ||
|
||
public String getCookie() { | ||
String uuid = UUID.randomUUID().toString(); | ||
ResponseCookie responseCookie = ResponseCookie | ||
.from("userCookie", uuid) | ||
.domain("api.cross-word.online") | ||
// .domain("localhost") | ||
.path("/") | ||
.httpOnly(true) | ||
.secure(false) | ||
.maxAge(Duration.ofDays(14)) | ||
.sameSite("Strict") | ||
.build(); | ||
return responseCookie.toString(); | ||
} | ||
|
||
|
||
} |
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 |
---|---|---|
|
@@ -6,8 +6,5 @@ | |
@SpringBootTest | ||
class CrossPuzzleServerApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
|
||
} |
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