wikijs-fork/server/graph/schemas/page.graphql

183 lines
3.4 KiB
GraphQL

# ===============================================
# PAGES
# ===============================================
extend type Query {
pages: PageQuery
}
extend type Mutation {
pages: PageMutation
}
# -----------------------------------------------
# QUERIES
# -----------------------------------------------
type PageQuery {
history(
id: Int!
offsetPage: Int
offsetSize: Int
): PageHistoryResult @auth(requires: ["manage:system", "read:pages"])
search(
query: String!
path: String
locale: String
): PageSearchResponse! @auth(requires: ["manage:system", "read:pages"])
list(
limit: Int
orderBy: PageOrderBy
orderByDirection: PageOrderByDirection
): [PageListItem!]! @auth(requires: ["manage:system"])
single(
id: Int!
): Page @auth(requires: ["manage:pages", "delete:pages", "manage:system"])
}
# -----------------------------------------------
# MUTATIONS
# -----------------------------------------------
type PageMutation {
create(
content: String!
description: String!
editor: String!
isPublished: Boolean!
isPrivate: Boolean!
locale: String!
path: String!
publishEndDate: Date
publishStartDate: Date
tags: [String]!
title: String!
): PageResponse @auth(requires: ["write:pages", "manage:pages", "manage:system"])
update(
id: Int!
content: String
description: String
editor: String
isPrivate: Boolean
isPublished: Boolean
locale: String
path: String
publishEndDate: Date
publishStartDate: Date
tags: [String]
title: String
): PageResponse @auth(requires: ["manage:pages", "manage:system"])
delete(
id: Int!
): DefaultResponse @auth(requires: ["delete:pages", "manage:system"])
flushCache: DefaultResponse @auth(requires: ["manage:system"])
migrateToLocale(
sourceLocale: String!
targetLocale: String!
): PageMigrationResponse @auth(requires: ["manage:system"])
}
# -----------------------------------------------
# TYPES
# -----------------------------------------------
type PageResponse {
responseResult: ResponseStatus!
page: Page
}
type PageMigrationResponse {
responseResult: ResponseStatus!
count: Int
}
type Page {
id: Int!
path: String!
hash: String!
title: String!
description: String!
isPrivate: Boolean!
isPublished: Boolean!
privateNS: String
publishStartDate: Date!
publishEndDate: String!
content: String!
render: String
toc: String
contentType: String!
createdAt: Date!
updatedAt: Date!
editor: String!
locale: String!
authorId: Int!
authorName: String!
authorEmail: String!
creatorId: Int!
creatorName: String!
creatorEmail: String!
}
type PageHistory {
versionId: Int!
authorId: Int!
authorName: String!
actionType: String!
valueBefore: String
valueAfter: String
createdAt: Date!
}
type PageHistoryResult {
trail: [PageHistory]
total: Int!
}
type PageSearchResponse {
results: [PageSearchResult]!
suggestions: [String]!
totalHits: Int!
}
type PageSearchResult {
id: String!
title: String!
description: String!
path: String!
locale: String!
}
type PageListItem {
id: Int!
path: String!
locale: String!
title: String
description: String
contentType: String!
isPublished: Boolean!
isPrivate: Boolean!
privateNS: String
createdAt: Date!
updatedAt: Date!
}
enum PageOrderBy {
CREATED
ID
PATH
TITLE
UPDATED
}
enum PageOrderByDirection {
ASC
DESC
}