Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import com.example.sharemind.admin.dto.response.InformationGetResponse;
import com.example.sharemind.admin.dto.response.PaymentGetRefundWaitingResponse;
import com.example.sharemind.admin.dto.response.PaymentGetSettlementOngoingResponse;
import com.example.sharemind.admin.dto.response.PostGetByIdResponse;
import com.example.sharemind.admin.dto.response.PostGetByUuidResponse;
import com.example.sharemind.admin.dto.response.PostGetUnpaidPrivateResponse;
import com.example.sharemind.counselor.dto.response.CounselorGetProfileResponse;

import java.util.List;
import java.util.UUID;

public interface AdminService {
List<ConsultGetUnpaidResponse> getUnpaidConsults();
Expand Down Expand Up @@ -41,9 +42,9 @@ public interface AdminService {

void updateCounselorPending(Long counselorId);

PostGetByIdResponse getPostByPostId(Long postId);
PostGetByUuidResponse getPostByPostUuid(UUID postUuid);

void deletePostByPostId(Long postId);
void deletePostByPostUuid(UUID postUuid);

InformationGetResponse getInformation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.example.sharemind.admin.dto.response.InformationGetResponse;
import com.example.sharemind.admin.dto.response.PaymentGetRefundWaitingResponse;
import com.example.sharemind.admin.dto.response.PaymentGetSettlementOngoingResponse;
import com.example.sharemind.admin.dto.response.PostGetByIdResponse;
import com.example.sharemind.admin.dto.response.PostGetByUuidResponse;
import com.example.sharemind.admin.dto.response.PostGetUnpaidPrivateResponse;
import com.example.sharemind.chat.application.ChatService;
import com.example.sharemind.chat.content.ChatStatus;
Expand Down Expand Up @@ -40,6 +40,7 @@
import com.example.sharemind.post.domain.Post;
import com.example.sharemind.post.exception.PostErrorCode;
import com.example.sharemind.post.exception.PostException;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
Expand Down Expand Up @@ -210,15 +211,15 @@ public void updateCounselorPending(Long counselorId) {
}

@Override
public PostGetByIdResponse getPostByPostId(Long postId) {
Post post = postService.getPostByPostId(postId);
return PostGetByIdResponse.of(post);
public PostGetByUuidResponse getPostByPostUuid(UUID postUuid) {
Post post = postService.getPostByPostUuid(postUuid);
return PostGetByUuidResponse.of(post);
}

@Transactional
@Override
public void deletePostByPostId(Long postId) {
Post post = postService.getPostByPostId(postId);
public void deletePostByPostUuid(UUID postUuid) {
Post post = postService.getPostByPostUuid(postUuid);
post.updateIsActivatedFalse();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import com.example.sharemind.post.domain.Post;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.UUID;
import lombok.Builder;
import lombok.Getter;

@Getter
public class PostGetByIdResponse {
public class PostGetByUuidResponse {

@Schema(description = "공개상담 아이디")
private final Long postId;
private final UUID postUuid;

@Schema(description = "상담 카테고리")
private final String consultCategory;
Expand All @@ -21,16 +22,16 @@ public class PostGetByIdResponse {
private final String content;

@Builder
public PostGetByIdResponse(Long postId, String consultCategory, String title, String content) {
this.postId = postId;
public PostGetByUuidResponse(UUID postUuid, String consultCategory, String title, String content) {
this.postUuid = postUuid;
this.consultCategory = consultCategory;
this.title = title;
this.content = content;
}

public static PostGetByIdResponse of(Post post) {
return PostGetByIdResponse.builder()
.postId(post.getPostId())
public static PostGetByUuidResponse of(Post post) {
return PostGetByUuidResponse.builder()
.postUuid(post.getPostUuid())
.consultCategory(post.getConsultCategory().getDisplayName())
.title(post.getTitle())
.content(post.getContent())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.example.sharemind.admin.dto.response.InformationGetResponse;
import com.example.sharemind.admin.dto.response.PaymentGetRefundWaitingResponse;
import com.example.sharemind.admin.dto.response.PaymentGetSettlementOngoingResponse;
import com.example.sharemind.admin.dto.response.PostGetByIdResponse;
import com.example.sharemind.admin.dto.response.PostGetByUuidResponse;
import com.example.sharemind.admin.dto.response.PostGetUnpaidPrivateResponse;
import com.example.sharemind.counselor.dto.response.CounselorGetProfileResponse;
import com.example.sharemind.global.exception.CustomExceptionResponse;
Expand All @@ -19,6 +19,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -260,11 +261,11 @@ public ResponseEntity<Void> updateCounselorPending(@PathVariable Long counselorI
)
})
@Parameters({
@Parameter(name = "postId", description = "조회할 공개상담 아이디")
@Parameter(name = "postUuid", description = "조회할 공개상담 아이디")
})
@GetMapping("/posts/{postId}")
public ResponseEntity<PostGetByIdResponse> getPostByPostId(@PathVariable Long postId) {
return ResponseEntity.ok(adminService.getPostByPostId(postId));
@GetMapping("/posts/{postUuid}")
public ResponseEntity<PostGetByUuidResponse> getPostByPostUuid(@PathVariable UUID postUuid) {
return ResponseEntity.ok(adminService.getPostByPostUuid(postUuid));
}

@Operation(summary = "특정 공개상담 게시물 삭제", description = "특정 공개상담 게시물 비활성화 상태로 수정")
Expand All @@ -276,11 +277,11 @@ public ResponseEntity<PostGetByIdResponse> getPostByPostId(@PathVariable Long po
)
})
@Parameters({
@Parameter(name = "postId", description = "삭제할 공개상담 아이디")
@Parameter(name = "postUuid", description = "삭제할 공개상담 아이디")
})
@DeleteMapping("/posts/{postId}")
public ResponseEntity<Void> deletePostByPostId(@PathVariable Long postId) {
adminService.deletePostByPostId(postId);
@DeleteMapping("/posts/{postUuid}")
public ResponseEntity<Void> deletePostByPostUuid(@PathVariable UUID postUuid) {
adminService.deletePostByPostUuid(postUuid);
return ResponseEntity.ok().build();
}

Expand Down