Skip to content

Commit

Permalink
Merge pull request #25 from syyling/feat/20
Browse files Browse the repository at this point in the history
[feat] 리뷰 전체 삭제 기능 추가
  • Loading branch information
syyling authored Apr 11, 2024
2 parents 866267b + 1aaf2d9 commit 10a26b8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mookive.mookive_backend.record.application.service;

import com.mookive.mookive_backend.keyword.domain.service.KeywordDeleteService;
import com.mookive.mookive_backend.record.domain.service.RecordDeleteDomainService;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
@Transactional
public class RecordDeleteService {

/**
* 추후 annotation 도입 시 변경 예정
*/
private final RecordDeleteDomainService recordDeleteDomainService;
private final KeywordDeleteService keywordDeleteService;

public void deleteRecord(Long recordId) {
keywordDeleteService.deleteAllByRecordId(recordId);
recordDeleteDomainService.delete(recordId);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.mookive.mookive_backend.record.domain.service;

import com.mookive.mookive_backend.record.domain.repository.RecordRepository;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
@Transactional
public class RecordDeleteDomainService {

private final RecordRepository recordRepository;

public void delete(Long recordId) {
recordRepository.deleteById(recordId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mookive.mookive_backend.record.application.dto.request.RecordRequest;
import com.mookive.mookive_backend.record.application.dto.response.RecordResponse;
import com.mookive.mookive_backend.record.application.service.RecordCreateService;
import com.mookive.mookive_backend.record.application.service.RecordDeleteService;
import com.mookive.mookive_backend.record.application.service.RecordGetService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand All @@ -13,6 +14,7 @@ public class RecordController {

private final RecordCreateService recordCreateService;
private final RecordGetService recordGetService;
private final RecordDeleteService recordDeleteService;

@PostMapping("/record")
public void createRecord(@RequestBody RecordRequest.RecordCreateRequest recordCreateRequest) {
Expand All @@ -24,4 +26,9 @@ public RecordResponse.RecordDetailResponse getRecord(@PathVariable Long recordId
return recordGetService.getRecord(recordId);
}

@DeleteMapping("/record/{recordId}")
public void deleteRecord(@PathVariable Long recordId) {
recordDeleteService.deleteRecord(recordId);
}

}

0 comments on commit 10a26b8

Please sign in to comment.