# SCALARS scalar Date # ENUMS enum UserRole { guest user admin } enum FileType { binary image } enum RightRole { read write manage } # INTERFACES interface Base { id: Int! createdAt: Date updatedAt: Date } # TYPES type Comment implements Base { id: Int! createdAt: Date updatedAt: Date content: String document: Document! author: User! } type Document implements Base { id: Int! createdAt: Date updatedAt: Date path: String! title: String! subtitle: String parentPath: String parentTitle: String isDirectory: Boolean! isEntry: Boolean! searchContent: String tags: [Tag] } type File implements Base { id: Int! createdAt: Date updatedAt: Date category: FileType! mime: String! extra: String filename: String! basename: String! filesize: Int! folder: Folder } type Folder implements Base { id: Int! createdAt: Date updatedAt: Date name: String! files: [File] } type Group implements Base { id: Int! createdAt: Date updatedAt: Date name: String! users: [User] rights: [Right] } type Right implements Base { id: Int! createdAt: Date updatedAt: Date path: String! role: RightRole! exact: Boolean! allow: Boolean! } type Setting implements Base { id: Int! createdAt: Date updatedAt: Date key: String! config: String! } # Tags are attached to one or more documents type Tag implements Base { id: Int! createdAt: Date updatedAt: Date key: String! documents: [Document] } # A User type User implements Base { id: Int! createdAt: Date updatedAt: Date email: String! provider: String! providerId: String name: String role: UserRole! groups: [Group] } type OperationResult { succeded: Boolean! message: String } # Query (Read) type Query { comments(id: Int): [Comment] documents(id: Int, path: String): [Document] files(id: Int): [File] folders(id: Int, name: String): [Folder] groups(id: Int, name: String): [Group] rights(id: Int): [Right] settings(key: String): [Setting] tags(key: String): [Tag] users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User] } # Mutations (Create, Update, Delete) type Mutation { assignTagToDocument( tagId: Int! documentId: Int! ): OperationResult assignUserToGroup( userId: Int! groupId: Int! ): OperationResult createDocument( path: String! title: String! subtitle: String ): Document createFolder( name: String! ): Folder createGroup( name: String! ): Group createTag( name: String! ): Tag createUser( email: String! name: String passwordRaw: String provider: String! providerId: String role: UserRole! ): User deleteDocument( id: Int! ): OperationResult deleteFolder( id: Int! ): OperationResult deleteGroup( id: Int! ): OperationResult deleteTag( id: Int! ): OperationResult deleteUser( id: Int! ): OperationResult modifyDocument( id: Int! title: String subtitle: String ): Document modifyUser( id: Int! email: String name: String provider: String providerId: String role: UserRole ): User moveDocument( id: Int! path: String! ): OperationResult renameFolder( id: Int! name: String! ): OperationResult renameGroup( id: Int! name: String! ): OperationResult renameTag( id: Int! name: String! ): OperationResult removeTagFromDocument( tagId: Int! documentId: Int! ): OperationResult removeUserFromGroup( userId: Int! groupId: Int! ): OperationResult resetUserPassword( id: Int! ): OperationResult setUserPassword( id: Int! passwordRaw: String! ): OperationResult }