mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
* lint @typescript-eslint/recommended * lint @typescript-eslint/recommended-requiring-type-checking fix type not detected locally due to wierd uuid typings missing save error not reported locally --------- Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
24 lines
745 B
TypeScript
24 lines
745 B
TypeScript
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
|
|
const defaultOrderBy = (resolve, root, args, context, resolveInfo) => {
|
|
const copy = cloneDeep(resolveInfo)
|
|
const newestFirst = {
|
|
kind: 'Argument',
|
|
name: { kind: 'Name', value: 'orderBy' },
|
|
value: { kind: 'EnumValue', value: 'createdAt_desc' },
|
|
}
|
|
const [fieldNode] = copy.fieldNodes
|
|
if (fieldNode) fieldNode.arguments.push(newestFirst)
|
|
return resolve(root, args, context, copy)
|
|
}
|
|
|
|
export default {
|
|
Query: {
|
|
Post: defaultOrderBy,
|
|
},
|
|
}
|