@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<c8acfac5384ba48fe05ca8f73f32a8c5>>
|
* @generated SignedSource<<26992373ce2e1751c6d070a6bbf6c8db>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "VENDOR";
|
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE";
|
||||||
export type CreatePeopleInput = {
|
export type CreatePeopleInput = {
|
||||||
fullName: string;
|
fullName: string;
|
||||||
kind: PeopleKind;
|
kind: PeopleKind;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<c0df862d094bf6825bbda32ecda36bdd>>
|
* @generated SignedSource<<be78dd1183cd02907304e452fdec348b>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "VENDOR";
|
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE";
|
||||||
export type PeopleListPageQuery$variables = {
|
export type PeopleListPageQuery$variables = {
|
||||||
after?: any | null | undefined;
|
after?: any | null | undefined;
|
||||||
before?: any | null | undefined;
|
before?: any | null | undefined;
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -7,7 +7,6 @@ require (
|
|||||||
github.com/99designs/gqlgen v0.17.63
|
github.com/99designs/gqlgen v0.17.63
|
||||||
github.com/go-chi/chi/v5 v5.2.0
|
github.com/go-chi/chi/v5 v5.2.0
|
||||||
github.com/go-chi/cors v1.2.1
|
github.com/go-chi/cors v1.2.1
|
||||||
github.com/google/uuid v1.6.0
|
|
||||||
github.com/jackc/pgx/v5 v5.7.2
|
github.com/jackc/pgx/v5 v5.7.2
|
||||||
github.com/prometheus/client_golang v1.20.5
|
github.com/prometheus/client_golang v1.20.5
|
||||||
github.com/vektah/gqlparser/v2 v2.5.21
|
github.com/vektah/gqlparser/v2 v2.5.21
|
||||||
@@ -26,6 +25,7 @@ require (
|
|||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gorilla/websocket v1.5.3 // indirect
|
github.com/gorilla/websocket v1.5.3 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 // indirect
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ directive @goField(
|
|||||||
omittable: Boolean
|
omittable: Boolean
|
||||||
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|
||||||
|
|
||||||
|
directive @goModel(
|
||||||
|
model: String
|
||||||
|
models: [String!]
|
||||||
|
) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION
|
||||||
|
|
||||||
|
directive @goEnum(
|
||||||
|
value: String
|
||||||
|
) on ENUM_VALUE
|
||||||
|
|
||||||
scalar CursorKey
|
scalar CursorKey
|
||||||
scalar Void
|
scalar Void
|
||||||
scalar Datetime
|
scalar Datetime
|
||||||
@@ -31,10 +40,9 @@ enum EvidenceState {
|
|||||||
EXPIRED
|
EXPIRED
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PeopleKind {
|
enum PeopleKind @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") {
|
||||||
EMPLOYEE
|
EMPLOYEE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee")
|
||||||
CONTRACTOR
|
CONTRACTOR @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor")
|
||||||
VENDOR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageInfo {
|
type PageInfo {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/getprobo/probo/pkg/api/console/v1/types"
|
"github.com/getprobo/probo/pkg/api/console/v1/types"
|
||||||
"github.com/getprobo/probo/pkg/gid"
|
"github.com/getprobo/probo/pkg/gid"
|
||||||
"github.com/getprobo/probo/pkg/page"
|
"github.com/getprobo/probo/pkg/page"
|
||||||
|
"github.com/getprobo/probo/pkg/probo/coredata"
|
||||||
gqlparser "github.com/vektah/gqlparser/v2"
|
gqlparser "github.com/vektah/gqlparser/v2"
|
||||||
"github.com/vektah/gqlparser/v2/ast"
|
"github.com/vektah/gqlparser/v2/ast"
|
||||||
)
|
)
|
||||||
@@ -1277,6 +1278,15 @@ var sources = []*ast.Source{
|
|||||||
omittable: Boolean
|
omittable: Boolean
|
||||||
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|
||||||
|
|
||||||
|
directive @goModel(
|
||||||
|
model: String
|
||||||
|
models: [String!]
|
||||||
|
) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION
|
||||||
|
|
||||||
|
directive @goEnum(
|
||||||
|
value: String
|
||||||
|
) on ENUM_VALUE
|
||||||
|
|
||||||
scalar CursorKey
|
scalar CursorKey
|
||||||
scalar Void
|
scalar Void
|
||||||
scalar Datetime
|
scalar Datetime
|
||||||
@@ -1304,10 +1314,9 @@ enum EvidenceState {
|
|||||||
EXPIRED
|
EXPIRED
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PeopleKind {
|
enum PeopleKind @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") {
|
||||||
EMPLOYEE
|
EMPLOYEE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee")
|
||||||
CONTRACTOR
|
CONTRACTOR @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor")
|
||||||
VENDOR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageInfo {
|
type PageInfo {
|
||||||
@@ -5580,9 +5589,9 @@ func (ec *executionContext) _People_kind(ctx context.Context, field graphql.Coll
|
|||||||
}
|
}
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
res := resTmp.(types.PeopleKind)
|
res := resTmp.(coredata.PeopleKind)
|
||||||
fc.Result = res
|
fc.Result = res
|
||||||
return ec.marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeopleKind(ctx, field.Selections, res)
|
return ec.marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_People_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
func (ec *executionContext) fieldContext_People_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
@@ -8846,7 +8855,7 @@ func (ec *executionContext) unmarshalInputCreatePeopleInput(ctx context.Context,
|
|||||||
it.PrimaryEmailAddress = data
|
it.PrimaryEmailAddress = data
|
||||||
case "kind":
|
case "kind":
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind"))
|
||||||
data, err := ec.unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeopleKind(ctx, v)
|
data, err := ec.unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind(ctx, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
@@ -11776,16 +11785,33 @@ func (ec *executionContext) marshalNPeopleEdge2ᚖgithubᚗcomᚋgetproboᚋprob
|
|||||||
return ec._PeopleEdge(ctx, sel, v)
|
return ec._PeopleEdge(ctx, sel, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeopleKind(ctx context.Context, v any) (types.PeopleKind, error) {
|
func (ec *executionContext) unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind(ctx context.Context, v any) (coredata.PeopleKind, error) {
|
||||||
var res types.PeopleKind
|
tmp, err := graphql.UnmarshalString(v)
|
||||||
err := res.UnmarshalGQL(v)
|
res := unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind[tmp]
|
||||||
return res, graphql.ErrorOnPath(ctx, err)
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeopleKind(ctx context.Context, sel ast.SelectionSet, v types.PeopleKind) graphql.Marshaler {
|
func (ec *executionContext) marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind(ctx context.Context, sel ast.SelectionSet, v coredata.PeopleKind) graphql.Marshaler {
|
||||||
return v
|
res := graphql.MarshalString(marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind[v])
|
||||||
|
if res == graphql.Null {
|
||||||
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
|
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{
|
||||||
|
"EMPLOYEE": coredata.PeopleKindEmployee,
|
||||||
|
"CONTRACTOR": coredata.PeopleKindContractor,
|
||||||
|
}
|
||||||
|
marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{
|
||||||
|
coredata.PeopleKindEmployee: "EMPLOYEE",
|
||||||
|
coredata.PeopleKindContractor: "CONTRACTOR",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) {
|
func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) {
|
||||||
res, err := graphql.UnmarshalString(v)
|
res, err := graphql.UnmarshalString(v)
|
||||||
return res, graphql.ErrorOnPath(ctx, err)
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
@@ -12397,6 +12423,44 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) {
|
||||||
|
if v == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
var vSlice []any
|
||||||
|
if v != nil {
|
||||||
|
vSlice = graphql.CoerceList(v)
|
||||||
|
}
|
||||||
|
var err error
|
||||||
|
res := make([]string, len(vSlice))
|
||||||
|
for i := range vSlice {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
|
||||||
|
res[i], err = ec.unmarshalNString2string(ctx, vSlice[i])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ret := make(graphql.Array, len(v))
|
||||||
|
for i := range v {
|
||||||
|
ret[i] = ec.marshalNString2string(ctx, sel, v[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, e := range ret {
|
||||||
|
if e == graphql.Null {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) {
|
func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func NewPeople(p *coredata.People) *People {
|
|||||||
FullName: p.FullName,
|
FullName: p.FullName,
|
||||||
PrimaryEmailAddress: p.PrimaryEmailAddress,
|
PrimaryEmailAddress: p.PrimaryEmailAddress,
|
||||||
AdditionalEmailAddresses: p.AdditionalEmailAddresses,
|
AdditionalEmailAddresses: p.AdditionalEmailAddresses,
|
||||||
Kind: PeopleKind(p.Kind.String()),
|
Kind: p.Kind,
|
||||||
CreatedAt: p.CreatedAt,
|
CreatedAt: p.CreatedAt,
|
||||||
UpdatedAt: p.UpdatedAt,
|
UpdatedAt: p.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/getprobo/probo/pkg/gid"
|
"github.com/getprobo/probo/pkg/gid"
|
||||||
"github.com/getprobo/probo/pkg/page"
|
"github.com/getprobo/probo/pkg/page"
|
||||||
|
"github.com/getprobo/probo/pkg/probo/coredata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Node interface {
|
type Node interface {
|
||||||
@@ -61,10 +62,10 @@ type ControlStateTransitionEdge struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreatePeopleInput struct {
|
type CreatePeopleInput struct {
|
||||||
OrganizationID gid.GID `json:"organizationId"`
|
OrganizationID gid.GID `json:"organizationId"`
|
||||||
FullName string `json:"fullName"`
|
FullName string `json:"fullName"`
|
||||||
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
||||||
Kind PeopleKind `json:"kind"`
|
Kind coredata.PeopleKind `json:"kind"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateVendorInput struct {
|
type CreateVendorInput struct {
|
||||||
@@ -170,13 +171,13 @@ type PageInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type People struct {
|
type People struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
FullName string `json:"fullName"`
|
FullName string `json:"fullName"`
|
||||||
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
||||||
AdditionalEmailAddresses []string `json:"additionalEmailAddresses"`
|
AdditionalEmailAddresses []string `json:"additionalEmailAddresses"`
|
||||||
Kind PeopleKind `json:"kind"`
|
Kind coredata.PeopleKind `json:"kind"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (People) IsNode() {}
|
func (People) IsNode() {}
|
||||||
@@ -346,49 +347,6 @@ func (e EvidenceState) MarshalGQL(w io.Writer) {
|
|||||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
type PeopleKind string
|
|
||||||
|
|
||||||
const (
|
|
||||||
PeopleKindEmployee PeopleKind = "EMPLOYEE"
|
|
||||||
PeopleKindContractor PeopleKind = "CONTRACTOR"
|
|
||||||
PeopleKindVendor PeopleKind = "VENDOR"
|
|
||||||
)
|
|
||||||
|
|
||||||
var AllPeopleKind = []PeopleKind{
|
|
||||||
PeopleKindEmployee,
|
|
||||||
PeopleKindContractor,
|
|
||||||
PeopleKindVendor,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e PeopleKind) IsValid() bool {
|
|
||||||
switch e {
|
|
||||||
case PeopleKindEmployee, PeopleKindContractor, PeopleKindVendor:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e PeopleKind) String() string {
|
|
||||||
return string(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *PeopleKind) UnmarshalGQL(v any) error {
|
|
||||||
str, ok := v.(string)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("enums must be strings")
|
|
||||||
}
|
|
||||||
|
|
||||||
*e = PeopleKind(str)
|
|
||||||
if !e.IsValid() {
|
|
||||||
return fmt.Errorf("%s is not a valid PeopleKind", str)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e PeopleKind) MarshalGQL(w io.Writer) {
|
|
||||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
||||||
}
|
|
||||||
|
|
||||||
type TaskState string
|
type TaskState string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func (r *mutationResolver) CreatePeople(ctx context.Context, input types.CreateP
|
|||||||
FullName: input.FullName,
|
FullName: input.FullName,
|
||||||
PrimaryEmailAddress: input.PrimaryEmailAddress,
|
PrimaryEmailAddress: input.PrimaryEmailAddress,
|
||||||
AdditionalEmailAddresses: []string{},
|
AdditionalEmailAddresses: []string{},
|
||||||
Kind: coredata.PeopleKindEmployee,
|
Kind: input.Kind,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user