Commit 334f8f17 authored by dmorley's avatar dmorley
Browse files

add some arguments

parent f00791f6
Pipeline #5248 passed with stages
in 46 seconds
......@@ -8,7 +8,7 @@ Environmental items you need (debian based system assumed):
OS Dependencies:
```
php7.4 php7.4-curl php7.4-pgsql php7.4-bcmath php-geoip php7.4-cli php7.4-common php7.4-fpm php7.4-bcmath php7.4-json php7.4-readline php7.4-mbstring php7.4-xml php7.4-intl php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer
php7.4 php7.4-curl php7.4-pgsql php7.4-bcmath php-geoip php7.4-cli php7.4-common php7.4-fpm php7.4-bcmath php7.4-json php7.4-readline php7.4-mbstring php7.4-xml php7.4-intl php-cgi git curl postgresql postgresql-contrib dnsutils bind9 npm nodejs composer php-memcache memcached
```
Yarn is a separate install: sudo npm install -g yarn
......
......@@ -12,5 +12,5 @@ if (Request\method_is('post')) {
$schema = include __DIR__.'/schema.php';
GraphQL\init($schema);
} else {
echo "Graphql API endpoint";
echo "Graphql API endpoint, POST what you need here using Graphql";
}
<?php
use RedBeanPHP\R;
use function Siler\{array_get_str};
require_once __DIR__ . '/../boot.php';
$nodeByDomain = function ($domain) {
return R::getRow('
SELECT id, domain, name, podmin_statement, masterversion, shortversion, softwarename, daysmonitored, monthsmonitored, score, signup, protocols, name, country, countryname, city, state, detectedlanguage, uptime_alltime, active_users_halfyear, active_users_monthly, services, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, userrating, status, date_laststats
FROM pods
WHERE domain = ?
', [$domain]);
};
$queryType = array(
'nodes' => function () {
return R::getAll('
......@@ -25,7 +18,6 @@ $queryType = array(
shortversion,
stats_apikey,
score,
userrating,
ip,
detectedlanguage,
country,
......@@ -66,17 +58,87 @@ $queryType = array(
FROM pods
');
},
'checks' => function () {
'node' => function ($_, array $args) {
$domain = array_get_str($args, 'domain');
return R::getAll('
SELECT
id,
domain,
name,
softwarename,
masterversion,
fullversion,
shortversion,
stats_apikey,
score,
ip,
detectedlanguage,
country,
countryname,
city,
state,
lat,
long,
email,
ipv6,
sslvalid,
monthsmonitored,
daysmonitored,
signup,
total_users,
active_users_halfyear,
active_users_monthly,
local_posts,
uptime_alltime,
status,
latency,
service_xmpp,
services,
protocols,
token,
publickey,
tokenexpire,
podmin_statement,
podmin_notify,
podmin_notify_level,
sslexpire,
dnssec,
comment_counts,
weight,
date_updated,
date_laststats,
date_created
FROM pods
WHERE domain = ?
', [$domain]);
},
'checks' => function ($_, array $args) {
if ($args) {
$limit = array_get_str($args, 'limit');
} else {
$limit = 5000;
}
return R::getAll('
SELECT id, domain, online, error, latency, total_users, local_posts, comment_counts, shortversion, version, date_checked
FROM checks LIMIT 1000
');
FROM checks
ORDER BY date_checked DESC
LIMIT ?
', [$limit]);
},
'clicks' => function () {
'clicks' => function ($_, array $args) {
if ($args) {
$limit = array_get_str($args, 'limit');
} else {
$limit = 5000;
}
return R::getAll('
SELECT id, domain, manualclick, autoclick, date_clicked
FROM clicks LIMIT 1000
');
FROM clicks
ORDER BY date_clicked DESC
LIMIT ?
', [$limit]);
},
'monthlystats' => function () {
return R::getAll('
......
type Node {
id: Int
id: Int!
name: String
domain: String
podmin_statement: String
......@@ -10,7 +10,6 @@ type Node {
monthsmonitored: Int
fullversion: String
score: Int
userrating: Int
ip: String
detectedlanguage: String
country: String
......@@ -42,7 +41,7 @@ type Node {
}
type Click {
id: Int
id: Int!
domain: String
manualclick: Int
autoclick: Int
......@@ -50,7 +49,7 @@ type Click {
}
type Check {
id: Int
id: Int!
domain: String
online: Boolean
error: String
......@@ -64,7 +63,7 @@ type Check {
}
type MonthlyStat {
id: Int
id: Int!
softwarename: String
total_users: Int
total_posts: Int
......@@ -75,7 +74,7 @@ type MonthlyStat {
}
type MasterVersion {
id: Int
id: Int!
software: String
version: String
devlastcommit: String
......@@ -85,8 +84,9 @@ type MasterVersion {
type Query {
nodes: [Node]
clicks: [Click]
checks: [Check]
node (domain: String): [Node]
clicks (limit: Int): [Click]
checks (limit: Int): [Check]
monthlystats: [MonthlyStat]
masterversions: [MasterVersion]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment