Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
0d914b06
Unverified
Commit
0d914b06
authored
Jan 29, 2023
by
Leangseu Kim
Committed by
GitHub
Jan 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add singleByPath GraphQL resolver (#6011)
Co-authored-by:
k k
<
kleangseu@yahoo.com
>
parent
1da80eaa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
page.js
server/graph/resolvers/page.js
+24
-0
page.graphql
server/graph/schemas/page.graphql
+5
-0
No files found.
server/graph/resolvers/page.js
View file @
0d914b06
...
...
@@ -170,6 +170,30 @@ module.exports = {
throw
new
WIKI
.
Error
.
PageNotFound
()
}
},
async
singleByPath
(
obj
,
args
,
context
,
info
)
{
let
page
=
await
WIKI
.
models
.
pages
.
getPageFromDb
({
path
:
args
.
path
,
locale
:
args
.
locale
,
});
if
(
page
)
{
if
(
WIKI
.
auth
.
checkAccess
(
context
.
req
.
user
,
[
'manage:pages'
,
'delete:pages'
],
{
path
:
page
.
path
,
locale
:
page
.
localeCode
}))
{
return
{
...
page
,
locale
:
page
.
localeCode
,
editor
:
page
.
editorKey
,
scriptJs
:
page
.
extra
.
js
,
scriptCss
:
page
.
extra
.
css
}
}
else
{
throw
new
WIKI
.
Error
.
PageViewForbidden
()
}
}
else
{
throw
new
WIKI
.
Error
.
PageNotFound
()
}
},
/**
* FETCH TAGS
*/
...
...
server/graph/schemas/page.graphql
View file @
0d914b06
...
...
@@ -46,6 +46,11 @@ type PageQuery {
id
:
Int
!
):
Page
@
auth
(
requires
:
[
"
read
:
pages
"
,
"
manage
:
system
"
])
singleByPath
(
path
:
String
!
locale
:
String
!
):
Page
@
auth
(
requires
:
[
"
read
:
pages
"
,
"
manage
:
system
"
])
tags
:
[
PageTag
]!
@
auth
(
requires
:
[
"
manage
:
system
"
,
"
read
:
pages
"
])
searchTags
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment