diff --git a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java index 5a443e9..d19adfb 100644 --- a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java +++ b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java @@ -55,7 +55,7 @@ @POST @Produces(MediaType.APPLICATION_JSON) - public String addVoicememo(@FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("time") Integer time, @FormParam("data") String data, @FormParam("latitude") Double latitude, @FormParam("longitude") Double longitude, @FormParam("title") String title, @FormParam("summary") String summary) { + public Voicememo addVoicememo(@FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("time") Integer time, @FormParam("data") String data, @FormParam("latitude") Double latitude, @FormParam("longitude") Double longitude, @FormParam("title") String title, @FormParam("summary") String summary) { if (client_token == null || uid == null || time == null || data == null || latitude == null || longitude == null || title == null) { throw new WebApplicationException(400); } @@ -78,7 +78,7 @@ if (v == null) { throw new WebApplicationException(400); } - return vid; + return v; } throw new WebApplicationException(400); @@ -162,6 +162,9 @@ if(v == null){ throw new WebApplicationException(400); } + if(v.checkFavo(uid)){ + return; + } v.addFavolist(uid); return; } @@ -215,52 +218,5 @@ } -// 以下CommentsRestで実装します。(担当:宮﨑) -// -// @Path("/{vid}/comments") -// @POST -// @Produces(MediaType.APPLICATION_JSON) -// public void addComment(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("comment") String comment){ -// if (vid == null || client_token == null || uid == null) { -// throw new WebApplicationException(400); -// } -// Account account = accounts.getAccount(uid); -// if(account == null){ -// throw new WebApplicationException(400); -// } -// String server_token = account.getToken(); -// if (client_token.equals(server_token)) { -// Voicememo v = voicememos.getVoicememo(vid); -// if(v == null){ -// throw new WebApplicationException(400); -// } -// v.createComment(uid, comment); -// return; -// } -// throw new WebApplicationException(400); -// } -// -// @Path("/{vid}/comments/{commentNo}") -// @DELETE -// @Produces(MediaType.APPLICATION_JSON) -// public void deleteComment(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @PathParam("commentNo") String commentNo){ -// if (vid == null || client_token == null || uid == null || commentNo == null) { -// throw new WebApplicationException(400); -// } -// Account account = accounts.getAccount(uid); -// if(account == null){ -// throw new WebApplicationException(400); -// } -// String server_token = account.getToken(); -// if (client_token.equals(server_token)) { -// Voicememo v = voicememos.getVoicememo(vid); -// if(v == null){ -// throw new WebApplicationException(400); -// } -// v.removeComment(commentNo); -// return; -// } -// throw new WebApplicationException(400); -// } }