| | 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; |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | |