diff --git a/src/main/java/org/ntlab/acanthus_server/entities/Animation.java b/src/main/java/org/ntlab/acanthus_server/entities/Animation.java index c200f99..91ab975 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Animation.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Animation.java @@ -1,8 +1,10 @@ package org.ntlab.acanthus_server.entities; +import com.fasterxml.jackson.annotation.JsonIgnore; import org.ntlab.acanthus_server.models.Accounts; import org.ntlab.acanthus_server.models.Gallery; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -13,7 +15,7 @@ private String name; private String description; private Boolean isPublic; - private String createdDate; + private LocalDateTime createdDate; private String lastUpdate; private Integer likes; private Integer views; @@ -23,11 +25,13 @@ private ArrayList invites = new ArrayList<>(); private HashMap pageMap = new HashMap<>(); + @JsonIgnore + private boolean isDummy; + public Animation(Integer aid, String name, Account owner) { this.aid = aid; this.name = name; - Date dt = new Date(); - this.createdDate = dt.toString(); + this.createdDate = LocalDateTime.now(); this.isPublic = false; this.owner = owner; this.editors.add(new Editor(owner, true)); @@ -123,6 +127,35 @@ invites.remove(invitedAccount); } + + //----------------------------------------------------------------- + //gallery/aid/editorsのPUTの中身の処理 + public void restWorkToEditors(Integer aid, Integer Uid) { + Account account = accounts.getAccountByUid(Uid); + Animation animation = gallery.getAnimationByAid(aid); + + Editor editor = new Editor(account, false); + editor.setAccount(account); + animation.addEditors(editor); + animation.removeAnimationInvites(account); + } + + + //----------------------------------------------------------------- + //----------------------------------------------------------------- + // ダミー + private void createDummyAnimation() { + this.isDummy = true; + this.aid = 1111; + this.name = "dummyAnimation"; + this.isPublic = false; + this.owner = accounts.getAccountByUid(1); + this.editors.add(new Editor(owner, true)); + this.pageMap.put(0,0); + this.createdDate = LocalDateTime.now(); + + //this.lastAccess = LocalDateTime.of(2015, 12, 15, 0, 0); + } //----------------------------------------------------------------- }