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 616b46e..db60023 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/WorkJson.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/WorkJson.java @@ -6,6 +6,8 @@ public class WorkJson { private ArrayList aid = new ArrayList<>(); + //ユーザーの制作作品idをレスポンスとして返す際に、JSONのレスポンスに合わせる + public WorkJson(Collection workList){ for (var intAid : workList){ String strAid = "/gallery/" + intAid.getAnimation().getAid(); diff --git a/src/main/java/org/ntlab/acanthus_server/models/Gallery.java b/src/main/java/org/ntlab/acanthus_server/models/Gallery.java index 27966f0..058f11b 100644 --- a/src/main/java/org/ntlab/acanthus_server/models/Gallery.java +++ b/src/main/java/org/ntlab/acanthus_server/models/Gallery.java @@ -47,7 +47,7 @@ //----------------------------------------------------------------- // 作品を作る - public int registAnimation(String animationName, Account owner){ + public int createAnimation(String animationName, Account owner){ var newAnimation = new Animation(animationName, owner); var aid = new Random().nextInt(); newAnimation.setAid(aid); 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 e7e9951..d004461 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 @@ -46,7 +46,7 @@ if(account != null && account.getToken().equals(token)){ //指定ユーザーの新しい作品の追加 - int newAid = gallery.registAnimation(animationName, account); + int newAid = gallery.createAnimation(animationName, account); var animation = gallery.getAnimationInformation(newAid); var newWork = new Work(); newWork.setWork(); @@ -71,9 +71,14 @@ if(account != null && animation != null && account.getToken().equals(invitedToken)){ //指定ユーザーの制作作品への参加の許可 - //invitedUid = - //animation.searchAnimationInvites(aid, invitedUid, invitedToken); - String untitle = ""; + String sinvitedUid = Integer.valueOf(invitedUid).toString(); + + if(animation.searchAnimationInvites(aid, sinvitedUid) != null){ + account.getInvitedMap().get(aid).setWork(); + }else{ + //作品に招待されていない場合のレスポンス + throw new WebApplicationException(401); + } }else{ //ユーザーID、トークンが間違っている時のレスポンス throw new WebApplicationException(401); diff --git a/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java b/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java index a907352..8dbac86 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java @@ -28,7 +28,7 @@ Accounts accounts = Accounts.getInstance(); Account Owner = accounts.getAccountByUid(uid); - return gallery.registAnimation(name, Owner); + return gallery.createAnimation(name, Owner); }