hints for site
This commit is contained in:
parent
af57fa5ac7
commit
f651f417c1
@ -25,6 +25,7 @@ public class JiResource {
|
|||||||
@GET
|
@GET
|
||||||
@Path("/listall")
|
@Path("/listall")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@RolesAllowed("root")
|
||||||
public Response listall() {
|
public Response listall() {
|
||||||
try {
|
try {
|
||||||
List<Ji> ji = jiService.getAllJiAdmin();
|
List<Ji> ji = jiService.getAllJiAdmin();
|
||||||
|
@ -30,7 +30,15 @@ public class SiteEndpoints {
|
|||||||
@Path("/listall")
|
@Path("/listall")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
public Response listall() {
|
@Operation(summary = "Lists all existing sites",
|
||||||
|
description = "Lists all sites. Root role required.")
|
||||||
|
@APIResponses({
|
||||||
|
@APIResponse(responseCode = "200", description = "Successfull")
|
||||||
|
, @APIResponse(responseCode = "500",
|
||||||
|
description = "Internal server error")
|
||||||
|
})
|
||||||
|
public Response
|
||||||
|
listall() {
|
||||||
try {
|
try {
|
||||||
List<Site> sites = siteService.getAllSites();
|
List<Site> sites = siteService.getAllSites();
|
||||||
return Response.ok(sites).build();
|
return Response.ok(sites).build();
|
||||||
@ -44,9 +52,18 @@ public class SiteEndpoints {
|
|||||||
@POST
|
@POST
|
||||||
@Path("/create")
|
@Path("/create")
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
public Response createSite(@QueryParam("name") String name,
|
@Operation(summary = "Creates a site",
|
||||||
@QueryParam("desc") String desc,
|
description = "Creates a site if no name is not a duplicate.")
|
||||||
@QueryParam("address") String address) {
|
@APIResponses({
|
||||||
|
@APIResponse(responseCode = "200", description = "Successfully created")
|
||||||
|
, @APIResponse(
|
||||||
|
responseCode = "500",
|
||||||
|
description =
|
||||||
|
"Internal server error, usually site name already taken")
|
||||||
|
})
|
||||||
|
public Response
|
||||||
|
createSite(@QueryParam("name") String name, @QueryParam("desc") String desc,
|
||||||
|
@QueryParam("address") String address) {
|
||||||
try {
|
try {
|
||||||
String jsp = siteService.createSite(name, desc, address).toString();
|
String jsp = siteService.createSite(name, desc, address).toString();
|
||||||
return Response.ok(Map.of("created", jsp)).build();
|
return Response.ok(Map.of("created", jsp)).build();
|
||||||
@ -61,7 +78,16 @@ public class SiteEndpoints {
|
|||||||
@Path("/getbyname")
|
@Path("/getbyname")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Authenticated
|
@Authenticated
|
||||||
public Response getSiteByName(@QueryParam("name") String name) {
|
@Operation(summary = "Gets a site with its name", description = "")
|
||||||
|
@APIResponses({
|
||||||
|
@APIResponse(responseCode = "200", description = "Site found")
|
||||||
|
, @APIResponse(responseCode = "500",
|
||||||
|
description =
|
||||||
|
"Internal server error, usually site not found")
|
||||||
|
})
|
||||||
|
|
||||||
|
public Response
|
||||||
|
getSiteByName(@QueryParam("name") String name) {
|
||||||
try {
|
try {
|
||||||
Site site = siteService.getSiteByName(name);
|
Site site = siteService.getSiteByName(name);
|
||||||
return Response.ok(site.toString()).build();
|
return Response.ok(site.toString()).build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user