Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ out/
### VS Code ###
.vscode/

application-*.yml
src/main/resources/application-private.yml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

Changing the ignore pattern from application-*.yml to only src/main/resources/application-private.yml means other environment-specific configuration files (such as application-local.yml or other custom configuration files) are no longer ignored. This increases the risk of developers accidentally committing sensitive credentials or local configurations to the repository. It is safer to keep the wildcard pattern or explicitly ignore other potential configuration files.

src/main/resources/application-private.yml
application-*.yml

2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ These names are standardized across the project. Do not rename or create alterna
- When creating a new class, always check if a similar one already exists in `common/`.
- When writing tests, always add a corresponding fixture if one does not exist.
- Do not modify `build.gradle` unless explicitly asked.
- If uncertain about a design decision, leave a `// TODO:` comment explaining the ambiguity rather than guessing.
- If uncertain about a design decision, leave a `// TODO:` comment explaining the ambiguity rather than guessing.
2 changes: 2 additions & 0 deletions src/main/java/com/wooteco/wiki/WikiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ public class WikiApplication {

public static void main(String[] args) {
SpringApplication.run(WikiApplication.class, args);


}
}
22 changes: 22 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server:
port: 8080

spring:
datasource:
url: ${PROD_DB_URL}
username: ${PROD_DB_USERNAME}
password: ${PROD_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
hibernate:
ddl-auto: update

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

Using ddl-auto: update in a production environment is highly risky. It can lead to accidental schema modifications, data loss, or performance issues during application startup. It is strongly recommended to set ddl-auto to none or validate in production, and manage database migrations using dedicated tools like Flyway or Liquibase.

      ddl-auto: validate

properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect

cors:
allowed-origins: https://crew-wiki.site, https://api.crew-wiki.site

swagger:
server-url: https://api.crew-wiki.site
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring:
profiles:
include: private
active: local # prod (배포 환경)
active: local # 기본 로컬 실행 프로필
Original file line number Diff line number Diff line change
Expand Up @@ -89,40 +89,6 @@ void getDocumentLatestVersion_success_byExistsDocument() {
}
}

@Nested
@DisplayName("문서 uuid로 삭제 기능")
class deleteByUuid {

@DisplayName("존재하는 문서 id일 경우 문서가 로그들과 함께 삭제된다")
@Test
void deleteById_success_byExistsId() {
// given
DocumentResponse documentResponse = crewDocumentService.create(
CrewDocumentFixture.createDocumentCreateRequest("title1", "content1", "writer1", 10L,
UUID.randomUUID()));

// before then
assertThat(documentRepository.findAll()).hasSize(1);
assertThat(historyRepository.findAll()).hasSize(1);

// when
crewDocumentService.deleteByUuid(documentResponse.documentUUID());

// after then
assertThat(documentRepository.findAll()).hasSize(0);
assertThat(historyRepository.findAll()).hasSize(0);
}

@DisplayName("존재하지 않는 문서의 id일 경우 예외가 발생한다 : WikiException.DOCUMENT_NOT_FOUND")
@Test
void deleteById_throwsException_byNonExistsId() {
// when & then
WikiException ex = assertThrows(WikiException.class,
() -> crewDocumentService.deleteByUuid(UUID.randomUUID()));
assertThat(ex.getErrorCode()).isEqualTo(DOCUMENT_NOT_FOUND);
}
}

@Nested
@DisplayName("문서 uuid로 삭제 기능")
class DeleteByUuid {
Expand Down
Loading