Skip to content
Snippets Groups Projects
Commit 8dc60833 authored by kbeyro's avatar kbeyro
Browse files

Add new endpoints

parent 4f6d7828
No related branches found
No related tags found
1 merge request!12Add new endpoints
Pipeline #87573 passed
...@@ -47,11 +47,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -47,11 +47,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
import java.security.Principal; import java.security.Principal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays; import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@RestController @RestController
...@@ -173,6 +169,14 @@ public class ApplicationController extends AppBaseController { ...@@ -173,6 +169,14 @@ public class ApplicationController extends AppBaseController {
appBaseService.deleteAppBase(base); appBaseService.deleteAppBase(base);
} }
@GetMapping(value = "/base/{name}")
@PreAuthorize("hasRole('ROLE_SYSTEM_ADMIN') || hasRole('ROLE_TOOL_MANAGER')")
@Transactional
public ApplicationBaseView getApplicationBase(@PathVariable String name) {
ApplicationBaseView app = modelMapper.map(appBaseService.findByName(name), ApplicationBaseView.class);
return this.setAppRating(app);
}
/* /*
* Application part * Application part
*/ */
...@@ -203,6 +207,25 @@ public class ApplicationController extends AppBaseController { ...@@ -203,6 +207,25 @@ public class ApplicationController extends AppBaseController {
); );
} }
@GetMapping(value = "/{name}/version/{version}}")
@PreAuthorize("hasRole('ROLE_SYSTEM_ADMIN') || hasRole('ROLE_TOOL_MANAGER')")
@Transactional
public ApplicationDTO getAppVersionByName(@PathVariable String name,@PathVariable String version) {
ApplicationBase base = this.appBaseService.findByName(name);
Optional<Application> application = this.applicationService.findApplication(name, version);
if(application.isPresent()) {
return new ApplicationDTO(
modelMapper.map(base, ApplicationBaseView.class),
modelMapper.map(application.get(), ApplicationView.class)
);
} else {
throw new MissingElementException("Application " + name + " version " + version + " not found");
}
}
@GetMapping(value="/{id}") @GetMapping(value="/{id}")
@Transactional @Transactional
public ApplicationDTO getApplicationDTO(@PathVariable Long id) { public ApplicationDTO getApplicationDTO(@PathVariable Long id) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment