Files
photoview/api/src/schema.graphql
2019-07-31 00:55:48 +02:00

120 lines
2.5 KiB
GraphQL

enum Role {
admin
user
}
type User {
id: ID!
username: String!
albums: [Album] @relation(name: "OWNS", direction: "OUT")
# Local filepath for the user's photos
rootPath: String! @hasRole(roles: [admin])
admin: Boolean
}
type Album {
id: ID!
title: String
photos: [Photo] @relation(name: "CONTAINS", direction: "OUT")
subAlbums: [Album] @relation(name: "SUBALBUM", direction: "OUT")
parentAlbum: Album @relation(name: "SUBALBUM", direction: "IN")
owner: User! @relation(name: "OWNS", direction: "IN")
path: String
}
type PhotoURL {
# URL for the image
url: String
# Width of the image in pixels
width: Int
# Height of the image in pixels
height: Int
}
type PhotoEXIF {
photo: Photo @relation(name: "EXIF", direction: "IN")
camera: String
maker: String
lens: String
dateShot: DateTime
fileSize: String
exposure: String
aperture: Float
iso: Int
focalLength: String
flash: String
}
type Photo {
id: ID!
title: String
# Local filepath for the photo
path: String
# URL to display the photo in full resolution
original: PhotoURL @relation(name: "ORIGINAL_URL", direction: "OUT")
# URL to display the photo in a smaller resolution
thumbnail: PhotoURL @relation(name: "THUMBNAIL_URL", direction: "OUT")
# The album that holds the photo
album: Album! @relation(name: "CONTAINS", direction: "IN")
exif: PhotoEXIF @relation(name: "EXIF", direction: "OUT")
}
type SiteInfo {
initialSetup: Boolean!
}
type AuthorizeResult {
success: Boolean!
status: String
token: String
}
type ScannerResult {
finished: Boolean!
success: Boolean!
errorMessage: String
progress: Float
}
type Result {
success: Boolean!
errorMessage: String
}
type Subscription {
scannerStatusUpdate: ScannerResult
}
type Mutation {
authorizeUser(username: String!, password: String!): AuthorizeResult!
@neo4j_ignore
registerUser(
username: String!
password: String!
rootPath: String!
): AuthorizeResult! @hasRole(roles: [admin]) @neo4j_ignore
setAdmin(userId: ID!, admin: Boolean!): Result!
@hasRole(roles: [admin])
@neo4j_ignore
scanAll: ScannerResult! @isAuthenticated @neo4j_ignore
initialSetupWizard(
username: String!
password: String!
rootPath: String!
): AuthorizeResult @neo4j_ignore
}
type Query {
siteInfo: SiteInfo
myAlbums: [Album] @isAuthenticated
album(id: ID): Album @isAuthenticated
myPhotos: [Photo] @isAuthenticated
photo(id: ID): Photo @isAuthenticated
}