Move kind to string

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-11 10:18:59 +01:00
parent 764f61bfa7
commit e393411333
19 changed files with 52 additions and 238 deletions

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<426a1227dea8949a1d77d75edf05437a>>
* @generated SignedSource<<ad7907a1de226f5486fd309c3d17e40e>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,6 @@
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
export type ProfileKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
import { FragmentRefs } from "relay-runtime";
export type PeopleGraphPaginatedFragment$data = {
readonly canCreatePeople: boolean;
@@ -26,7 +25,7 @@ export type PeopleGraphPaginatedFragment$data = {
readonly emailAddress: string;
readonly fullName: string;
readonly id: string;
readonly kind: ProfileKind | null | undefined;
readonly kind: string | null | undefined;
readonly position: string | null | undefined;
};
}>;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<e88375170021c3387ee6a5491bc60e52>>
* @generated SignedSource<<113726f3e57dbdd5c0f20352a44deca9>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -10,7 +10,6 @@
import { ReaderFragment } from 'relay-runtime';
export type MembershipRole = "ADMIN" | "AUDITOR" | "EMPLOYEE" | "OWNER" | "VIEWER";
export type ProfileKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
import { FragmentRefs } from "relay-runtime";
export type PersonFormFragment$data = {
readonly additionalEmailAddresses: ReadonlyArray<string>;
@@ -20,7 +19,7 @@ export type PersonFormFragment$data = {
readonly emailAddress: string;
readonly fullName: string;
readonly id: string;
readonly kind: ProfileKind | null | undefined;
readonly kind: string | null | undefined;
readonly membership: {
readonly role: MembershipRole;
};

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<8ef1dc9de9a669636884e4f60f7f39fc>>
* @generated SignedSource<<4dd6dcfde0f1afbc5a3245929bd8fcd9>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -11,14 +11,13 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type MembershipRole = "ADMIN" | "AUDITOR" | "EMPLOYEE" | "OWNER" | "VIEWER";
export type ProfileKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type CreateUserInput = {
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
contractEndDate?: string | null | undefined;
contractStartDate?: string | null | undefined;
emailAddress: string;
fullName: string;
kind?: ProfileKind | null | undefined;
kind?: string | null | undefined;
organizationId: string;
position?: string | null | undefined;
role: MembershipRole;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<dc04e9218150e42554925f8c39d83b41>>
* @generated SignedSource<<87d07de57247f129b66225595215a2b4>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,14 +9,13 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type ProfileKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type UpdateUserInput = {
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
contractEndDate?: string | null | undefined;
contractStartDate?: string | null | undefined;
fullName: string;
id: string;
kind?: ProfileKind | null | undefined;
kind?: string | null | undefined;
position?: string | null | undefined;
};
export type PersonForm_updateMutation$variables = {

View File

@@ -22,7 +22,6 @@ import (
"github.com/brianvoe/gofakeit/v7"
"github.com/stretchr/testify/require"
"go.probo.inc/probo/e2e/internal/testutil"
"go.probo.inc/probo/pkg/coredata"
)
func SafeName(prefix string) string {
@@ -116,7 +115,7 @@ func CreateUser(c *testutil.Client, attrs ...Attrs) string {
"emailAddress": a.getString("emailAddress", SafeEmail()),
"fullName": a.getString("fullName", SafeName("User")),
"role": a.getString("role", "EMPLOYEE"),
"kind": coredata.MembershipProfileKindEmployee.String(),
"kind": "EMPLOYEE",
"additionalEmailAddresses": []string{},
}
if position := a.getStringPtr("position"); position != nil {

View File

@@ -333,7 +333,7 @@ func (c *Client) createUser(email, fullName string, role coredata.MembershipRole
"emailAddress": email,
"fullName": fullName,
"role": string(role),
"kind": coredata.MembershipProfileKindEmployee,
"kind": "EMPLOYEE",
"additionalEmailAddresses": []string{},
},
}, &result)

View File

@@ -38,7 +38,7 @@ type (
Source ProfileSource `db:"source"`
State ProfileState `db:"state"`
FullName string `db:"full_name"`
Kind *MembershipProfileKind `db:"kind"`
Kind *string `db:"kind"`
AdditionalEmailAddresses mail.Addrs `db:"additional_email_addresses"`
Position *string `db:"position"`
ContractStartDate *time.Time `db:"contract_start_date"`

View File

@@ -1,67 +0,0 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type (
MembershipProfileKind string
)
const (
MembershipProfileKindEmployee MembershipProfileKind = "EMPLOYEE"
MembershipProfileKindContractor MembershipProfileKind = "CONTRACTOR"
MembershipProfileKindServiceAccount MembershipProfileKind = "SERVICE_ACCOUNT"
)
func MembershipProfileKinds() []MembershipProfileKind {
return []MembershipProfileKind{
MembershipProfileKindEmployee,
MembershipProfileKindContractor,
MembershipProfileKindServiceAccount,
}
}
func (mpk MembershipProfileKind) MarshalText() ([]byte, error) {
return []byte(mpk), nil
}
func (mpk *MembershipProfileKind) UnmarshalText(data []byte) error {
*mpk = MembershipProfileKind(data)
return nil
}
func (mpk MembershipProfileKind) String() string {
return string(mpk)
}
func (mpk *MembershipProfileKind) Scan(value any) error {
switch v := value.(type) {
case string:
*mpk = MembershipProfileKind(v)
case []byte:
*mpk = MembershipProfileKind(v)
default:
return fmt.Errorf("unsupported type for MembershipProfileKind: %T", value)
}
return nil
}
func (mpk MembershipProfileKind) Value() (driver.Value, error) {
return string(mpk), nil
}

View File

@@ -105,7 +105,7 @@ type (
Role coredata.MembershipRole
FullName string
AdditionalEmailAddresses mail.Addrs
Kind *coredata.MembershipProfileKind
Kind *string
Position *string
ContractStartDate **time.Time
ContractEndDate **time.Time
@@ -115,7 +115,7 @@ type (
ID gid.GID
FullName string
AdditionalEmailAddresses mail.Addrs
Kind *coredata.MembershipProfileKind
Kind *string
Position *string
ContractStartDate **time.Time
ContractEndDate **time.Time
@@ -209,7 +209,6 @@ func (cur *CreateUserRequest) Validate() error {
v := validator.New()
v.Check(cur.OrganizationID, "id", validator.Required(), validator.GID(coredata.OrganizationEntityType))
v.Check(cur.Kind, "kind", validator.OneOfSlice(coredata.MembershipProfileKinds()))
v.Check(cur.FullName, "full_name", validator.SafeTextNoNewLine(NameMaxLength))
v.CheckEach(cur.AdditionalEmailAddresses, "additional_email_addresses", func(index int, item any) {
v.Check(item, fmt.Sprintf("additional_email_addresses[%d]", index), validator.Required(), validator.NotEmpty())
@@ -225,7 +224,6 @@ func (upr *UpdateUserRequest) Validate() error {
v := validator.New()
v.Check(upr.ID, "id", validator.Required(), validator.GID(coredata.MembershipProfileEntityType))
v.Check(upr.Kind, "kind", validator.OneOfSlice(coredata.MembershipProfileKinds()))
v.Check(upr.FullName, "full_name", validator.SafeTextNoNewLine(NameMaxLength))
v.CheckEach(upr.AdditionalEmailAddresses, "additional_email_addresses", func(index int, item any) {
v.Check(item, fmt.Sprintf("additional_email_addresses[%d]", index), validator.Required(), validator.NotEmpty())

View File

@@ -223,12 +223,12 @@ func (s *Service) CreateUser(
CreatedAt: now,
UpdatedAt: now,
}
if attrs.UserType != "" {
kind := coredata.MembershipProfileKind(attrs.UserType)
profile.Kind = &kind
}
if attrs.UserType != "" {
kind := attrs.UserType
profile.Kind = &kind
}
err = profile.Insert(ctx, tx)
err = profile.Insert(ctx, tx)
if err != nil {
if errors.Is(err, coredata.ErrResourceAlreadyExists) {
return scimerrors.ScimErrorUniqueness
@@ -268,11 +268,11 @@ func (s *Service) CreateUser(
profile.Division = ref.RefOrNil(attrs.Division)
profile.ManagerValue = ref.RefOrNil(attrs.ManagerValue)
profile.UpdatedAt = now
if attrs.UserType != "" {
kind := coredata.MembershipProfileKind(attrs.UserType)
profile.Kind = &kind
}
if err := profile.Update(ctx, tx, scope); err != nil {
if attrs.UserType != "" {
kind := attrs.UserType
profile.Kind = &kind
}
if err := profile.Update(ctx, tx, scope); err != nil {
return fmt.Errorf("cannot update profile: %w", err)
}
}
@@ -524,14 +524,13 @@ func (s *Service) updateUser(
}
if attrs.UserType != nil {
if *attrs.UserType == "" {
profile.Kind = nil
} else {
kind := coredata.MembershipProfileKind(*attrs.UserType)
profile.Kind = &kind
}
profile.UpdatedAt = now
if *attrs.UserType == "" {
profile.Kind = nil
} else {
profile.Kind = attrs.UserType
}
profile.UpdatedAt = now
}
if attrs.NickName != nil {
if *attrs.NickName == "" {

View File

@@ -176,7 +176,7 @@ type Profile implements Node {
source: String!
state: ProfileState!
additionalEmailAddresses: [EmailAddr!]!
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime
contractEndDate: Datetime
@@ -214,17 +214,6 @@ enum ProfileSource
SCIM @goEnum(value: "go.probo.inc/probo/pkg/coredata.ProfileSourceSCIM")
}
enum ProfileKind @goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileKind") {
EMPLOYEE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindEmployee")
CONTRACTOR
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindContractor")
SERVICE_ACCOUNT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindServiceAccount"
)
}
type Organization implements Node {
id: ID!
name: String!
@@ -709,7 +698,7 @@ input CreateUserInput {
emailAddress: EmailAddr!
role: MembershipRole!
additionalEmailAddresses: [EmailAddr!]
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime @goField(omittable: true)
contractEndDate: Datetime @goField(omittable: true)
@@ -734,7 +723,7 @@ input UpdateUserInput {
id: ID!
fullName: String!
additionalEmailAddresses: [EmailAddr!]
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime @goField(omittable: true)
contractEndDate: Datetime @goField(omittable: true)

View File

@@ -2594,7 +2594,7 @@ type Profile implements Node {
source: String!
state: ProfileState!
additionalEmailAddresses: [EmailAddr!]!
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime
contractEndDate: Datetime
@@ -2632,17 +2632,6 @@ enum ProfileSource
SCIM @goEnum(value: "go.probo.inc/probo/pkg/coredata.ProfileSourceSCIM")
}
enum ProfileKind @goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileKind") {
EMPLOYEE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindEmployee")
CONTRACTOR
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindContractor")
SERVICE_ACCOUNT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindServiceAccount"
)
}
type Organization implements Node {
id: ID!
name: String!
@@ -3127,7 +3116,7 @@ input CreateUserInput {
emailAddress: EmailAddr!
role: MembershipRole!
additionalEmailAddresses: [EmailAddr!]
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime @goField(omittable: true)
contractEndDate: Datetime @goField(omittable: true)
@@ -3152,7 +3141,7 @@ input UpdateUserInput {
id: ID!
fullName: String!
additionalEmailAddresses: [EmailAddr!]
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime @goField(omittable: true)
contractEndDate: Datetime @goField(omittable: true)
@@ -9404,7 +9393,7 @@ func (ec *executionContext) _Profile_kind(ctx context.Context, field graphql.Col
return obj.Kind, nil
},
nil,
ec.marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind,
ec.marshalOString2ᚖstring,
true,
false,
)
@@ -9417,7 +9406,7 @@ func (ec *executionContext) fieldContext_Profile_kind(_ context.Context, field g
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type ProfileKind does not have child fields")
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
@@ -15295,7 +15284,7 @@ func (ec *executionContext) unmarshalInputCreateUserInput(ctx context.Context, o
it.AdditionalEmailAddresses = data
case "kind":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind"))
data, err := ec.unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind(ctx, v)
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
@@ -16246,7 +16235,7 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o
it.AdditionalEmailAddresses = data
case "kind":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind"))
data, err := ec.unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind(ctx, v)
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
@@ -22685,37 +22674,6 @@ func (ec *executionContext) unmarshalOProfileFilter2ᚖgoᚗproboᚗincᚋprobo
return &res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind(ctx context.Context, v any) (*coredata.MembershipProfileKind, error) {
if v == nil {
return nil, nil
}
tmp, err := graphql.UnmarshalString(v)
res := unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind[tmp]
return &res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind(ctx context.Context, sel ast.SelectionSet, v *coredata.MembershipProfileKind) graphql.Marshaler {
if v == nil {
return graphql.Null
}
_ = sel
_ = ctx
res := graphql.MarshalString(marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind[*v])
return res
}
var (
unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind = map[string]coredata.MembershipProfileKind{
"EMPLOYEE": coredata.MembershipProfileKindEmployee,
"CONTRACTOR": coredata.MembershipProfileKindContractor,
"SERVICE_ACCOUNT": coredata.MembershipProfileKindServiceAccount,
}
marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind = map[coredata.MembershipProfileKind]string{
coredata.MembershipProfileKindEmployee: "EMPLOYEE",
coredata.MembershipProfileKindContractor: "CONTRACTOR",
coredata.MembershipProfileKindServiceAccount: "SERVICE_ACCOUNT",
}
)
func (ec *executionContext) unmarshalOProfileOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconnectᚋv1ᚋtypesᚐProfileOrderBy(ctx context.Context, v any) (*types.ProfileOrderBy, error) {
if v == nil {

View File

@@ -129,7 +129,7 @@ type CreateUserInput struct {
EmailAddress mail.Addr `json:"emailAddress"`
Role coredata.MembershipRole `json:"role"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses,omitempty"`
Kind *coredata.MembershipProfileKind `json:"kind,omitempty"`
Kind *string `json:"kind,omitempty"`
Position *string `json:"position,omitempty"`
ContractStartDate graphql.Omittable[*time.Time] `json:"contractStartDate,omitempty"`
ContractEndDate graphql.Omittable[*time.Time] `json:"contractEndDate,omitempty"`
@@ -313,7 +313,7 @@ type Profile struct {
Source string `json:"source"`
State coredata.ProfileState `json:"state"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
Kind *coredata.MembershipProfileKind `json:"kind,omitempty"`
Kind *string `json:"kind,omitempty"`
Position *string `json:"position,omitempty"`
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
@@ -589,7 +589,7 @@ type UpdateUserInput struct {
ID gid.GID `json:"id"`
FullName string `json:"fullName"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses,omitempty"`
Kind *coredata.MembershipProfileKind `json:"kind,omitempty"`
Kind *string `json:"kind,omitempty"`
Position *string `json:"position,omitempty"`
ContractStartDate graphql.Omittable[*time.Time] `json:"contractStartDate,omitempty"`
ContractEndDate graphql.Omittable[*time.Time] `json:"contractEndDate,omitempty"`

View File

@@ -69,17 +69,6 @@ enum EvidenceState
@goEnum(value: "go.probo.inc/probo/pkg/coredata.EvidenceStateRequested")
}
enum ProfileKind @goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileKind") {
EMPLOYEE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindEmployee")
CONTRACTOR
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindContractor")
SERVICE_ACCOUNT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindServiceAccount"
)
}
enum DocumentStatus
@goModel(model: "go.probo.inc/probo/pkg/coredata.DocumentStatus") {
DRAFT @goEnum(value: "go.probo.inc/probo/pkg/coredata.DocumentStatusDraft")
@@ -1943,7 +1932,7 @@ type Profile implements Node {
emailAddress: EmailAddr!
state: ProfileState!
additionalEmailAddresses: [EmailAddr!]!
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime
contractEndDate: Datetime

View File

@@ -11069,17 +11069,6 @@ enum EvidenceState
@goEnum(value: "go.probo.inc/probo/pkg/coredata.EvidenceStateRequested")
}
enum ProfileKind @goModel(model: "go.probo.inc/probo/pkg/coredata.MembershipProfileKind") {
EMPLOYEE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindEmployee")
CONTRACTOR
@goEnum(value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindContractor")
SERVICE_ACCOUNT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.MembershipProfileKindServiceAccount"
)
}
enum DocumentStatus
@goModel(model: "go.probo.inc/probo/pkg/coredata.DocumentStatus") {
DRAFT @goEnum(value: "go.probo.inc/probo/pkg/coredata.DocumentStatusDraft")
@@ -12943,7 +12932,7 @@ type Profile implements Node {
emailAddress: EmailAddr!
state: ProfileState!
additionalEmailAddresses: [EmailAddr!]!
kind: ProfileKind
kind: String
position: String
contractStartDate: Datetime
contractEndDate: Datetime
@@ -47428,7 +47417,7 @@ func (ec *executionContext) _Profile_kind(ctx context.Context, field graphql.Col
return obj.Kind, nil
},
nil,
ec.marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind,
ec.marshalOString2ᚖstring,
true,
false,
)
@@ -47441,7 +47430,7 @@ func (ec *executionContext) fieldContext_Profile_kind(_ context.Context, field g
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type ProfileKind does not have child fields")
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
@@ -105089,37 +105078,6 @@ func (ec *executionContext) unmarshalOProfileFilter2ᚖgoᚗproboᚗincᚋprobo
return &res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind(ctx context.Context, v any) (*coredata.MembershipProfileKind, error) {
if v == nil {
return nil, nil
}
tmp, err := graphql.UnmarshalString(v)
res := unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind[tmp]
return &res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind(ctx context.Context, sel ast.SelectionSet, v *coredata.MembershipProfileKind) graphql.Marshaler {
if v == nil {
return graphql.Null
}
_ = sel
_ = ctx
res := graphql.MarshalString(marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind[*v])
return res
}
var (
unmarshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind = map[string]coredata.MembershipProfileKind{
"EMPLOYEE": coredata.MembershipProfileKindEmployee,
"CONTRACTOR": coredata.MembershipProfileKindContractor,
"SERVICE_ACCOUNT": coredata.MembershipProfileKindServiceAccount,
}
marshalOProfileKind2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐMembershipProfileKind = map[coredata.MembershipProfileKind]string{
coredata.MembershipProfileKindEmployee: "EMPLOYEE",
coredata.MembershipProfileKindContractor: "CONTRACTOR",
coredata.MembershipProfileKindServiceAccount: "SERVICE_ACCOUNT",
}
)
func (ec *executionContext) unmarshalOProfileOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfileOrderBy(ctx context.Context, v any) (*types.ProfileOrderBy, error) {
if v == nil {

View File

@@ -1651,7 +1651,7 @@ type Profile struct {
EmailAddress mail.Addr `json:"emailAddress"`
State coredata.ProfileState `json:"state"`
AdditionalEmailAddresses []mail.Addr `json:"additionalEmailAddresses"`
Kind *coredata.MembershipProfileKind `json:"kind,omitempty"`
Kind *string `json:"kind,omitempty"`
Position *string `json:"position,omitempty"`
ContractStartDate *time.Time `json:"contractStartDate,omitempty"`
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`

View File

@@ -105,11 +105,6 @@ components:
ProfileKind:
type: string
enum:
- EMPLOYEE
- CONTRACTOR
- SERVICE_ACCOUNT
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.MembershipProfileKind
MembershipRole:
type: string

View File

@@ -1343,7 +1343,7 @@ type CreateUserInput struct {
// Full name
FullName string `json:"full_name"`
// User kind
Kind *coredata.MembershipProfileKind `json:"kind"`
Kind *string `json:"kind"`
// Organization ID
OrganizationID gid.GID `json:"organization_id"`
// Position
@@ -2919,7 +2919,7 @@ type Profile struct {
// Profile ID
ID gid.GID `json:"id"`
// Profile kind
Kind *coredata.MembershipProfileKind `json:"kind"`
Kind *string `json:"kind"`
// Organization ID
OrganizationID gid.GID `json:"organization_id"`
// Position
@@ -3533,7 +3533,7 @@ type UpdateProfileInput struct {
// Profile ID
ID gid.GID `json:"id"`
// Profile kind
Kind *coredata.MembershipProfileKind `json:"kind,omitempty"`
Kind *string `json:"kind,omitempty"`
// Position
Position mcp.Omittable[*string] `json:"position,omitempty"`
}
@@ -3642,7 +3642,7 @@ type UpdateUserInput struct {
// User (profile) ID
ID gid.GID `json:"id"`
// User kind
Kind *coredata.MembershipProfileKind `json:"kind"`
Kind *string `json:"kind"`
// Position
Position mcp.Omittable[*string] `json:"position,omitempty"`
}

View File

@@ -27,7 +27,7 @@ type User struct {
OrganizationID gid.GID `json:"organizationId"`
EmailAddress mail.Addr `json:"emailAddress"`
FullName string `json:"fullName"`
Kind *coredata.MembershipProfileKind `json:"kind"`
Kind *string `json:"kind"`
Source coredata.ProfileSource `json:"source"`
State coredata.ProfileState `json:"state"`
AdditionalEmailAddresses mail.Addrs `json:"additionalEmailAddresses"`