> be fist commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
schema:
|
||||
- schema/*.gql
|
||||
|
||||
exec:
|
||||
filename: graphcore/exec_gen.go
|
||||
package: graphcore
|
||||
|
||||
model:
|
||||
filename: graphcore/input_gen.go
|
||||
package: graphcore
|
||||
|
||||
resolver:
|
||||
layout: follow-schema
|
||||
dir: resolvers
|
||||
package: resolvers
|
||||
|
||||
autobind:
|
||||
- git.aiterp.net/stufflog/server/models
|
||||
@@ -0,0 +1,30 @@
|
||||
package graph
|
||||
|
||||
import (
|
||||
"git.aiterp.net/stufflog/server/graph/graphcore"
|
||||
"git.aiterp.net/stufflog/server/graph/resolvers"
|
||||
"git.aiterp.net/stufflog/server/services"
|
||||
"github.com/99designs/gqlgen/graphql"
|
||||
"github.com/99designs/gqlgen/graphql/handler"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/99designs/gqlgen --verbose --config gqlgen.yml
|
||||
|
||||
// New creates a new GraphQL schema.
|
||||
func New(s services.Bundle) graphql.ExecutableSchema {
|
||||
return graphcore.NewExecutableSchema(graphcore.Config{
|
||||
Resolvers: &resolvers.Resolver{S: s},
|
||||
})
|
||||
}
|
||||
|
||||
func Gin(s services.Bundle) gin.HandlerFunc {
|
||||
schema := New(s)
|
||||
gqlHandler := handler.NewDefaultServer(schema)
|
||||
|
||||
return func(c *gin.Context) {
|
||||
s.Auth.CheckGinSession(c)
|
||||
|
||||
gqlHandler.ServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
||||
|
||||
package graphcore
|
||||
|
||||
import (
|
||||
"git.aiterp.net/stufflog/server/models"
|
||||
)
|
||||
|
||||
// A limited filter for constraining the list of issues within a project.
|
||||
type ProjectIssueFilter struct {
|
||||
// Filter by assignee IDs
|
||||
AssigneeIds []string `json:"assigneeIds"`
|
||||
// Text search
|
||||
Search *string `json:"search"`
|
||||
// Earliest stage (inclusive)
|
||||
MinStage *int `json:"minStage"`
|
||||
// Latest stage (inclusive)
|
||||
MaxStage *int `json:"maxStage"`
|
||||
// Limit the result set
|
||||
Limit *int `json:"limit"`
|
||||
}
|
||||
|
||||
// The permissions of a user within the project.
|
||||
type ProjectPermissions struct {
|
||||
// User ID.
|
||||
UserID string `json:"userId"`
|
||||
// Access level.
|
||||
AccessLevel int `json:"accessLevel"`
|
||||
// The user whose permissions it is. Can be null if the user no longer exists.
|
||||
User *models.User `json:"user"`
|
||||
}
|
||||
|
||||
// Input for loginUser.
|
||||
type UserLoginInput struct {
|
||||
UserID string `json:"userId"`
|
||||
Password string `json:"password"`
|
||||
RememberMe bool `json:"rememberMe"`
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package resolvers
|
||||
|
||||
// This file will be automatically regenerated based on the schema, any resolver implementations
|
||||
// will be copied through when generating and any unknown code will be moved to the end.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.aiterp.net/stufflog/server/graph/graphcore"
|
||||
"git.aiterp.net/stufflog/server/models"
|
||||
)
|
||||
|
||||
func (r *issueResolver) Project(ctx context.Context, obj *models.Issue) (*models.Project, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *issueResolver) Owner(ctx context.Context, obj *models.Issue) (*models.User, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *issueResolver) Assignee(ctx context.Context, obj *models.Issue) (*models.User, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
// Issue returns graphcore.IssueResolver implementation.
|
||||
func (r *Resolver) Issue() graphcore.IssueResolver { return &issueResolver{r} }
|
||||
|
||||
type issueResolver struct{ *Resolver }
|
||||
@@ -0,0 +1,25 @@
|
||||
package resolvers
|
||||
|
||||
// This file will be automatically regenerated based on the schema, any resolver implementations
|
||||
// will be copied through when generating and any unknown code will be moved to the end.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.aiterp.net/stufflog/server/graph/graphcore"
|
||||
"git.aiterp.net/stufflog/server/models"
|
||||
)
|
||||
|
||||
func (r *mutationResolver) LoginUser(ctx context.Context, input *graphcore.UserLoginInput) (*models.User, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *mutationResolver) LogoutUser(ctx context.Context) (*models.User, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
// Mutation returns graphcore.MutationResolver implementation.
|
||||
func (r *Resolver) Mutation() graphcore.MutationResolver { return &mutationResolver{r} }
|
||||
|
||||
type mutationResolver struct{ *Resolver }
|
||||
@@ -0,0 +1,29 @@
|
||||
package resolvers
|
||||
|
||||
// This file will be automatically regenerated based on the schema, any resolver implementations
|
||||
// will be copied through when generating and any unknown code will be moved to the end.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.aiterp.net/stufflog/server/graph/graphcore"
|
||||
"git.aiterp.net/stufflog/server/models"
|
||||
)
|
||||
|
||||
func (r *projectResolver) Issues(ctx context.Context, obj *models.Project, filter *graphcore.ProjectIssueFilter) ([]*models.Issue, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *projectResolver) Permissions(ctx context.Context, obj *models.Project) ([]*graphcore.ProjectPermissions, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *projectResolver) UserPermissions(ctx context.Context, obj *models.Project) (*graphcore.ProjectPermissions, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
// Project returns graphcore.ProjectResolver implementation.
|
||||
func (r *Resolver) Project() graphcore.ProjectResolver { return &projectResolver{r} }
|
||||
|
||||
type projectResolver struct{ *Resolver }
|
||||
@@ -0,0 +1,37 @@
|
||||
package resolvers
|
||||
|
||||
// This file will be automatically regenerated based on the schema, any resolver implementations
|
||||
// will be copied through when generating and any unknown code will be moved to the end.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.aiterp.net/stufflog/server/graph/graphcore"
|
||||
"git.aiterp.net/stufflog/server/models"
|
||||
)
|
||||
|
||||
func (r *queryResolver) Issue(ctx context.Context, id string) (*models.Issue, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *queryResolver) Issues(ctx context.Context, filter *models.IssueFilter) ([]*models.Issue, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *queryResolver) Project(ctx context.Context, id string) (*models.Project, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *queryResolver) Projects(ctx context.Context, filter *models.ProjectFilter) ([]*models.Project, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *queryResolver) Session(ctx context.Context) (*models.User, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
// Query returns graphcore.QueryResolver implementation.
|
||||
func (r *Resolver) Query() graphcore.QueryResolver { return &queryResolver{r} }
|
||||
|
||||
type queryResolver struct{ *Resolver }
|
||||
@@ -0,0 +1,11 @@
|
||||
package resolvers
|
||||
|
||||
import "git.aiterp.net/stufflog/server/services"
|
||||
|
||||
// This file will not be regenerated automatically.
|
||||
//
|
||||
// It serves as dependency injection for your app, add any dependencies you require here.
|
||||
|
||||
type Resolver struct {
|
||||
S services.Bundle
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
type Issue {
|
||||
id: String!
|
||||
projectId: String!
|
||||
ownerId: String!
|
||||
assigneeId: String!
|
||||
statusStage: Int!
|
||||
statusName: String!
|
||||
createdTime: Time!
|
||||
updatedTime: Time!
|
||||
dueTime: Time
|
||||
name: String!
|
||||
title: String!
|
||||
description: String!
|
||||
|
||||
project: Project
|
||||
owner: User
|
||||
assignee: User
|
||||
}
|
||||
|
||||
input IssueFilter {
|
||||
"Filter by issue IDs (mostly used internally by data loaders)"
|
||||
issueIds: [String!]
|
||||
"Filter by project IDs"
|
||||
projectIds: [String!]
|
||||
"Filter by owner IDs"
|
||||
ownerIds: [String!]
|
||||
"Filter by assignee IDs"
|
||||
assigneeIds: [String!]
|
||||
"Text search"
|
||||
search: String
|
||||
"Earliest stage (inclusive)"
|
||||
minStage: Int
|
||||
"Latest stage (inclusive)"
|
||||
maxStage: Int
|
||||
"Limit the result set"
|
||||
limit: Int
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
type Mutation {
|
||||
loginUser(input: UserLoginInput): User!
|
||||
logoutUser: User!
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
type Project {
|
||||
"The ID of the project, which is also the prefix for all its issues."
|
||||
id: String!
|
||||
"The name of the project, used in place of the ID in the UI."
|
||||
name: String!
|
||||
"Description of the project."
|
||||
description: String!
|
||||
"The amount of points given as a bonus towards goals for any activity on a given day."
|
||||
dailyPoints: Int!
|
||||
|
||||
"Get issues within the project."
|
||||
issues(filter: ProjectIssueFilter): [Issue!]!
|
||||
"All users' permissions. Only available to administrators and up."
|
||||
permissions: [ProjectPermissions!]!
|
||||
"Own permissions to the project. Available to any logged in user."
|
||||
userPermissions: ProjectPermissions!
|
||||
}
|
||||
|
||||
"The permissions of a user within the project."
|
||||
type ProjectPermissions {
|
||||
"User ID."
|
||||
userId: String!
|
||||
"Access level."
|
||||
accessLevel: Int!
|
||||
|
||||
"The user whose permissions it is. Can be null if the user no longer exists."
|
||||
user: User
|
||||
}
|
||||
|
||||
type ProjectStatus {
|
||||
"The stage of the status. 0=inactive, 1=pending, 2=active, 3=review, 4=completed, 5=failed, 6=postponed"
|
||||
stage: Int!
|
||||
"The name of the status."
|
||||
name: String!
|
||||
"A description of the status and where it's used."
|
||||
description: String!
|
||||
}
|
||||
|
||||
"Filter for projects query"
|
||||
input ProjectFilter {
|
||||
"Project IDs"
|
||||
projectIds: [String!]
|
||||
"Text search"
|
||||
search: String
|
||||
"User permission"
|
||||
permission: ProjectFilterPermission
|
||||
}
|
||||
|
||||
input ProjectFilterPermission {
|
||||
"User ID"
|
||||
userId: String!
|
||||
"Lowest access level to filter by (inclusive)"
|
||||
minLevel: Int!
|
||||
"Highest access level to filter by (inclusive)"
|
||||
maxLevel: Int!
|
||||
}
|
||||
|
||||
"A limited filter for constraining the list of issues within a project."
|
||||
input ProjectIssueFilter {
|
||||
"Filter by assignee IDs"
|
||||
assigneeIds: [String!]
|
||||
"Text search"
|
||||
search: String
|
||||
"Earliest stage (inclusive)"
|
||||
minStage: Int
|
||||
"Latest stage (inclusive)"
|
||||
maxStage: Int
|
||||
"Limit the result set"
|
||||
limit: Int
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
type Query {
|
||||
"Find issue"
|
||||
issue(id: String!): Issue!
|
||||
"List issues"
|
||||
issues(filter: IssueFilter): [Issue!]!
|
||||
|
||||
"Find project"
|
||||
project(id: String!): Project!
|
||||
"List projects"
|
||||
projects(filter: ProjectFilter): [Project!]!
|
||||
|
||||
"Session checks the user session."
|
||||
session: User
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
scalar Time
|
||||
@@ -0,0 +1,18 @@
|
||||
"User information."
|
||||
type User {
|
||||
"User ID, used when logging in."
|
||||
id: String!
|
||||
"User's display name, which can differ from the user ID."
|
||||
name: String!
|
||||
"Whether the user is active."
|
||||
active: Boolean!
|
||||
"Whether the user has general administrator privileges. This does not grant admin rights on any project."
|
||||
admin: Boolean!
|
||||
}
|
||||
|
||||
"Input for loginUser."
|
||||
input UserLoginInput {
|
||||
userId: String!
|
||||
password: String!
|
||||
rememberMe: Boolean!
|
||||
}
|
||||
Reference in New Issue
Block a user