-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from mujik-tigers/feature/create-room
feature: 방 만들기 기능 구현 완료
- Loading branch information
Showing
36 changed files
with
1,134 additions
and
31 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 |
---|---|---|
@@ -1,38 +1,86 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.2.3' | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
id 'java' | ||
id 'org.springframework.boot' version '3.2.3' | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
id 'org.asciidoctor.jvm.convert' version '3.3.2' | ||
id 'jacoco' | ||
} | ||
|
||
group = 'site' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = '17' | ||
sourceCompatibility = '17' | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
|
||
asciidoctorExt | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-validation' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.boot:spring-boot-starter-validation' | ||
implementation 'org.springframework.boot:spring-boot-starter-data-redis' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor' | ||
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
useJUnitPlatform() | ||
|
||
finalizedBy jacocoTestReport | ||
} | ||
|
||
ext { | ||
snippetsDir = file('build/generated-snippets') | ||
} | ||
|
||
asciidoctor { | ||
inputs.dir snippetsDir | ||
configurations 'asciidoctorExt' | ||
|
||
sources { | ||
include("**/index.adoc") | ||
} | ||
|
||
baseDirFollowsSourceFile() | ||
dependsOn test | ||
} | ||
|
||
bootJar { | ||
dependsOn asciidoctor | ||
|
||
from("${asciidoctor.outputDir}") { | ||
into 'static/docs' | ||
} | ||
} | ||
|
||
jacoco { | ||
toolVersion = "0.8.8" | ||
} | ||
|
||
jacocoTestReport { | ||
dependsOn test | ||
|
||
reports { | ||
xml.required = true | ||
html.required = true | ||
} | ||
|
||
finalizedBy 'jacocoTestCoverageVerification' | ||
} | ||
|
||
jar { | ||
enabled = false | ||
enabled = false | ||
} |
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,45 @@ | ||
[[Room-API]] | ||
== Room API | ||
|
||
[[create-room-success]] | ||
=== 방 생성 성공 | ||
|
||
==== HTTP Request | ||
|
||
include::{snippets}/create-room-success/http-request.adoc[] | ||
include::{snippets}/create-room-success/request-fields.adoc[] | ||
|
||
==== HTTP Response | ||
|
||
include::{snippets}/create-room-success/http-response.adoc[] | ||
include::{snippets}/create-room-success/response-fields.adoc[] | ||
|
||
{nbsp} | ||
|
||
[[create-room-fail-room-setting-error]] | ||
=== 방 생성 실패: 요청 데이터 오류가 발생했습니다 | ||
|
||
==== HTTP Request | ||
|
||
include::{snippets}/create-room-fail-room-setting-error/http-request.adoc[] | ||
include::{snippets}/create-room-fail-room-setting-error/request-fields.adoc[] | ||
|
||
==== HTTP Response | ||
|
||
include::{snippets}/create-room-fail-room-setting-error/http-response.adoc[] | ||
include::{snippets}/create-room-fail-room-setting-error/response-fields.adoc[] | ||
|
||
{nbsp} | ||
|
||
[[create-room-fail-single-room-participant-violation]] | ||
=== 방 생성 실패: 다수의 방에 참가할 수 없습니다 | ||
|
||
==== HTTP Request | ||
|
||
include::{snippets}/create-room-fail-single-room-participant-violation/http-request.adoc[] | ||
include::{snippets}/create-room-fail-single-room-participant-violation/request-fields.adoc[] | ||
|
||
==== HTTP Response | ||
|
||
include::{snippets}/create-room-fail-single-room-participant-violation/http-response.adoc[] | ||
include::{snippets}/create-room-fail-single-room-participant-violation/response-fields.adoc[] |
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,79 @@ | ||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> | ||
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js"></script> | ||
|
||
<link rel="stylesheet" as="style" crossorigin href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css"/> | ||
|
||
<style> | ||
.tocify-subheader { | ||
font-style: normal; | ||
font-size: 92%; | ||
} | ||
|
||
.tocify ul { | ||
margin: 0; | ||
} | ||
|
||
.tocify-focus { | ||
color: #7a2518; | ||
background-color: rgba(0, 0, 0, 0.05); | ||
} | ||
|
||
.tocify-focus > a { | ||
color: #7a2518; | ||
} | ||
|
||
thead > tr { | ||
font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif; | ||
} | ||
|
||
tbody tr td:nth-child(4) { | ||
font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif; | ||
} | ||
</style> | ||
|
||
<script type="text/javascript"> | ||
$(function () { | ||
// Add a new container for the tocify toc into the existing toc so we can re-use its | ||
// styling | ||
$("#toc").append("<div id='generated-toc'></div>"); | ||
$("#generated-toc").tocify({ | ||
extendPage: true, | ||
context: "#content", | ||
highlightOnScroll: true, | ||
hideEffect: "slideUp", | ||
// Use the IDs that asciidoc already provides so that TOC links and intra-document | ||
// links are the same. Anything else might confuse users when they create bookmarks. | ||
hashGenerator: function(text, element) { | ||
return $(element).attr("id"); | ||
}, | ||
// Smooth scrolling doesn't work properly if we use the asciidoc IDs | ||
smoothScroll: false, | ||
// Set to 'none' to use the tocify classes | ||
theme: "none", | ||
// Handle book (may contain h1) and article (only h2 deeper) | ||
selectors: $( "#content" ).has( "h1" ).size() > 0 ? "h1,h2,h3,h4,h5" : "h2,h3,h4,h5", | ||
ignoreSelector: ".discrete" | ||
}); | ||
|
||
// Switch between static asciidoc toc and dynamic tocify toc based on browser size | ||
// This is set to match the media selectors in the asciidoc CSS | ||
// Without this, we keep the dynamic toc even if it is moved from the side to preamble | ||
// position which will cause odd scrolling behavior | ||
var handleTocOnResize = function() { | ||
if ($(document).width() < 768) { | ||
$("#generated-toc").hide(); | ||
$(".sectlevel0").show(); | ||
$(".sectlevel1").show(); | ||
} | ||
else { | ||
$("#generated-toc").show(); | ||
$(".sectlevel0").hide(); | ||
$(".sectlevel1").hide(); | ||
} | ||
} | ||
|
||
$(window).resize(handleTocOnResize); | ||
handleTocOnResize(); | ||
}); | ||
</script> |
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 @@ | ||
ifndef::snippets[] | ||
:snippets: ../../build/generated-snippets | ||
endif::[] | ||
|
||
= YouTogether API Document | ||
:doctype: book | ||
:icons: font | ||
:source-highlighter: highlightjs | ||
:toc: left | ||
:toclevels: 2 | ||
:sectlinks: | ||
:docinfo: shared | ||
|
||
include::api/room.adoc[] |
14 changes: 14 additions & 0 deletions
14
src/main/java/site/youtogether/config/PropertiesConfig.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 site.youtogether.config; | ||
|
||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import site.youtogether.config.property.CookieProperties; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(value = { | ||
CookieProperties.class | ||
}) | ||
public class PropertiesConfig { | ||
|
||
} |
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,38 @@ | ||
package site.youtogether.config; | ||
|
||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties; | ||
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.RedisStandaloneConfiguration; | ||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class RedisConfig { | ||
|
||
private final RedisProperties redisProperties; | ||
|
||
@Bean | ||
public RedisConnectionFactory redisConnectionFactory() { | ||
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(redisProperties.getHost(), redisProperties.getPort()); | ||
redisStandaloneConfiguration.setPassword(redisProperties.getPassword()); | ||
|
||
return new LettuceConnectionFactory(redisStandaloneConfiguration); | ||
} | ||
|
||
@Bean | ||
public RedisTemplate<String, String> redisStringTemplate() { | ||
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>(); | ||
redisTemplate.setConnectionFactory(redisConnectionFactory()); | ||
redisTemplate.setKeySerializer(new StringRedisSerializer()); | ||
redisTemplate.setValueSerializer(new StringRedisSerializer()); | ||
|
||
return redisTemplate; | ||
} | ||
|
||
} |
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,23 @@ | ||
package site.youtogether.config; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import site.youtogether.resolver.AddressArgumentResolver; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class WebConfig implements WebMvcConfigurer { | ||
|
||
private final AddressArgumentResolver addressArgumentResolver; | ||
|
||
@Override | ||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { | ||
resolvers.add(addressArgumentResolver); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/site/youtogether/config/property/CookieProperties.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,19 @@ | ||
package site.youtogether.config.property; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@ConfigurationProperties("cookie") | ||
@RequiredArgsConstructor | ||
@Getter | ||
public class CookieProperties { | ||
|
||
private final String name; | ||
private final String domain; | ||
private final String path; | ||
private final String sameSite; | ||
private final int expiry; | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/site/youtogether/exception/CustomException.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,17 @@ | ||
package site.youtogether.exception; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class CustomException extends RuntimeException { | ||
|
||
private final HttpStatus status; | ||
|
||
public CustomException(ErrorType errorType) { | ||
super(errorType.getMessage()); | ||
this.status = errorType.getStatus(); | ||
} | ||
|
||
} |
Oops, something went wrong.