mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 22:49:08 +00:00
158 lines
3.7 KiB
GraphQL
158 lines
3.7 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
|
|
shareTokens: [ShareToken] @relation(name: "SHARE_TOKEN", direction: "OUT")
|
|
}
|
|
|
|
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
|
|
|
|
shares: [ShareToken] @relation(name: "SHARES", direction: "OUT")
|
|
}
|
|
|
|
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")
|
|
|
|
shares: [ShareToken] @relation(name: "SHARES", direction: "OUT")
|
|
}
|
|
|
|
type ShareToken {
|
|
token: ID!
|
|
owner: User @relation(name: "SHARE_TOKEN", direction: "IN")
|
|
# Optional expire date
|
|
expire: Date
|
|
# Optional password
|
|
password: String
|
|
|
|
album: Album @relation(name: "SHARES", direction: "IN")
|
|
photo: Photo @relation(name: "SHARES", direction: "IN")
|
|
}
|
|
|
|
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
|
|
|
|
shareAlbum(albumId: ID!, expire: Date, password: String): ShareToken
|
|
@isAuthenticated
|
|
sharePhoto(photoId: ID!, expire: Date, password: String): ShareToken
|
|
@isAuthenticated
|
|
|
|
deleteShareToken(token: ID!): ShareToken @isAuthenticated
|
|
|
|
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
|
|
|
|
updateUser(id: ID!, username: String, rootPath: String, admin: Boolean): User
|
|
@hasRole(roles: [admin])
|
|
createUser(id: ID, username: String, rootPath: String, admin: Boolean): User
|
|
@hasRole(roles: [admin])
|
|
deleteUser(id: ID!): User @hasRole(roles: [admin])
|
|
|
|
changeUserPassword(id: ID!, newPassword: String!): Result
|
|
@hasRole(roles: [admin])
|
|
}
|
|
|
|
type Query {
|
|
siteInfo: SiteInfo
|
|
|
|
myUser: User @isAuthenticated
|
|
|
|
myAlbums: [Album] @isAuthenticated
|
|
album(id: ID): Album @isAuthenticated
|
|
|
|
myPhotos: [Photo] @isAuthenticated
|
|
photo(id: ID!): Photo @isAuthenticated
|
|
|
|
albumShares(id: ID!, password: String): [ShareToken] @isAuthenticated
|
|
photoShares(id: ID!, password: String): [ShareToken] @isAuthenticated
|
|
}
|