Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,40 +304,7 @@ private String signPolicyWithPrivateKey(String base64EncodedPolicy) throws Excep

return Base64.getEncoder().encodeToString(signedBytes);
}
@Override
public MaterialResponseDto getMaterialById(UUID materialId) {
try {
UserResponseDto loggedUserDetails = userDetailService.getLoggedUserDetails(UserUtil.extractToken());

if (loggedUserDetails == null) {
throw new ValueNotExistException("User not found");
}else{
Material material = materialRepository.findById(materialId).orElseThrow(()
-> new ValueNotExistException("Material not found with id " + materialId));
MaterialResponseDto dto = MaterialMapper.INSTANCE.toDto(material);
return dto;
}
}catch (Exception e) {
throw new RuntimeException(e);
}
}

@Override
public List<MaterialResponseDto> getAllMaterialBySessionId(UUID sessionId) {
try {
UserResponseDto loggedUserDetails = userDetailService.getLoggedUserDetails(UserUtil.extractToken());

if (loggedUserDetails == null) {
throw new ValueNotExistException("User not found");
}else{
List<Material> allBySessionContentId = materialRepository.findAllBySession_ContentId(sessionId);
List<MaterialResponseDto> dtos = MaterialMapper.INSTANCE.toDtoList(allBySessionContentId);
return dtos;
}
}catch (Exception e) {
throw new RuntimeException(e);
}
}

private String urlEncode(String value) {

Expand Down