diff --git a/src/main/java/org/ntlab/acanthus_server/entities/WorkJson.java b/src/main/java/org/ntlab/acanthus_server/entities/WorkJson.java index 654e426..616b46e 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/WorkJson.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/WorkJson.java @@ -11,6 +11,8 @@ String strAid = "/gallery/" + intAid.getAnimation().getAid(); aid.add(strAid); } + + getAid(); } public Collection getAid() { diff --git a/src/main/java/org/ntlab/acanthus_server/resources/accounts/WorkRest.java b/src/main/java/org/ntlab/acanthus_server/resources/accounts/WorkRest.java index 49a6c32..14d7e3d 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/accounts/WorkRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/accounts/WorkRest.java @@ -1,5 +1,7 @@ package org.ntlab.acanthus_server.resources.accounts; +import org.ntlab.acanthus_server.entities.Account; +import org.ntlab.acanthus_server.entities.Animation; import org.ntlab.acanthus_server.entities.Work; import org.ntlab.acanthus_server.entities.WorkJson; import org.ntlab.acanthus_server.models.Accounts; @@ -42,13 +44,19 @@ @Path("/{uid}/work") @POST @Produces(MediaType.APPLICATION_JSON) - public String createWork(@PathParam("uid") Integer uid, @FormParam("token") String token){ + public Integer createWork(@PathParam("uid") Integer uid, @FormParam("token") String token){ var account = accounts.getAccountByUid(uid); if(account != null && account.getToken().equals(token)){ //指定ユーザーの新しい作品の追加 - - return ""; + String name = "aa"; + int newAid = gallery.registAnimation(name, account); + var animation = gallery.getAnimationInformation(newAid); + var newWork = new Work(); + newWork.setWork(); + newWork.setAnimation(animation); + account.addWork(newWork); + return newAid; }else{ //ユーザーID、トークンが間違っている時のレスポンス throw new WebApplicationException(401);