mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 21:09:05 +01:00
Fix path errors. Fix data schema.
This commit is contained in:
parent
b7970585ea
commit
9940c44f2b
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/moebiusband/cc-jobarchive
|
||||
module github.com/ClusterCockpit/cc-jobarchive
|
||||
|
||||
go 1.15
|
||||
|
||||
|
@ -35,7 +35,7 @@ resolver:
|
||||
# gqlgen will search for any type names in the schema in these go packages
|
||||
# if they match it will use them, otherwise it will generate them.
|
||||
autobind:
|
||||
- "fossil.moebiusband.org/jobaccounting-backend/graph/model"
|
||||
- "github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
|
||||
# This section declares type mapping between the GraphQL and go type systems
|
||||
#
|
||||
@ -55,6 +55,6 @@ models:
|
||||
- github.com/99designs/gqlgen/graphql.Int64
|
||||
- github.com/99designs/gqlgen/graphql.Int32
|
||||
Job:
|
||||
model: "fossil.moebiusband.org/jobaccounting-backend/graph/model.Job"
|
||||
model: "github.com/ClusterCockpit/cc-jobarchive/graph/model.Job"
|
||||
Timestamp:
|
||||
model: "fossil.moebiusband.org/jobaccounting-backend/graph/model.Timestamp"
|
||||
model: "github.com/ClusterCockpit/cc-jobarchive/graph/model.Timestamp"
|
||||
|
4244
graph/generated/generated.go
Normal file
4244
graph/generated/generated.go
Normal file
File diff suppressed because it is too large
Load Diff
142
graph/model/models_gen.go
Normal file
142
graph/model/models_gen.go
Normal file
@ -0,0 +1,142 @@
|
||||
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type AddJobInput struct {
|
||||
JobID string `json:"jobId"`
|
||||
UserID string `json:"userId"`
|
||||
ProjectID string `json:"projectId"`
|
||||
ClusterID string `json:"clusterId"`
|
||||
StartTime time.Time `json:"startTime"`
|
||||
Duration int `json:"duration"`
|
||||
NumNodes int `json:"numNodes"`
|
||||
}
|
||||
|
||||
type FloatRange struct {
|
||||
From float64 `json:"from"`
|
||||
To float64 `json:"to"`
|
||||
}
|
||||
|
||||
type HistoPoint struct {
|
||||
Count int `json:"count"`
|
||||
Value int `json:"value"`
|
||||
}
|
||||
|
||||
type IntRange struct {
|
||||
From int `json:"from"`
|
||||
To int `json:"to"`
|
||||
}
|
||||
|
||||
type JobFilter struct {
|
||||
JobID *StringInput `json:"jobId"`
|
||||
UserID *StringInput `json:"userId"`
|
||||
ProjectID *StringInput `json:"projectId"`
|
||||
ClusterID *StringInput `json:"clusterId"`
|
||||
Duration *IntRange `json:"duration"`
|
||||
NumNodes *IntRange `json:"numNodes"`
|
||||
StartTime *TimeRange `json:"startTime"`
|
||||
HasProfile *bool `json:"hasProfile"`
|
||||
}
|
||||
|
||||
type JobFilterList struct {
|
||||
List []*JobFilter `json:"list"`
|
||||
}
|
||||
|
||||
type JobResultList struct {
|
||||
Items []*Job `json:"items"`
|
||||
Offset *int `json:"offset"`
|
||||
Limit *int `json:"limit"`
|
||||
Count *int `json:"count"`
|
||||
}
|
||||
|
||||
type JobsStatistics struct {
|
||||
TotalJobs int `json:"totalJobs"`
|
||||
ShortJobs int `json:"shortJobs"`
|
||||
TotalWalltime int `json:"totalWalltime"`
|
||||
TotalCoreHours int `json:"totalCoreHours"`
|
||||
HistWalltime []*HistoPoint `json:"histWalltime"`
|
||||
HistNumNodes []*HistoPoint `json:"histNumNodes"`
|
||||
}
|
||||
|
||||
type OrderByInput struct {
|
||||
Field string `json:"field"`
|
||||
Order *SortDirectionEnum `json:"order"`
|
||||
}
|
||||
|
||||
type PageRequest struct {
|
||||
ItemsPerPage *int `json:"itemsPerPage"`
|
||||
Page *int `json:"page"`
|
||||
}
|
||||
|
||||
type StartJobInput struct {
|
||||
JobID string `json:"jobId"`
|
||||
UserID string `json:"userId"`
|
||||
ProjectID string `json:"projectId"`
|
||||
ClusterID string `json:"clusterId"`
|
||||
StartTime time.Time `json:"startTime"`
|
||||
NumNodes int `json:"numNodes"`
|
||||
}
|
||||
|
||||
type StopJobInput struct {
|
||||
StopTime time.Time `json:"stopTime"`
|
||||
}
|
||||
|
||||
type StringInput struct {
|
||||
Eq *string `json:"eq"`
|
||||
Contains *string `json:"contains"`
|
||||
StartsWith *string `json:"startsWith"`
|
||||
EndsWith *string `json:"endsWith"`
|
||||
}
|
||||
|
||||
type TimeRange struct {
|
||||
From time.Time `json:"from"`
|
||||
To time.Time `json:"to"`
|
||||
}
|
||||
|
||||
type SortDirectionEnum string
|
||||
|
||||
const (
|
||||
SortDirectionEnumDesc SortDirectionEnum = "DESC"
|
||||
SortDirectionEnumAsc SortDirectionEnum = "ASC"
|
||||
)
|
||||
|
||||
var AllSortDirectionEnum = []SortDirectionEnum{
|
||||
SortDirectionEnumDesc,
|
||||
SortDirectionEnumAsc,
|
||||
}
|
||||
|
||||
func (e SortDirectionEnum) IsValid() bool {
|
||||
switch e {
|
||||
case SortDirectionEnumDesc, SortDirectionEnumAsc:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (e SortDirectionEnum) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e *SortDirectionEnum) UnmarshalGQL(v interface{}) error {
|
||||
str, ok := v.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("enums must be strings")
|
||||
}
|
||||
|
||||
*e = SortDirectionEnum(str)
|
||||
if !e.IsValid() {
|
||||
return fmt.Errorf("%s is not a valid SortDirectionEnum", str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e SortDirectionEnum) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||
}
|
@ -7,8 +7,8 @@ import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"fossil.moebiusband.org/jobaccounting-backend/graph/generated"
|
||||
"fossil.moebiusband.org/jobaccounting-backend/graph/model"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/generated"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
@ -113,8 +113,8 @@ func (r *queryResolver) Jobs(
|
||||
var qc, ob string
|
||||
|
||||
if page != nil {
|
||||
limit = *page.Limit
|
||||
offset = *page.Offset
|
||||
limit = *page.ItemsPerPage
|
||||
offset = (*page.Page - 1) * limit
|
||||
} else {
|
||||
limit = 20
|
||||
offset = 0
|
||||
|
@ -15,12 +15,6 @@ type Query {
|
||||
jobsStatistics(filter: JobFilterList): JobsStatistics!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
startJob(input: StartJobInput!): Job!
|
||||
stopJob(input: StopJobInput!): Job!
|
||||
addJob(input: AddJobInput!): Job!
|
||||
}
|
||||
|
||||
input StartJobInput {
|
||||
jobId: String!
|
||||
userId: String!
|
||||
@ -114,7 +108,7 @@ type JobsStatistics {
|
||||
}
|
||||
|
||||
input PageRequest {
|
||||
itensPerPage: Int
|
||||
itemsPerPage: Int
|
||||
page: Int
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,12 @@ import (
|
||||
|
||||
"github.com/99designs/gqlgen/graphql/handler"
|
||||
"github.com/99designs/gqlgen/graphql/playground"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/generated"
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/moebiusband/cc-jobarchive/generated"
|
||||
"github.com/moebiusband/cc-jobarchive/graph"
|
||||
)
|
||||
|
||||
const defaultPort = "8080"
|
||||
|
Loading…
Reference in New Issue
Block a user