diff --git a/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java b/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java index 48668ad..56e936d 100644 --- a/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java +++ b/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java @@ -7,91 +7,99 @@ import javax.ws.rs.*; @Component -@Path("/groups") + public class GroupsRest { - + @Path("/groups") @GET - public String getGroupsListByUid(String uId, String token) throws JsonProcessingException{ + public String getGroupsListByUid(@QueryParam("uId") String uId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + @Path("/groups") @POST - public String createGroup(String name, String uId, String token) throws JsonProcessingException{ + public String createGroup(@FormParam("name") String name, @FormParam("uId") String uId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } -@Path("/{gId}") + @Path("/{gId}") @GET - public String getGroupInfoByGid(String gId, String token) throws JsonProcessingException{ + public String getGroupInfoByGid(@PathParam("gId") String gId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + @Path("/{gId}") @DELETE - public String deleteGroup(String gId, String token) throws JsonProcessingException{ + public String deleteGroup(@PathParam("gId") String gId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } -@Path("/members") + @Path("/{gId}/members") @GET - public String getGroupMembersListByGid(String gId, String token) throws JsonProcessingException{ + public String getGroupMembersListByGid(@PathParam("gId") String gId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + @Path("/{gId}/members") @POST - public String addMember(String gId, String uId, String token) throws JsonProcessingException{ + public String addMember(@PathParam("gId") String gId, @FormParam("uId") String uId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + @Path("/{gId}/members") @DELETE - public String deleteMember(String gId, String uId, String token) throws JsonProcessingException{ + public String deleteMember(@PathParam("gId") String gId, @FormParam("uId") String uId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } -@Path("/requests") + @Path("/{gId}/requests") @GET - public String getRequestsListByGid(String gId, String token) throws JsonProcessingException{ + public String getRequestsListByGid(@PathParam("gId") String gId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + @Path("/{gId}/requests") @POST - public String addRequests(String gId, String uId, String product, String deadline, int location, String token) throws JsonProcessingException{ + public String addRequests(@PathParam("gId") String gId, @FormParam("uId") String uId, @FormParam("product") String product, @FormParam("deadline") String deadline, @FormParam("location") int location, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } -@Path("/{rId}") + @Path("{gId}/requests/{rId}") @GET - public String getRequestsDetailByGidAndRid(String gId, String rId, String token) throws JsonProcessingException{ + public String getRequestsDetailByGidAndRid(@PathParam("gId") String gId, @PathParam("rId") String rId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + + @Path("{gId}/requests/{rId}") @PUT - public String updateRequest(String gId, String rId, String uId, String product, String deadline, int location, boolean done, String token) throws JsonProcessingException{ + public String updateRequest(@PathParam("gId") String gId, @PathParam("rId") String rId, @FormParam("uId") String uId, @FormParam("product") String product, @FormParam("deadline") String deadline, @FormParam("location") int location, @FormParam("done") boolean done, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json; } + @Path("{gId}/requests/{rId}") @DELETE - public String deleteRequest(String gId, String rId, String token) throws JsonProcessingException{ + public String deleteRequest(@PathParam("gId") String gId, @PathParam("rId") String rId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(null); return json;