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 1a285a4..55a986f 100644 --- a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java +++ b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java @@ -15,6 +15,8 @@ import java.util.Map; import java.util.UUID; +import static org.ntlab.amaryllis.server.models.Voicememos.createVid; + @Component @Path("/voicememos") public class VoicememosRest { @@ -44,18 +46,20 @@ @POST @Produces(MediaType.APPLICATION_JSON) - public String addVoicememos(@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 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) { 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); String server_token = account.getToken(); if (client_token.equals(server_token)) { - Voicememo v = voicememos.createVoicememo(uid, time, data, latitude, longitude, title, summary); + String path = ""; + String url = "http://nitta-lab-www-is.konan-u.ac.jp" + path; + String vid = createVid(); + Voicememo v = voicememos.createVoicememo(vid, uid, time, url, latitude, longitude, title, summary); if (v == null) { throw new WebApplicationException(400); } - String vid = v.getVid(); return vid; }