Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 운영 서버 배포 #579

Merged
merged 15 commits into from
Sep 26, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/be_cd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ jobs:
DDL_AUTO=${{ secrets.DDL_AUTO }}

# OAUTH & JWT
CLIENT_ID=${{ secrets.CLIENT_ID }}
CLIENT_SECRET=${{ secrets.CLIENT_SECRET }}
CLIENT_REDIRECT_URI=${{ secrets.CLIENT_REDIRECT_URI }}
CLIENT_ID=${{ secrets.TEST_CLIENT_ID }}
CLIENT_SECRET=${{ secrets.TEST_CLIENT_SECRET }}
CLIENT_REDIRECT_URI=${{ secrets.TEST_CLIENT_REDIRECT_URI }}
JWT_KEY=${{ secrets.JWT_KEY}}

# Server App
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public void configurePathMatch(final PathMatchConfigurer configurer) {
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**")
.allowedMethods("*")
.allowedOrigins("http://localhost:3000", "https://coduo.site", "http://coduo.site:443",
"https://test.coduo.site")
.allowedOrigins("http://localhost:3000", "https://coduo.site", "https://test.coduo.site",
"https://api-test.coduo.site/")
.allowCredentials(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public ResponseEntity<CategoryUpdateResponse> updateCategory(
return ResponseEntity.ok(response);
}

@DeleteMapping("/{accessCode}/category/{categoryName}")
@DeleteMapping("/{accessCode}/category/{categoryId}")
public ResponseEntity<Void> deleteCategory(
@PathVariable("accessCode") String accessCode,
@PathVariable("categoryName") Long categoryId
@PathVariable("categoryId") Long categoryId
) {
categoryService.deleteCategory(accessCode, categoryId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public List<CategoryReadResponse> findAllByPairRoomAccessCode(final String acces
public CategoryCreateResponse createCategory(final String accessCode, final CategoryCreateRequest request) {
final PairRoomEntity pairRoomEntity = pairRoomRepository.fetchByAccessCode(new AccessCode(accessCode));
validateDuplicated(request.value(), pairRoomEntity);
final CategoryEntity saved = categoryRepository.save(
final CategoryEntity categoryEntity = categoryRepository.save(
new CategoryEntity(pairRoomEntity, new Category(request.value())));

return new CategoryCreateResponse(saved.getId(), saved.getCategoryName());
return CategoryCreateResponse.from(categoryEntity);
}

private void validateDuplicated(final String categoryName, final PairRoomEntity pairRoomEntity) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package site.coduo.referencelink.service.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import site.coduo.referencelink.repository.CategoryEntity;

@Schema(description = "카테고리 생성 응답")
public record CategoryCreateResponse(
@Schema(description = "카테고리 ID")
Long id,
String id,

@Schema(description = "카테고리 값")
String value
) {

public static CategoryCreateResponse from(final CategoryEntity category) {
return new CategoryCreateResponse(String.valueOf(category.getId()), category.getCategoryName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
@Schema(description = "카테고리 조회 응답")
public record CategoryReadResponse(
@Schema(description = "카테고리 ID", example = "0")
Long id,
String id,

@Schema(description = "카테고리 값", example = "카테고리 없음")
String value
) {

public static CategoryReadResponse from(final CategoryEntity category) {
return new CategoryReadResponse(category.getId(), category.getCategoryName());
return new CategoryReadResponse(String.valueOf(category.getId()), category.getCategoryName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void update_category() {
new CategoryCreateRequest("이전 카테고리"));

final String updateName = "변경된 카테고리";
final CategoryUpdateRequest request = new CategoryUpdateRequest(previousCategory.id(), updateName);
final CategoryUpdateRequest request = new CategoryUpdateRequest(Long.parseLong(previousCategory.id()), updateName);

//when & then
final CategoryUpdateResponse categoryUpdateResponse = RestAssured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void update_category() {

//when
final CategoryUpdateResponse updatedCategory = categoryService.updateCategoryName(ACCESS_CODE.getValue(),
new CategoryUpdateRequest(createdCategory.id(), "파이썬"));
new CategoryUpdateRequest(Long.parseLong(createdCategory.id()), "파이썬"));

//then
final List<CategoryReadResponse> categories = categoryService.findAllByPairRoomAccessCode(
Expand Down Expand Up @@ -144,7 +144,7 @@ void delete_category() {
final List<CategoryReadResponse> beforeDelete = categoryService.findAllByPairRoomAccessCode(
ACCESS_CODE.getValue());

categoryService.deleteCategory(ACCESS_CODE.getValue(), category.id());
categoryService.deleteCategory(ACCESS_CODE.getValue(), Long.parseLong(category.id()));

final List<CategoryReadResponse> afterDelete = categoryService.findAllByPairRoomAccessCode(
ACCESS_CODE.getValue());
Expand Down
Loading