-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Linkode2024/LINKODE-16-BE-API-스터디룸-삭제-API
Feat : 스터디룸 삭제 API
- Loading branch information
Showing
9 changed files
with
102 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pi_server/dto/CreateStudyroomRequest.java → ...dto/studyroom/CreateStudyroomRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...i_server/dto/CreateStudyroomResponse.java → ...to/studyroom/CreateStudyroomResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/linkode/api_server/dto/studyroom/DeleteStudyroomRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.linkode.api_server.dto.studyroom; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter @Setter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class DeleteStudyroomRequest { | ||
|
||
private long studyroomId; | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
.../api_server/dto/JoinStudyroomRequest.java → ...r/dto/studyroom/JoinStudyroomRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
src/main/java/com/linkode/api_server/repository/MemberstudyroomRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
package com.linkode.api_server.repository; | ||
|
||
import com.linkode.api_server.domain.Studyroom; | ||
import com.linkode.api_server.domain.memberstudyroom.MemberRole; | ||
import com.linkode.api_server.domain.memberstudyroom.MemberStudyroom; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
@Transactional(readOnly = true) | ||
public interface MemberstudyroomRepository extends JpaRepository<MemberStudyroom, Long> { | ||
|
||
|
||
} | ||
@Query("SELECT ms.role FROM MemberStudyroom ms WHERE ms.studyroom.studyroomId = :studyroomId AND ms.member.memberId = :memberId") | ||
Optional<MemberRole> findRoleByMemberIdAndStudyroomId(long studyroomId, long memberId); | ||
@Transactional | ||
@Modifying | ||
@Query("UPDATE MemberStudyroom ms SET ms.status = 'DELETE' WHERE ms.studyroom.studyroomId = :studyroomId") | ||
int deleteMemberStudyroom(long studyroomId); | ||
} |
15 changes: 13 additions & 2 deletions
15
src/main/java/com/linkode/api_server/repository/StudyroomRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
package com.linkode.api_server.repository; | ||
|
||
import com.linkode.api_server.domain.Studyroom; | ||
import com.linkode.api_server.dto.CreateStudyroomResponse; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
@Transactional(readOnly = true) | ||
public interface StudyroomRepository extends JpaRepository<Studyroom, Long> { | ||
@Transactional | ||
@Modifying | ||
@Query("UPDATE Studyroom sr SET sr.status = 'DELETE' WHERE sr.studyroomId = :studyroomId") | ||
int deleteStudyroom(long studyroomId); | ||
|
||
} | ||
@Query("SELECT sr From Studyroom sr WHERE sr.studyroomId = :studyroomId AND sr.status = 'ACTIVE'") | ||
Optional<Studyroom> findById(long studyroomId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters