-
Notifications
You must be signed in to change notification settings - Fork 7
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 #718 from woowacourse-teams/dev/be
[BE] 코드잽 프로덕션 v1.1.3 배포
- Loading branch information
Showing
62 changed files
with
1,732 additions
and
780 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 |
---|---|---|
|
@@ -21,3 +21,7 @@ out/ | |
|
||
### YAML ### | ||
application-db.yml | ||
|
||
### compose ### | ||
docker/app/*.jar | ||
docker/.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
spring: | ||
config: | ||
activate: | ||
on-profile: local | ||
datasource: | ||
url: jdbc:mysql://mysql:3306/${MYSQL_DATABASE}?serverTimezone=Asia/Seoul | ||
username: root | ||
password: ${MYSQL_ROOT_PASSWORD} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
flyway: | ||
enabled: false | ||
jpa: | ||
hibernate: | ||
ddl-auto: create-drop | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
show_sql: true | ||
output: | ||
ansi: | ||
enabled: always | ||
|
||
#cors: | ||
# allowed-origins: http://localhost:3000 |
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,35 @@ | ||
name: code-zap | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.4.2 | ||
expose: | ||
- ${MYSQL_PORT} | ||
ports: | ||
- ${HOST_PORT}:${MYSQL_PORT} | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
TZ: Asia/Seoul | ||
volumes: | ||
- code-zap:/var/lib/mysql | ||
|
||
spring: | ||
image: amazoncorretto:17 | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
TZ: Asia/Seoul | ||
volumes: | ||
- ./app:/app | ||
entrypoint: [ | ||
"java", "-jar", | ||
"-Dspring.config.location=/app/application.yml", | ||
"-Dspring.profiles.active=local", | ||
"/app/zap.jar" | ||
] | ||
|
||
volumes: | ||
code-zap: |
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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
abs_path=$(readlink -f "$0"); | ||
abs_dir=$(dirname "$abs_path"); | ||
|
||
backend_path=$(realpath "$abs_path/../..") | ||
|
||
cd "$backend_path" || exit | ||
|
||
./gradlew clean | ||
./gradlew bootJar | ||
|
||
jar_path="$backend_path/build/libs" | ||
jar_filename=$(ls -tr "$jar_path"/*.jar | grep ".*\.jar") | ||
|
||
mkdir "$abs_dir/app" | ||
mv "$jar_filename" "$abs_dir/app/zap.jar" | ||
|
||
cd "$abs_dir" || exit | ||
docker compose up -d |
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
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
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/codezap/global/validation/GroupedByteLengthValidator.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,30 @@ | ||
package codezap.global.validation; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.List; | ||
|
||
import jakarta.validation.ConstraintValidator; | ||
import jakarta.validation.ConstraintValidatorContext; | ||
|
||
public class GroupedByteLengthValidator implements ConstraintValidator<ByteLength, List<String>> { | ||
|
||
private int max; | ||
private int min; | ||
|
||
@Override | ||
public void initialize(ByteLength constraintAnnotation) { | ||
max = constraintAnnotation.max(); | ||
min = constraintAnnotation.min(); | ||
} | ||
|
||
@Override | ||
public boolean isValid(List<String> strings, ConstraintValidatorContext constraintValidatorContext) { | ||
return strings.stream() | ||
.allMatch(this::isValid); | ||
} | ||
|
||
private boolean isValid(String target) { | ||
int byteLength = target.getBytes(StandardCharsets.UTF_8).length; | ||
return min <= byteLength && byteLength <= max; | ||
} | ||
} |
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
backend/src/main/java/codezap/likes/repository/LikesJpaRepository.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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
package codezap.likes.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import codezap.likes.domain.Likes; | ||
|
||
public interface LikesJpaRepository extends LikesRepository, JpaRepository<Likes, Long> { | ||
|
||
@Modifying(clearAutomatically = true) | ||
@Query("DELETE FROM Likes l WHERE l.template.id in :templateIds") | ||
void deleteByTemplateIds(List<Long> templateIds); | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.