diff --git a/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts b/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts index 3d95b93f2..e9feac704 100644 --- a/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts +++ b/apps/console/src/__generated__/core/PeopleGraphPaginatedFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<426a1227dea8949a1d77d75edf05437a>> + * @generated SignedSource<> * @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; }; }>; diff --git a/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts b/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts index c2a2ee674..8f836ee9d 100644 --- a/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts +++ b/apps/console/src/__generated__/iam/PersonFormFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @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; @@ -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; }; diff --git a/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts b/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts index 310190464..d0f61f810 100644 --- a/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts +++ b/apps/console/src/__generated__/iam/PersonForm_createMutation.graphql.ts @@ -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 | 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; diff --git a/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts b/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts index 6efc61142..60e99b6f5 100644 --- a/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts +++ b/apps/console/src/__generated__/iam/PersonForm_updateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @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 | 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 = { diff --git a/e2e/internal/factory/factory.go b/e2e/internal/factory/factory.go index ae6e1b8ec..d9de38bce 100644 --- a/e2e/internal/factory/factory.go +++ b/e2e/internal/factory/factory.go @@ -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 { diff --git a/e2e/internal/testutil/client.go b/e2e/internal/testutil/client.go index a5e1d93cf..fb4a124d2 100644 --- a/e2e/internal/testutil/client.go +++ b/e2e/internal/testutil/client.go @@ -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) diff --git a/pkg/coredata/membership_profile.go b/pkg/coredata/membership_profile.go index fc16fda86..c012a0c79 100644 --- a/pkg/coredata/membership_profile.go +++ b/pkg/coredata/membership_profile.go @@ -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"` diff --git a/pkg/coredata/membership_profile_kind.go b/pkg/coredata/membership_profile_kind.go deleted file mode 100644 index e76dde339..000000000 --- a/pkg/coredata/membership_profile_kind.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2025 Probo Inc . -// -// 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 -} diff --git a/pkg/iam/organization_service.go b/pkg/iam/organization_service.go index eb8584a44..e8db796eb 100644 --- a/pkg/iam/organization_service.go +++ b/pkg/iam/organization_service.go @@ -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()) diff --git a/pkg/iam/scim/service.go b/pkg/iam/scim/service.go index 6fd19c510..eae8cfc86 100644 --- a/pkg/iam/scim/service.go +++ b/pkg/iam/scim/service.go @@ -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 == "" { diff --git a/pkg/server/api/connect/v1/schema.graphql b/pkg/server/api/connect/v1/schema.graphql index 49e0e3c88..e034ac2fa 100644 --- a/pkg/server/api/connect/v1/schema.graphql +++ b/pkg/server/api/connect/v1/schema.graphql @@ -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) diff --git a/pkg/server/api/connect/v1/schema/schema.go b/pkg/server/api/connect/v1/schema/schema.go index feba62563..c37b9443d 100644 --- a/pkg/server/api/connect/v1/schema/schema.go +++ b/pkg/server/api/connect/v1/schema/schema.go @@ -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 { diff --git a/pkg/server/api/connect/v1/types/types.go b/pkg/server/api/connect/v1/types/types.go index bb19266bf..294a33b86 100644 --- a/pkg/server/api/connect/v1/types/types.go +++ b/pkg/server/api/connect/v1/types/types.go @@ -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"` diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql index be4959042..8221ca199 100644 --- a/pkg/server/api/console/v1/schema.graphql +++ b/pkg/server/api/console/v1/schema.graphql @@ -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 diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go index 84f07b052..f772ed60d 100644 --- a/pkg/server/api/console/v1/schema/schema.go +++ b/pkg/server/api/console/v1/schema/schema.go @@ -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 { diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go index 1057b6801..8a3aadc77 100644 --- a/pkg/server/api/console/v1/types/types.go +++ b/pkg/server/api/console/v1/types/types.go @@ -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"` diff --git a/pkg/server/api/mcp/v1/specification.yaml b/pkg/server/api/mcp/v1/specification.yaml index e2c0ae1a6..e947f19c7 100644 --- a/pkg/server/api/mcp/v1/specification.yaml +++ b/pkg/server/api/mcp/v1/specification.yaml @@ -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 diff --git a/pkg/server/api/mcp/v1/types/types.go b/pkg/server/api/mcp/v1/types/types.go index 5be62dd15..1921c4901 100644 --- a/pkg/server/api/mcp/v1/types/types.go +++ b/pkg/server/api/mcp/v1/types/types.go @@ -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"` } diff --git a/pkg/webhook/types/user.go b/pkg/webhook/types/user.go index 3e62e5545..e67dfe83e 100644 --- a/pkg/webhook/types/user.go +++ b/pkg/webhook/types/user.go @@ -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"`