@@ -4,6 +4,15 @@ directive @goField(
|
||||
omittable: Boolean
|
||||
) 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 Void
|
||||
scalar Datetime
|
||||
@@ -31,10 +40,9 @@ enum EvidenceState {
|
||||
EXPIRED
|
||||
}
|
||||
|
||||
enum PeopleKind {
|
||||
EMPLOYEE
|
||||
CONTRACTOR
|
||||
VENDOR
|
||||
enum PeopleKind @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") {
|
||||
EMPLOYEE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee")
|
||||
CONTRACTOR @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor")
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/getprobo/probo/pkg/api/console/v1/types"
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/page"
|
||||
"github.com/getprobo/probo/pkg/probo/coredata"
|
||||
gqlparser "github.com/vektah/gqlparser/v2"
|
||||
"github.com/vektah/gqlparser/v2/ast"
|
||||
)
|
||||
@@ -1277,6 +1278,15 @@ var sources = []*ast.Source{
|
||||
omittable: Boolean
|
||||
) 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 Void
|
||||
scalar Datetime
|
||||
@@ -1304,10 +1314,9 @@ enum EvidenceState {
|
||||
EXPIRED
|
||||
}
|
||||
|
||||
enum PeopleKind {
|
||||
EMPLOYEE
|
||||
CONTRACTOR
|
||||
VENDOR
|
||||
enum PeopleKind @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") {
|
||||
EMPLOYEE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee")
|
||||
CONTRACTOR @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor")
|
||||
}
|
||||
|
||||
type PageInfo {
|
||||
@@ -5580,9 +5589,9 @@ func (ec *executionContext) _People_kind(ctx context.Context, field graphql.Coll
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(types.PeopleKind)
|
||||
res := resTmp.(coredata.PeopleKind)
|
||||
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) {
|
||||
@@ -8846,7 +8855,7 @@ func (ec *executionContext) unmarshalInputCreatePeopleInput(ctx context.Context,
|
||||
it.PrimaryEmailAddress = data
|
||||
case "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 {
|
||||
return it, err
|
||||
}
|
||||
@@ -11776,16 +11785,33 @@ func (ec *executionContext) marshalNPeopleEdge2ᚖgithubᚗcomᚋgetproboᚋprob
|
||||
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) {
|
||||
var res types.PeopleKind
|
||||
err := res.UnmarshalGQL(v)
|
||||
func (ec *executionContext) unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind(ctx context.Context, v any) (coredata.PeopleKind, error) {
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind[tmp]
|
||||
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 {
|
||||
return v
|
||||
func (ec *executionContext) marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋproboᚋcoredataᚐPeopleKind(ctx context.Context, sel ast.SelectionSet, v coredata.PeopleKind) graphql.Marshaler {
|
||||
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) {
|
||||
res, err := graphql.UnmarshalString(v)
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
@@ -12397,6 +12423,44 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele
|
||||
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) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
|
||||
@@ -45,7 +45,7 @@ func NewPeople(p *coredata.People) *People {
|
||||
FullName: p.FullName,
|
||||
PrimaryEmailAddress: p.PrimaryEmailAddress,
|
||||
AdditionalEmailAddresses: p.AdditionalEmailAddresses,
|
||||
Kind: PeopleKind(p.Kind.String()),
|
||||
Kind: p.Kind,
|
||||
CreatedAt: p.CreatedAt,
|
||||
UpdatedAt: p.UpdatedAt,
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/page"
|
||||
"github.com/getprobo/probo/pkg/probo/coredata"
|
||||
)
|
||||
|
||||
type Node interface {
|
||||
@@ -61,10 +62,10 @@ type ControlStateTransitionEdge struct {
|
||||
}
|
||||
|
||||
type CreatePeopleInput struct {
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
FullName string `json:"fullName"`
|
||||
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
||||
Kind PeopleKind `json:"kind"`
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
FullName string `json:"fullName"`
|
||||
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
||||
Kind coredata.PeopleKind `json:"kind"`
|
||||
}
|
||||
|
||||
type CreateVendorInput struct {
|
||||
@@ -170,13 +171,13 @@ type PageInfo struct {
|
||||
}
|
||||
|
||||
type People struct {
|
||||
ID gid.GID `json:"id"`
|
||||
FullName string `json:"fullName"`
|
||||
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
||||
AdditionalEmailAddresses []string `json:"additionalEmailAddresses"`
|
||||
Kind PeopleKind `json:"kind"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
FullName string `json:"fullName"`
|
||||
PrimaryEmailAddress string `json:"primaryEmailAddress"`
|
||||
AdditionalEmailAddresses []string `json:"additionalEmailAddresses"`
|
||||
Kind coredata.PeopleKind `json:"kind"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (People) IsNode() {}
|
||||
@@ -346,49 +347,6 @@ func (e EvidenceState) MarshalGQL(w io.Writer) {
|
||||
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
|
||||
|
||||
const (
|
||||
|
||||
@@ -105,7 +105,7 @@ func (r *mutationResolver) CreatePeople(ctx context.Context, input types.CreateP
|
||||
FullName: input.FullName,
|
||||
PrimaryEmailAddress: input.PrimaryEmailAddress,
|
||||
AdditionalEmailAddresses: []string{},
|
||||
Kind: coredata.PeopleKindEmployee,
|
||||
Kind: input.Kind,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user