feat : reportSet delete 추가
This commit is contained in:
parent
0f60c9c4cf
commit
5dfbcb3dd2
@ -87,4 +87,13 @@ public class ReportController {
|
|||||||
return new ResponseEntity<>(reportResponses, HttpStatus.OK);
|
return new ResponseEntity<>(reportResponses, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/teacher/report/{reportSetId}")
|
||||||
|
public ResponseEntity<?> deleteReportSet(@PathVariable("reportSetId") UUID reportSetId, HttpServletRequest request){
|
||||||
|
String token = request.getHeader("Authorization");
|
||||||
|
long userId = Long.parseLong(jwtUtil.getUserId(token));
|
||||||
|
|
||||||
|
reportService.deleteReportSet(reportSetId, userId);
|
||||||
|
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,4 +55,8 @@ public class ReportSet {
|
|||||||
.testAt(createAt)
|
.testAt(createAt)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long findUserId(){
|
||||||
|
return lecture.getUser().getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,6 @@ public interface ReportService {
|
|||||||
List<ReportResponse> findReports(long lectureId, long userid);
|
List<ReportResponse> findReports(long lectureId, long userid);
|
||||||
|
|
||||||
UUID initReportSet(long lectureId, long quizSetId);
|
UUID initReportSet(long lectureId, long quizSetId);
|
||||||
|
|
||||||
|
void deleteReportSet(UUID reportSetId, long userId);
|
||||||
}
|
}
|
||||||
|
@ -172,4 +172,11 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
return reportSet.getId();
|
return reportSet.getId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteReportSet(UUID reportSetId, long userId) {
|
||||||
|
ReportSet reportSet = reportSetRepository.findById(reportSetId).orElseThrow(NoSuchElementException::new);
|
||||||
|
if(reportSet.findUserId() == userId)
|
||||||
|
reportSetRepository.delete(reportSet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user