diff --git a/.idea/misc.xml b/.idea/misc.xml index 7e13a7a..5d9e04b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file 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 5fa76ed..48668ad 100644 --- a/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java +++ b/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java @@ -1,17 +1,99 @@ package com.example.cosmos_serversb.resources; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.stereotype.Component; -import javax.ws.rs.GET; -import javax.ws.rs.Path; +import javax.ws.rs.*; @Component @Path("/groups") public class GroupsRest { @GET - public String index() { - return "{1:Tiger}"; + public String getGroupsListByUid(String uId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; } + @POST + public String createGroup(String name, String uId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + +@Path("/{gId}") + @GET + public String getGroupInfoByGid(String gId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + + @DELETE + public String deleteGroup(String gId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + +@Path("/members") + @GET + public String getGroupMembersListByGid(String gId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + + @POST + public String addMember(String gId, String uId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + + @DELETE + public String deleteMember(String gId, String uId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + +@Path("/requests") + @GET + public String getRequestsListByGid(String gId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + + @POST + public String addRequests(String gId, String uId, String product, String deadline, int location, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + +@Path("/{rId}") + @GET + public String getRequestsDetailByGidAndRid(String gId, String rId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + @PUT + public String updateRequest(String gId, String rId, String uId, String product, String deadline, int location, boolean done, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } + + @DELETE + public String deleteRequest(String gId, String rId, String token) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(null); + return json; + } }