Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6de2608
feat: 도커파일 추가
2Jin1031 Nov 9, 2025
8a35243
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
586b092
Merge pull request #101 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
d767c3e
tmp: dev cd 트리거
2Jin1031 Nov 9, 2025
804497f
Merge pull request #102 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
243dccc
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
f847f66
tmp: dev cd 트리거
2Jin1031 Nov 9, 2025
fe5bdc0
Merge pull request #103 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
1a09bfc
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
4c26dd0
tmp: dev cd 트리거
2Jin1031 Nov 9, 2025
3dd40bf
Merge pull request #104 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
bf2e482
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
5534cbf
tmp: dev cd 트리거
2Jin1031 Nov 9, 2025
9f7018b
Merge pull request #106 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
22d24c4
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
30beb53
tmp: dev cd 트리거
2Jin1031 Nov 9, 2025
2d9ca12
Merge pull request #107 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
94d39e6
chore: .gitignore 업데이트
2Jin1031 Nov 9, 2025
b819115
chore: .gitignore 업데이트
2Jin1031 Nov 9, 2025
8a0cce0
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
1db186e
Merge pull request #108 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
8a3b35b
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
cb69ae2
tmp: dev cd 트리거
2Jin1031 Nov 9, 2025
4da8e40
Merge pull request #109 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
8b5cbc6
merge: main과 merge
2Jin1031 Nov 9, 2025
5160c0f
Merge pull request #110 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
bbcbf07
`Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
f362c70
Merge pull request #111 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
020a049
Merge branch 'main' into feat/100
2Jin1031 Nov 9, 2025
97c2646
Merge pull request #112 from Crew-Wiki/feat/100
2Jin1031 Nov 9, 2025
a9791ea
Merge branch 'main' into feat/100
2Jin1031 Nov 11, 2025
e019ef0
Merge pull request #113 from Crew-Wiki/feat/100
2Jin1031 Nov 11, 2025
5b10c31
Merge branch 'main' into develop
2Jin1031 Nov 11, 2025
2aa974e
feat: 문서 삭제 요청 데이터 수정 (id -> uuid)
2Jin1031 Nov 17, 2025
21e21dc
Merge pull request #116 from Crew-Wiki/feat/115
2Jin1031 Nov 19, 2025
c9882a7
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
9ece709
feat: local yml 추가
2Jin1031 Dec 14, 2025
c34984a
Merge pull request #118 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
827347c
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
5e1e391
tmp: cd 트리거
2Jin1031 Dec 14, 2025
4aaf39c
Merge pull request #120 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
84652bb
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
5d457e0
Merge pull request #121 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
8cb2a53
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
671c800
Merge pull request #122 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
bf2ab25
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
fa3e183
Merge pull request #123 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
1fec7aa
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
b0e5a39
Merge pull request #124 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
f3dba2b
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
fa81e46
Merge pull request #125 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
387c8ce
Merge branch 'main' into develop
2Jin1031 Dec 14, 2025
84f56dc
Merge pull request #126 from Crew-Wiki/feat/117
2Jin1031 Dec 14, 2025
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
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM eclipse-temurin:17

WORKDIR /app

COPY build/libs/*.jar app.jar

EXPOSE 8080

ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "app.jar"]
1 change: 0 additions & 1 deletion src/main/java/com/wooteco/wiki/WikiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ public class WikiApplication {
public static void main(String[] args) {
SpringApplication.run(WikiApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.wooteco.wiki.global.common.ApiResponse;
import com.wooteco.wiki.global.common.ApiResponseGenerator;
import io.swagger.v3.oas.annotations.Operation;
import java.util.UUID;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -20,10 +21,10 @@ public AdminController(AdminService adminService) {
this.adminService = adminService;
}

@Operation(summary = "문서 삭제", description = "문서 ID로 문서를 삭제합니다.")
@DeleteMapping("/documents/{documentId}")
public ApiResponse<ApiResponse.SuccessBody<Void>> deleteDocumentByDocumentId(@PathVariable Long documentId) {
adminService.deleteDocumentByDocumentId(documentId);
@Operation(summary = "문서 삭제", description = "문서 Uuid로 문서를 삭제합니다.")
@DeleteMapping("/documents/{documentUuid}")
public ApiResponse<ApiResponse.SuccessBody<Void>> deleteDocumentByDocumentId(@PathVariable UUID documentUuid) {
adminService.deleteDocumentByDocumentUuid(documentUuid);
return ApiResponseGenerator.success(HttpStatus.NO_CONTENT);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.wooteco.wiki.admin.service;

import com.wooteco.wiki.document.service.DocumentService;
import com.wooteco.wiki.global.exception.ErrorCode;
import com.wooteco.wiki.global.exception.WikiException;
import java.util.UUID;
import org.springframework.stereotype.Service;

@Service
Expand All @@ -14,7 +13,7 @@ public AdminService(DocumentService documentService) {
this.documentService = documentService;
}

public void deleteDocumentByDocumentId(Long documentId) {
documentService.deleteById(documentId);
public void deleteDocumentByDocumentUuid(UUID documentUuid) {
documentService.deleteByUuid(documentUuid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public interface DocumentRepository extends JpaRepository<Document, Long> {
Optional<Long> findIdByUuid(@Param("uuid") UUID documentUuid);

List<Document> findAllByUuidIn(Set<UUID> uuids);

void deleteByUuid(UUID documentUuid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@ public DocumentResponse put(UUID uuid, DocumentUpdateRequest request) {
return mapToResponse(document);
}

public void deleteById(Long id) {
documentRepository.findById(id)
.orElseThrow(() -> new WikiException(ErrorCode.DOCUMENT_NOT_FOUND));
documentRepository.deleteById(id);
}

public void flushViews(Map<UUID, Integer> views) {
List<Document> documents = documentRepository.findAllByUuidIn(views.keySet());

Expand All @@ -126,6 +120,12 @@ public void flushViews(Map<UUID, Integer> views) {
documentRepository.saveAll(documents);
}

public void deleteByUuid(UUID documentUuid) {
documentRepository.findByUuid(documentUuid)
.orElseThrow(() -> new WikiException(ErrorCode.DOCUMENT_NOT_FOUND));
documentRepository.deleteByUuid(documentUuid);
}

private DocumentResponse mapToResponse(Document document) {
long latestVersion = historyService.findLatestVersionByDocument(document);
List<OrganizationDocumentResponse> organizationDocumentResponses =
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server:
port: 8080

spring:
datasource:
url: ${DEV_DB_URL}
username: ${DEV_DB_USERNAME}
password: ${DEV_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect

cors:
allowed-origins: http://localhost:3000, https://dev.crew-wiki.site, https://dev.api.crew-wiki.site

swagger:
server-url: https://dev.api.crew-wiki.site
24 changes: 24 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
spring:
datasource:
url: jdbc:h2:mem:testdb;MODE=MySQL
driver-class-name: org.h2.Driver

jpa:
hibernate:
ddl-auto: update
open-in-view: false
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect

h2:
console:
enabled: true
path: /h2-console


cors:
allowed-origins: http://localhost:3000, https://dev.crew-wiki.site, https://dev.api.crew-wiki.site

swagger:
server-url: https://dev.api.crew-wiki.site
17 changes: 17 additions & 0 deletions src/main/resources/application-private.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
security:
jwt:
token:
secret-key: ${JWT_SECRET_KEY}
expire-length: ${JWT_SECRET_EXPIRE_LENGTH}

cloud:
aws:
credentials:
access-key: ${AWS_CREDENTIALS_ACCESS_KEY}
secret-key: ${AWS_CREDENTIALS_SECRET_KEY}
s3:
bucket: ${S3_BUCKET}
region:
static: ap-northeast-2
stack:
auto: false
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: dev # prod (배포 환경)
active: local # prod (배포 환경)
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ void findAll_throwsException_byNegativeNumber() {
}

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

@DisplayName("존재하는 문서 id일 경우 문서가 로그들과 함께 삭제된다")
@Test
Expand All @@ -262,7 +262,7 @@ void deleteById_success_byExistsId() {
assertThat(historyRepository.findAll()).hasSize(1);

// when
documentService.deleteById(documentResponse.getDocumentId());
documentService.deleteByUuid(documentResponse.getDocumentUUID());

// after then
assertThat(documentRepository.findAll()).hasSize(0);
Expand All @@ -274,7 +274,7 @@ void deleteById_success_byExistsId() {
void deleteById_throwsException_byNonExistsId() {
// when & then
WikiException ex = assertThrows(WikiException.class,
() -> documentService.deleteById(Long.MAX_VALUE));
() -> documentService.deleteByUuid(UUID.randomUUID()));
assertThat(ex.getErrorCode()).isEqualTo(DOCUMENT_NOT_FOUND);
}
}
Expand Down