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
33a9d577
Unverified
Commit
33a9d577
authored
Jun 25, 2020
by
Regev Brody
Committed by
GitHub
Jun 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: GraphQL error with MySQL and FULL OUTER JOIN (#2104)
* fix: GraphQL error with MySQL and FULL OUTER JOIN #2071
parent
6ef7b0f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
page.js
server/graph/resolvers/page.js
+24
-7
No files found.
server/graph/resolvers/page.js
View file @
33a9d577
...
...
@@ -246,14 +246,31 @@ module.exports = {
* FETCH PAGE LINKS
*/
async
links
(
obj
,
args
,
context
,
info
)
{
let
results
=
[]
let
results
;
results
=
await
WIKI
.
models
.
knex
(
'pages'
)
.
column
({
id
:
'pages.id'
},
{
path
:
'pages.path'
},
'title'
,
{
link
:
'pageLinks.path'
},
{
locale
:
'pageLinks.localeCode'
})
.
fullOuterJoin
(
'pageLinks'
,
'pages.id'
,
'pageLinks.pageId'
)
.
where
({
'pages.localeCode'
:
args
.
locale
})
if
(
WIKI
.
config
.
db
.
type
===
'mysql'
||
WIKI
.
config
.
db
.
type
===
'mariadb'
||
WIKI
.
config
.
db
.
type
===
'sqlite'
)
{
results
=
await
WIKI
.
models
.
knex
(
'pages'
)
.
column
({
id
:
'pages.id'
},
{
path
:
'pages.path'
},
'title'
,
{
link
:
'pageLinks.path'
},
{
locale
:
'pageLinks.localeCode'
})
.
leftJoin
(
'pageLinks'
,
'pages.id'
,
'pageLinks.pageId'
)
.
where
({
'pages.localeCode'
:
args
.
locale
})
.
unionAll
(
WIKI
.
models
.
knex
(
'pageLinks'
)
.
column
({
id
:
'pages.id'
},
{
path
:
'pages.path'
},
'title'
,
{
link
:
'pageLinks.path'
},
{
locale
:
'pageLinks.localeCode'
})
.
leftJoin
(
'pages'
,
'pageLinks.pageId'
,
'pages.id'
)
.
where
({
'pages.localeCode'
:
args
.
locale
})
)
}
else
{
results
=
await
WIKI
.
models
.
knex
(
'pages'
)
.
column
({
id
:
'pages.id'
},
{
path
:
'pages.path'
},
'title'
,
{
link
:
'pageLinks.path'
},
{
locale
:
'pageLinks.localeCode'
})
.
fullOuterJoin
(
'pageLinks'
,
'pages.id'
,
'pageLinks.pageId'
)
.
where
({
'pages.localeCode'
:
args
.
locale
})
}
return
_
.
reduce
(
results
,
(
result
,
val
)
=>
{
// -> Check if user has access to source and linked page
...
...
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