-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathTestPlugin.ts
More file actions
34 lines (33 loc) · 992 Bytes
/
TestPlugin.ts
File metadata and controls
34 lines (33 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { PgSelectStep } from "postgraphile/@dataplan/pg";
import { extendSchema, gql } from "postgraphile/utils";
export const TestPlugin = extendSchema((build) => ({
typeDefs: gql`
extend type Query {
test(search: String!): [TestEntity]!
}
`,
objects: {
Query: {
plans: {
test: {
plan: (_$root, fieldArgs) => {
const $select =
build.input.pgRegistry.pgResources.test_entity.find();
console.log("BEFORE_APPLY========================");
fieldArgs.apply($select);
console.log("AFTER_APPLY========================");
return $select;
},
args: {
search: ($root: PgSelectStep, value) => {
console.log("search========================");
console.log(value);
console.log("search========================");
return $root;
},
},
},
},
},
},
}));