1
Fork 0
photoview/api/graphql/schema.graphql

198 lines
4.3 KiB
GraphQL
Raw Normal View History

2020-01-31 23:30:34 +01:00
directive @isAdmin on FIELD_DEFINITION
2020-01-31 18:51:24 +01:00
scalar Time
2020-02-09 15:26:59 +01:00
enum OrderDirection {
ASC
DESC
}
input Filter {
order_by: String
order_direction: OrderDirection
limit: Int
offset: Int
}
2020-01-30 14:28:14 +01:00
type Query {
2020-02-09 12:53:21 +01:00
siteInfo: SiteInfo!
2020-02-05 16:49:51 +01:00
2020-02-01 14:52:27 +01:00
"List of registered users, must be admin to call"
2020-02-15 22:13:02 +01:00
user(filter: Filter): [User!]! @isAdmin
2020-02-01 14:52:27 +01:00
"Information about the currently logged in user"
2020-02-09 12:53:21 +01:00
myUser: User!
2020-02-01 14:52:27 +01:00
"List of albums owned by the logged in user"
2020-02-09 15:26:59 +01:00
myAlbums(filter: Filter): [Album!]!
2020-02-01 14:52:27 +01:00
"Get album by id, user must own the album or be admin"
2020-02-09 21:25:33 +01:00
album(id: Int!): Album!
2020-02-01 14:52:27 +01:00
"List of photos owned by the logged in user"
2020-02-09 15:26:59 +01:00
myPhotos(filter: Filter): [Photo!]!
2020-02-01 14:52:27 +01:00
"Get photo by id, user must own the photo or be admin"
2020-02-09 21:25:33 +01:00
photo(id: Int!): Photo!
2020-02-11 14:32:35 +01:00
shareToken(token: String!, password: String): ShareToken!
2020-01-30 14:28:14 +01:00
}
type Mutation {
authorizeUser(username: String!, password: String!): AuthorizeResult!
2020-02-05 16:49:51 +01:00
"Registers a new user, must be admin to call"
2020-01-31 18:51:24 +01:00
registerUser(
username: String!
password: String!
rootPath: String!
2020-02-09 12:53:21 +01:00
): AuthorizeResult!
2020-02-05 16:49:51 +01:00
"Registers the initial user, can only be called if initialSetup from SiteInfo is true"
initialSetupWizard(
username: String!
password: String!
rootPath: String!
): AuthorizeResult
2020-02-01 17:58:45 +01:00
"Scan all users for new photos"
2020-02-16 12:22:00 +01:00
scanAll: ScannerResult! @isAdmin
2020-02-01 17:58:45 +01:00
"Scan a single user for new photos"
2020-02-09 21:25:33 +01:00
scanUser(userId: Int!): ScannerResult!
"Generate share token for album"
shareAlbum(albumId: Int!, expire: Time, password: String): ShareToken
"Generate share token for photo"
sharePhoto(photoId: Int!, expire: Time, password: String): ShareToken
2020-02-11 15:36:12 +01:00
"Delete a share token by it's token value"
deleteShareToken(token: String!): ShareToken
2020-02-16 12:22:00 +01:00
updateUser(
id: Int!
username: String
rootPath: String
admin: Boolean
): User @isAdmin
createUser(
username: String!
rootPath: String!
password: String
admin: Boolean!
): User @isAdmin
deleteUser(id: Int!): User @isAdmin
2020-01-30 14:28:14 +01:00
}
type AuthorizeResult {
success: Boolean!
status: String!
token: String
}
2020-02-01 17:58:45 +01:00
type ScannerResult {
finished: Boolean!
success: Boolean!
progress: Float
message: String
}
2020-02-09 21:25:33 +01:00
"A token used to publicly access an album or photo"
type ShareToken {
id: Int!
token: String!
"The user who created the token"
owner: User!
"Optional expire date"
expire: Time
"The album this token shares"
album: Album
"The photo this token shares"
photo: Photo
}
2020-02-05 16:49:51 +01:00
"General public information about the site"
type SiteInfo {
initialSetup: Boolean!
}
2020-01-30 14:28:14 +01:00
type User {
2020-02-09 21:25:33 +01:00
id: Int!
2020-01-30 14:28:14 +01:00
username: String!
#albums: [Album]
2020-02-01 14:52:27 +01:00
"Local filepath for the user's photos"
2020-01-31 23:30:34 +01:00
rootPath: String! @isAdmin
2020-01-30 14:28:14 +01:00
admin: Boolean!
#shareTokens: [ShareToken]
}
2020-02-01 14:52:27 +01:00
type Album {
2020-02-09 21:25:33 +01:00
id: Int!
2020-02-09 12:53:21 +01:00
title: String!
2020-02-09 21:25:33 +01:00
"The photos inside this album"
2020-02-09 15:26:59 +01:00
photos(filter: Filter): [Photo!]!
2020-02-09 21:25:33 +01:00
"The albums contained in this album"
2020-02-09 16:16:41 +01:00
subAlbums(filter: Filter): [Album!]!
2020-02-09 21:25:33 +01:00
"The album witch contains this album"
2020-02-01 14:52:27 +01:00
parentAlbum: Album
2020-02-09 21:25:33 +01:00
"The user who owns this album"
2020-02-01 14:52:27 +01:00
owner: User!
2020-02-09 21:25:33 +01:00
"The path on the filesystem of the server, where this album is located"
2020-02-09 12:53:21 +01:00
path: String!
2020-02-09 21:25:33 +01:00
"An image in this album used for previewing this album"
2020-02-09 16:16:41 +01:00
thumbnail: Photo
2020-02-01 14:52:27 +01:00
2020-02-11 14:32:35 +01:00
shares: [ShareToken]
2020-02-01 14:52:27 +01:00
}
type PhotoURL {
"URL for previewing the image"
2020-02-09 12:53:21 +01:00
url: String!
2020-02-01 14:52:27 +01:00
"Width of the image in pixels"
2020-02-09 12:53:21 +01:00
width: Int!
2020-02-01 14:52:27 +01:00
"Height of the image in pixels"
2020-02-09 12:53:21 +01:00
height: Int!
2020-02-01 14:52:27 +01:00
}
2020-02-10 12:05:58 +01:00
type PhotoDownload {
title: String!
url: String!
}
2020-02-01 14:52:27 +01:00
type Photo {
2020-02-09 21:25:33 +01:00
id: Int!
2020-02-09 12:53:21 +01:00
title: String!
2020-02-01 14:52:27 +01:00
"Local filepath for the photo"
2020-02-09 12:53:21 +01:00
path: String!
2020-02-01 14:52:27 +01:00
"URL to display the photo in a smaller resolution"
2020-02-09 12:53:21 +01:00
thumbnail: PhotoURL!
2020-02-10 12:05:58 +01:00
"URL to display the photo in full resolution"
2020-02-09 12:53:21 +01:00
highRes: PhotoURL!
2020-02-01 14:52:27 +01:00
"The album that holds the photo"
album: Album!
2020-02-02 00:29:42 +01:00
exif: PhotoEXIF
2020-02-01 14:52:27 +01:00
2020-02-10 12:05:58 +01:00
shares: [ShareToken!]!
downloads: [PhotoDownload!]!
2020-02-01 14:52:27 +01:00
}
2020-02-02 00:29:42 +01:00
"EXIF metadata from the camera"
type PhotoEXIF {
photo: Photo
"The model name of the camera"
camera: String
"The maker of the camera"
maker: String
"The name of the lens"
lens: String
dateShot: Time
"The formatted filesize of the image"
fileSize: String
"The exposure time of the image"
exposure: String
"The aperature stops of the image"
aperture: Float
"The ISO setting of the image"
iso: Int
"The focal length of the lens, when the image was taken"
focalLength: String
"A formatted description of the flash settings, when the image was taken"
flash: String
}