cc-backend/README.md

49 lines
1.1 KiB
Markdown
Raw Normal View History

2021-03-31 08:52:43 +02:00
# Run server
2021-03-31 08:56:36 +02:00
* The server expects the SQLite Job database in `job.db`.
2021-04-07 09:19:21 +02:00
* The metric data as JSON is expected in `job-data/.../.../{data.json|meta.json}`
2021-03-31 08:56:36 +02:00
* Run ```go run server.go```
* The GraphQL backend is located at http://localhost:8080/query/ .
2021-03-31 08:52:43 +02:00
2021-03-31 08:54:14 +02:00
# Debugging and Testing
There is a GraphQL PLayground for testing queries at http://localhost:8080/ .
2021-03-31 08:58:34 +02:00
Example Query:
```
query($filter: JobFilterList!, $sorting: OrderByInput!, $paging: PageRequest!) {
jobs(
filter: $filter
order: $sorting
page: $paging
) {
count
items {
id
jobId
userId
startTime
duration
}
}
}
```
Using the Query variables:
```
{
"filter": { "list": [
{"userId": {"contains": "unrz"}},
{"duration": {"from": 60, "to": 1000}},
2021-04-07 09:19:21 +02:00
{"startTime": {"from": "2019-06-01T00:00:00.00Z", "to": "2019-10-01T00:00:00.00Z"}}]},
2021-03-31 08:58:34 +02:00
"sorting": { "field": "start_time", "order": "ASC" },
"paging": { "itemsPerPage": 20, "page": 1 }
}
```
2021-03-31 08:52:43 +02:00
# Changing the GraphQL schema
2019-04-29 10:26:20 +02:00
* Edit ```./graph/schema.graphqls```
* Regenerate code: ```gqlgen generate```
2021-04-07 09:19:21 +02:00
* Implement callbacks in ```graph/resolvers.go```