Skip to content

Commit

Permalink
Merge pull request #1447 from mosen/feature/gql_query
Browse files Browse the repository at this point in the history
Fix GraphQL Support
  • Loading branch information
mosen authored Jan 22, 2022
2 parents 949b060 + d35940d commit e39adc4
Show file tree
Hide file tree
Showing 21 changed files with 34,886 additions and 34,734 deletions.
15 changes: 15 additions & 0 deletions .graphqlconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "MunkiReport-PHP GraphQL Schema",
"schemaPath": "./graphql/schema.graphql",
"extensions": {
"endpoints": {
"Default GraphQL Endpoint": {
"url": "https://localhost/graphql",
"headers": {
"user-agent": "JS GraphQL"
},
"introspect": false
}
}
}
}
16 changes: 16 additions & 0 deletions app/Http/Controllers/QueryController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

/**
* QueryController serves the landing page for the dynamic, GraphQL based, query table.
*/
class QueryController extends Controller
{
public function index()
{
return view('query.index');
}
}
5 changes: 2 additions & 3 deletions config/lighthouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@
* make sure to return spec-compliant responses in case an error is thrown.
*/
'middleware' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Nuwave\Lighthouse\Support\Http\Middleware\AcceptJson::class,

\Nuwave\Lighthouse\Support\Http\Middleware\EnsureXHR::class,
// Logs in a user if they are authenticated. In contrast to Laravel's 'auth'
// middleware, this delegates auth and permission checks to the field level.
// \Nuwave\Lighthouse\Support\Http\Middleware\AttemptAuthentication::class,

// Logs every incoming GraphQL query.
// \Nuwave\Lighthouse\Support\Http\Middleware\LogGraphQLQueries::class,

\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
],

/*
Expand Down
10 changes: 10 additions & 0 deletions graphql/comment.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

type Comment {
id: ID!
serial_number: String!
section: String
user: String
text: String
html: String
timestamp: Int
}
13 changes: 13 additions & 0 deletions graphql/event.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

type Event {
id: ID!
serial_number: String!
type: String
module: String
msg: String
data: String
timestamp: Int

machine: Machine
reportData: ReportData
}
6 changes: 6 additions & 0 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ extend type Query @guard {
reportDatum(id: ID @eq): ReportData @find
businessUnits: [BusinessUnit!]! @paginate(defaultCount: 50)
machineGroups: [MachineGroup!]! @paginate(defaultCount: 50)
comments: [Comment]! @paginate(defaultCount: 50)
events: [Event]! @paginate(defaultCount: 50)
tags: [Tag]! @paginate(defaultCount: 50)
}

#import machinegroup.graphql
#import businessunit.graphql
#import user.graphql
#import reportdata.graphql
#import machine.graphql
#import comment.graphql
#import event.graphql
#import tag.graphql
7 changes: 7 additions & 0 deletions graphql/tag.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Tag {
id: ID!
serial_number: String!
tag: String
user: String
timestamp: Int
}
29 changes: 0 additions & 29 deletions mix-manifest.json

This file was deleted.

Loading

0 comments on commit e39adc4

Please sign in to comment.