website/public/API/queries/queries.php

28 lines
772 B
PHP
Raw Normal View History

2022-03-08 09:54:38 +01:00
<?php
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
2022-03-08 10:04:11 +01:00
require "./queries/skills.php";
2022-03-08 11:05:52 +01:00
require "./queries/blogPost.php";
2022-03-08 10:04:11 +01:00
2022-03-08 09:54:38 +01:00
$queryType = new ObjectType([
'name' => 'Query',
'fields' => [
'sitekey' => [
'type' => Type::string(),
'resolve' => fn ($rootValue, $args) => $sitekey,
],
2022-03-08 10:04:11 +01:00
'skills' => [
'type' => Type::listOf(Type::string()),
'resolve' => fn ($rootValue, $args) => getSkills(),
],
2022-03-08 11:05:52 +01:00
'blogPost' => [
"type" => $blogPostFields,
'args' => [
'id' => Type::nonNull(Type::string()),
],
'resolve' => fn ($rootValue, $args) => blogPost($args["id"], $rootValue["db"]),
],
2022-03-08 09:54:38 +01:00
],
]);