Skip to content

Commit

Permalink
admin Delete 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
singsangssong committed Nov 6, 2024
1 parent a6ceda4 commit ea52a02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ResponseEntity<ApiResponse<Page<AdminCheckUserDto>>> checkAllAssignments(
@PageableDefault Pageable pageable,
@ModelAttribute StudentQuery studentQuery
) {
Page<AdminCheckUserDto> allAssignments = adminService.checkAssingments(studentQuery, pageable);
Page<AdminCheckUserDto> allAssignments = adminService.checkAssignments(studentQuery, pageable);
return ResponseEntity.ok(ApiResponse.ok(allAssignments));
}

Expand Down Expand Up @@ -59,7 +59,6 @@ public ResponseEntity<ApiResponse<Long>> refuseAssignment(@PathVariable("id") Lo
}



@Operation(summary = "동아리원 강제 삭제")
@DeleteMapping("/stdent/{id}")
public ResponseEntity<ApiResponse<?>> deleteStudent(@PathVariable Long id) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/kr/tgwing/tech/admin/dto/AdminCheckUserDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Getter
@Builder
@NoArgsConstructor
Expand All @@ -15,6 +17,7 @@ public class AdminCheckUserDto {
private String studentNumber;
private String email;
private String name;
private LocalDate birth;
private String phoneNumber;

public static AdminCheckUserDto of(TempUser tempUser) {
Expand All @@ -23,6 +26,7 @@ public static AdminCheckUserDto of(TempUser tempUser) {
.studentNumber(tempUser.getStudentNumber())
.email(tempUser.getEmail())
.name(tempUser.getName())
.birth(tempUser.getBirth())
.phoneNumber(tempUser.getPhoneNumber())
.build();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kr/tgwing/tech/admin/service/AdminService.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AdminService {
private final TempUserRepository tempUserRepository;
private final PostRepository postRepository;

public Page<AdminCheckUserDto> checkAssingments(StudentQuery studentQuery, Pageable pageable) {
public Page<AdminCheckUserDto> checkAssignments(StudentQuery studentQuery, Pageable pageable) {
Specification<TempUser> spec = UserSpecification.hasKeywordInTempUser(studentQuery.getKeyword());
Page<TempUser> allAssignments = tempUserRepository.findAll(spec, pageable);
if(allAssignments.isEmpty()) return null; // 여기 값은 예외로 보내야하느건지, 어떻게 보내야하는거지?
Expand Down Expand Up @@ -67,7 +67,7 @@ public Long registerUsers(Long studentId) {

public Long refuseUsers(Long studentId) {
TempUser user = tempUserRepository.findById(studentId).orElseThrow(UserNotFoundException::new);
userRepository.deleteById(studentId);
tempUserRepository.deleteById(studentId);
return user.getStudentId();
}

Expand Down

0 comments on commit ea52a02

Please sign in to comment.