Skip to content
Snippets Groups Projects
Commit bb8ac3bb authored by xmajdan's avatar xmajdan
Browse files

Remove training instance by pool id endpoint

parent 6b1dce19
No related branches found
No related tags found
2 merge requests!142Develop,!141Remove training instance by pool id endpoint
Pipeline #491490 passed
2.3.0 Add training access tokens to sandbox api calls. Add access token endpoints.
2.3.0 Add training access tokens to sandbox api calls. Add access token endpoint.
2.2.10 Fix user ref creation failing on parallel requests.
2.2.9 Add check to prevent reviving an expired training instance.
2.2.8 Add check for training definition being in use when trying to add, remove and update tasks.
......
......@@ -86,32 +86,6 @@ public class TrainingInstancesRestController {
return ResponseEntity.ok(trainingInstanceResource);
}
/**
* Get requested Training Instance by pool id.
*
* @param poolId id of the assigned pool.
* @return Requested Training Instance by pool id.
*/
@ApiOperation(httpMethod = "GET",
value = "Get training instance by pool id.",
response = TrainingInstanceDTO.class,
nickname = "findTrainingInstanceByPoolId",
notes = "Returns training instance by pool id.",
produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "The training instance has been found", response = TrainingInstanceDTO.class),
@ApiResponse(code = 404, message = "The training instance has not been found.", response = ApiError.class),
@ApiResponse(code = 500, message = "Unexpected condition was encountered.", response = ApiError.class)
})
@GetMapping(path = "/pool/{poolId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> findTrainingInstanceByPoolId(
@ApiParam(value = "Pool ID", required = true)
@PathVariable("poolId") Long poolId) {
TrainingInstanceDTO trainingInstanceResource = trainingInstanceFacade.findByPoolId(poolId);
return ResponseEntity.ok(trainingInstanceResource);
}
/**
* Get Training instance access token by pool id.
*
......
......@@ -106,18 +106,6 @@ public class TrainingInstanceFacade {
return trainingInstanceMapper.mapToDTO(trainingInstanceService.findByIdIncludingDefinition(id));
}
/**
* Finds specific Training Instance by pool id
*
* @param poolId ID of a pool
* @return specific {@link TrainingInstanceDTO} by pool id
*/
@IsOrganizerOrAdmin
@TransactionalRO
public TrainingInstanceDTO findByPoolId(Long poolId) {
return trainingInstanceMapper.mapToDTO(trainingInstanceService.findByPoolId(poolId));
}
/**
* Get Training instance access token by pool id.
*
......
......@@ -74,17 +74,6 @@ public class TrainingInstanceService {
.orElseThrow(() -> new EntityNotFoundException(new EntityErrorDetail(TrainingInstance.class, "id", instanceId.getClass(), instanceId)));
}
/**
* Find specific Training instance by pool id.
*
* @param poolId the pool id
* @return the {@link TrainingInstance}
*/
public TrainingInstance findByPoolId(Long poolId) {
return trainingInstanceRepository.findByPoolId(poolId)
.orElseThrow(() -> new EntityNotFoundException(new EntityErrorDetail(TrainingInstance.class, "poolId", poolId.getClass(), poolId)));
}
/**
* Find Training instance access token by pool id if exists.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment