File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
src/main/java/me/nettee/board/application Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
package me .nettee .board .application .port ;
2
2
3
+ import java .util .Optional ;
3
4
import me .nettee .board .application .domain .Board ;
4
5
5
6
public interface BoardCommandPort {
6
7
8
+ Optional <Board > findById (Long id );
9
+
7
10
Board create (Board board );
8
11
9
12
Board update (Board board );
10
13
11
- void delete (Long id );
12
-
14
+ void delete (Board id );
13
15
}
Original file line number Diff line number Diff line change 2
2
3
3
import lombok .RequiredArgsConstructor ;
4
4
import me .nettee .board .application .domain .Board ;
5
+ import me .nettee .board .application .model .BoardReadDetailModel ;
5
6
import me .nettee .board .application .port .BoardCommandPort ;
7
+ import me .nettee .board .application .port .BoardQueryPort ;
6
8
import me .nettee .board .application .usecase .BoardCreateUseCase ;
7
9
import me .nettee .board .application .usecase .BoardDeleteUseCase ;
8
10
import me .nettee .board .application .usecase .BoardUpdateUseCase ;
@@ -23,6 +25,11 @@ public Board updateBoard(Board board) {
23
25
}
24
26
25
27
public void deleteBoard (Long id ) {
26
- boardCommandPort .delete (id );
28
+ Board board = boardCommandPort .findById (id ).orElseThrow (
29
+ () -> new IllegalArgumentException ("게시글을 찾을 수 없습니다." ));
30
+
31
+ board .softDelete ();
32
+
33
+ boardCommandPort .delete (board );
27
34
}
28
35
}
You can’t perform that action at this time.
0 commit comments