File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/main/java/com/codingwasabi/bigtong/main Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -35,4 +35,9 @@ public CurrentReturnDto returnCurrent(){
3535 return accountService .returnCurrent ();
3636 }
3737
38+ @ DeleteMapping ("/logout" )
39+ public boolean logout (@ RequestParam String name ){
40+ return accountService .deleteNickname (name );
41+ }
42+
3843}
Original file line number Diff line number Diff line change 55import com .codingwasabi .bigtong .main .Account ;
66import com .codingwasabi .bigtong .main .dto .CurrentReturnDto ;
77import com .codingwasabi .bigtong .main .repository .AccountRepository ;
8+ import com .codingwasabi .bigtong .websocket .exception .AccountNotExistException ;
89import com .codingwasabi .bigtong .websocket .message .ChatMessage ;
910import com .codingwasabi .bigtong .websocket .message .MessageType ;
1011import com .codingwasabi .bigtong .websocket .service .ChatService ;
@@ -110,4 +111,17 @@ public CurrentReturnDto returnCurrent(){
110111
111112 return currentReturnDto ;
112113 }
114+
115+ @ Transactional
116+ public boolean deleteNickname (String name ){
117+
118+ try {
119+ Account account = accountRepository .findByNickname (name ).orElseThrow (AccountNotExistException ::new );
120+ }catch (AccountNotExistException a ){
121+ return false ;
122+ }
123+
124+ accountRepository .deleteAccountByNickname (name );
125+ return true ;
126+ }
113127}
You can’t perform that action at this time.
0 commit comments