post修正
1 parent 7d98623 commit 22c70319e5de61de19eb18ea5407d3a40ea4a1a1
m-horinouchi authored on 14 Jul 2020
Showing 1 changed file
View
54
src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java
}
 
@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);
}
Account account = accounts.getAccount(uid);
Voicememo v = voicememos.createVoicememo(vid, uid, time, url, latitude, longitude, title, summary);
if (v == null) {
throw new WebApplicationException(400);
}
return vid;
return v;
}
 
throw new WebApplicationException(400);
}
Voicememo v = voicememos.getVoicememo(vid);
if(v == null){
throw new WebApplicationException(400);
}
if(v.checkFavo(uid)){
return;
}
v.addFavolist(uid);
return;
}
throw new WebApplicationException(400);
throw new WebApplicationException(400);
}
 
 
// 以下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);
// }
 
}