mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-02-05 17:35:56 +00:00
@Tirokk @ulfgebhardt @ogerly @mattwr18 This is interesting because I found out that `neo4j-graphql-js` allows to customize graphql queries. If you define it, then it will merge the other inputs and stuff on top of it. Fair enough!
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
import CONFIG from './../config'
|
|
import activityPub from './activityPubMiddleware'
|
|
import password from './passwordMiddleware'
|
|
import softDelete from './softDeleteMiddleware'
|
|
import sluggify from './sluggifyMiddleware'
|
|
import fixImageUrls from './fixImageUrlsMiddleware'
|
|
import excerpt from './excerptMiddleware'
|
|
import dateTime from './dateTimeMiddleware'
|
|
import xss from './xssMiddleware'
|
|
import permissions from './permissionsMiddleware'
|
|
import user from './userMiddleware'
|
|
import includedFields from './includedFieldsMiddleware'
|
|
import orderBy from './orderByMiddleware'
|
|
import validation from './validation'
|
|
import notifications from './notifications'
|
|
import filterBubble from './filterBubble/filterBubble'
|
|
|
|
export default schema => {
|
|
const middlewares = {
|
|
permissions: permissions,
|
|
activityPub: activityPub,
|
|
password: password,
|
|
dateTime: dateTime,
|
|
validation: validation,
|
|
sluggify: sluggify,
|
|
excerpt: excerpt,
|
|
notifications: notifications,
|
|
xss: xss,
|
|
fixImageUrls: fixImageUrls,
|
|
softDelete: softDelete,
|
|
user: user,
|
|
includedFields: includedFields,
|
|
orderBy: orderBy,
|
|
filterBubble: filterBubble,
|
|
}
|
|
|
|
let order = [
|
|
'permissions',
|
|
'activityPub',
|
|
'filterBubble',
|
|
'password',
|
|
'dateTime',
|
|
'validation',
|
|
'sluggify',
|
|
'excerpt',
|
|
'notifications',
|
|
'xss',
|
|
'fixImageUrls',
|
|
'softDelete',
|
|
'user',
|
|
'includedFields',
|
|
'orderBy',
|
|
]
|
|
|
|
// add permisions middleware at the first position (unless we're seeding)
|
|
if (CONFIG.DISABLED_MIDDLEWARES) {
|
|
const disabledMiddlewares = CONFIG.DISABLED_MIDDLEWARES.split(',')
|
|
order = order.filter(key => {
|
|
return !disabledMiddlewares.includes(key)
|
|
})
|
|
/* eslint-disable-next-line no-console */
|
|
console.log(`Warning: "${disabledMiddlewares}" middlewares have been disabled.`)
|
|
}
|
|
|
|
return order.map(key => middlewares[key])
|
|
}
|