generated from kriasoft/graphql-starter-kit
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.code-snippets
24 lines (24 loc) · 830 Bytes
/
api.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"Query": {
"scope": "javascript,typescript",
"prefix": "query-list",
"body": [
"import { GraphQLFieldConfig, GraphQLList, GraphQLNonNull } from \"graphql\";",
"import { Context, db, ${1/^(.)(.*?)s?$/${1:/upcase}$2/} } from \"../core\";",
"import { ${1/^(.)(.*?)s?$/${1:/upcase}$2/}Type } from \"../types\";",
"",
"export const ${1:field}: GraphQLFieldConfig<unknown, Context> = {",
" type: new GraphQLNonNull(new GraphQLList(${1/^(.)(.*?)s?$/${1:/upcase}$2/}Type)),",
" description: \"${2:description}\",",
"",
" args: {},",
"",
" resolve(self, args, ctx) {",
" return db.table<${1/^(.)(.*?)s?$/${1:/upcase}$2/}>(\"${1/^(.*?)s?$/$1/}\").select();",
" },",
"};",
""
],
"description": "Query List Field"
}
}