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 d19adfb..801912a 100644 --- a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java +++ b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java @@ -29,7 +29,10 @@ //ใƒ†ใ‚นใƒˆ็”จ { Account a = accounts.getAccount("test"); - a.setToken("a"); + a.setToken("test_token"); + + Account b = accounts.getAccount("hogehoge"); + b.setToken("hoge_token"); } { voicememos.createVoicememo("vid","test",1,"url",3,3,"a","a"); @@ -107,7 +110,7 @@ @Path("/{vid}") @PUT @Produces(MediaType.APPLICATION_JSON) - public void correctVoicememo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("title") String title, @FormParam("summary") String summary) { + public String correctVoicememo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("title") String title, @FormParam("summary") String summary) { if (vid == null || client_token == null || uid == null || title == null) { throw new WebApplicationException(400); } @@ -120,7 +123,8 @@ Voicememo v = voicememos.getVoicememo(vid); v.setSummary(summary); v.setTitle(title); - return; + String message = "success"; + return message; } throw new WebApplicationException(400); } @@ -128,7 +132,7 @@ @Path("/{vid}") @DELETE @Produces(MediaType.APPLICATION_JSON) - public void deleteVoicememo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid) { + public String deleteVoicememo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid) { if (vid == null || client_token == null || uid == null) { throw new WebApplicationException(400); } @@ -139,7 +143,8 @@ String server_token = account.getToken(); if (client_token.equals(server_token)) { voicememos.removeVoicememo(vid); - return; + String message = "success"; + return message; } throw new WebApplicationException(400); } @@ -148,7 +153,7 @@ @Path("/{vid}/myfavo") @PUT @Produces(MediaType.APPLICATION_JSON) - public void addMyfavo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ + public String addMyfavo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ if (vid == null || client_token == null || uid == null) { throw new WebApplicationException(400); } @@ -162,11 +167,9 @@ if(v == null){ throw new WebApplicationException(400); } - if(v.checkFavo(uid)){ - return; - } v.addFavolist(uid); - return; + String message = "success"; + return message; } throw new WebApplicationException(400); } @@ -174,7 +177,7 @@ @Path("/{vid}/myfavo") @DELETE @Produces(MediaType.APPLICATION_JSON) - public void deleteMyfavo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ + public String deleteMyfavo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ if (vid == null || client_token == null || uid == null) { throw new WebApplicationException(400); } @@ -189,7 +192,8 @@ throw new WebApplicationException(400); } v.removeFavolist(uid); - return; + String message = "success"; + return message; } throw new WebApplicationException(400); } @@ -197,7 +201,7 @@ @Path("/{vid}/times") @POST @Produces(MediaType.APPLICATION_JSON) - public void countTimes(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ + public String countTimes(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ if (vid == null || client_token == null || uid == null) { throw new WebApplicationException(400); } @@ -212,7 +216,8 @@ throw new WebApplicationException(400); } v.addTimes(); - return; + String message = "success"; + return message; } throw new WebApplicationException(400); }