Add service account people kind

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-16 18:43:58 +01:00
parent 34ef38a0eb
commit 257ea563a9
11 changed files with 69 additions and 22 deletions

View File

@@ -75,7 +75,7 @@ function CreatePeoplePageContent() {
fullName: "", fullName: "",
primaryEmailAddress: "", primaryEmailAddress: "",
additionalEmailAddresses: [] as string[], additionalEmailAddresses: [] as string[],
kind: "EMPLOYEE" as "EMPLOYEE" | "CONTRACTOR", kind: "EMPLOYEE" as "EMPLOYEE" | "CONTRACTOR" | "SERVICE_ACCOUNT",
}); });
const handleFieldChange = (field: keyof typeof formData, value: unknown) => { const handleFieldChange = (field: keyof typeof formData, value: unknown) => {
@@ -255,6 +255,20 @@ function CreatePeoplePageContent() {
> >
Contractor Contractor
</button> </button>
<button
type="button"
onClick={() =>
handleFieldChange("kind", "SERVICE_ACCOUNT")
}
className={cn(
"rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "SERVICE_ACCOUNT"
? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Service Account
</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -227,6 +227,8 @@ function PeopleListContent({
? "Employee" ? "Employee"
: person?.kind === "CONTRACTOR" : person?.kind === "CONTRACTOR"
? "Contractor" ? "Contractor"
: person?.kind === "SERVICE_ACCOUNT"
? "Service Account"
: "Vendor"} : "Vendor"}
</Badge> </Badge>
<Button <Button

View File

@@ -98,7 +98,7 @@ function PeopleOverviewPageContent({
}); });
const [commit] = useMutation(updatePeopleMutation); const [commit] = useMutation(updatePeopleMutation);
const [, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>( const [, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>(
peopleOverviewPageQuery, peopleOverviewPageQuery
); );
const { toast } = useToast(); const { toast } = useToast();
@@ -200,7 +200,7 @@ function PeopleOverviewPageContent({
onClick={() => { onClick={() => {
const newEmails = const newEmails =
formData.additionalEmailAddresses.filter( formData.additionalEmailAddresses.filter(
(_, i) => i !== index, (_, i) => i !== index
); );
handleFieldChange("additionalEmailAddresses", newEmails); handleFieldChange("additionalEmailAddresses", newEmails);
}} }}
@@ -245,7 +245,7 @@ function PeopleOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors", "rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "EMPLOYEE" formData.kind === "EMPLOYEE"
? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2" ? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200", : "bg-gray-100 text-gray-900 hover:bg-gray-200"
)} )}
> >
Employee Employee
@@ -256,11 +256,24 @@ function PeopleOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors", "rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "CONTRACTOR" formData.kind === "CONTRACTOR"
? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2" ? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200", : "bg-gray-100 text-gray-900 hover:bg-gray-200"
)} )}
> >
Contractor Contractor
</button> </button>
<button
onClick={() =>
handleFieldChange("kind", "SERVICE_ACCOUNT")
}
className={cn(
"rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "SERVICE_ACCOUNT"
? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Service Account
</button>
</div> </div>
</div> </div>
</div> </div>
@@ -305,7 +318,7 @@ function PeopleOverviewPageFallback() {
export default function PeopleOverviewPage() { export default function PeopleOverviewPage() {
const { peopleId } = useParams(); const { peopleId } = useParams();
const [queryRef, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>( const [queryRef, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>(
peopleOverviewPageQuery, peopleOverviewPageQuery
); );
useEffect(() => { useEffect(() => {

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<e7e22eec683ab324fcd1cfe498845353>> * @generated SignedSource<<6c8122e298c594879d1cd54bf297c11b>>
* @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"; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type CreatePeopleInput = { export type CreatePeopleInput = {
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined; additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
fullName: string; fullName: string;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<f4f654235ec0210a616d4e317c3273bc>> * @generated SignedSource<<876cec536b2a9c33f73956901b0b5b1b>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -9,7 +9,7 @@
// @ts-nocheck // @ts-nocheck
import { ReaderFragment } from 'relay-runtime'; import { ReaderFragment } from 'relay-runtime';
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE"; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type PeopleListPage_peoples$data = { export type PeopleListPage_peoples$data = {
readonly id: string; readonly id: string;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<12b9bffcb7d1b32602592f77810dd9cb>> * @generated SignedSource<<4ff94d3e8f2e4c6c0d8c3ad43abee2d6>>
* @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"; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type PeopleOverviewPageQuery$variables = { export type PeopleOverviewPageQuery$variables = {
peopleId: string; peopleId: string;
}; };

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<6ab9b7473f7ac19f7ed988d416de4ccd>> * @generated SignedSource<<4da12585c00c981fc6f2a6f74d5d3ef6>>
* @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"; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
export type UpdatePeopleInput = { export type UpdatePeopleInput = {
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined; additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
expectedVersion: number; expectedVersion: number;

View File

@@ -0,0 +1 @@
ALTER TYPE people_kind ADD VALUE 'SERVICE_ACCOUNT';

View File

@@ -26,6 +26,7 @@ type (
const ( const (
PeopleKindEmployee PeopleKind = iota PeopleKindEmployee PeopleKind = iota
PeopleKindContractor PeopleKindContractor
PeopleKindServiceAccount
) )
func (ps PeopleKind) MarshalText() ([]byte, error) { func (ps PeopleKind) MarshalText() ([]byte, error) {
@@ -40,6 +41,8 @@ func (ps *PeopleKind) UnmarshalText(data []byte) error {
*ps = PeopleKindEmployee *ps = PeopleKindEmployee
case PeopleKindContractor.String(): case PeopleKindContractor.String():
*ps = PeopleKindContractor *ps = PeopleKindContractor
case PeopleKindServiceAccount.String():
*ps = PeopleKindServiceAccount
default: default:
return fmt.Errorf("invalid PeopleKind value: %q", val) return fmt.Errorf("invalid PeopleKind value: %q", val)
} }
@@ -55,6 +58,8 @@ func (ts PeopleKind) String() string {
val = "EMPLOYEE" val = "EMPLOYEE"
case PeopleKindContractor: case PeopleKindContractor:
val = "CONTRACTOR" val = "CONTRACTOR"
case PeopleKindServiceAccount:
val = "SERVICE_ACCOUNT"
} }
return val return val

View File

@@ -69,6 +69,10 @@ enum PeopleKind
@goEnum( @goEnum(
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindContractor" value: "github.com/getprobo/probo/pkg/coredata.PeopleKindContractor"
) )
SERVICE_ACCOUNT
@goEnum(
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindServiceAccount"
)
} }
enum ControlImportance enum ControlImportance

View File

@@ -2151,6 +2151,10 @@ enum PeopleKind
@goEnum( @goEnum(
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindContractor" value: "github.com/getprobo/probo/pkg/coredata.PeopleKindContractor"
) )
SERVICE_ACCOUNT
@goEnum(
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindServiceAccount"
)
} }
enum ControlImportance enum ControlImportance
@@ -19795,10 +19799,12 @@ var (
unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{ unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{
"EMPLOYEE": coredata.PeopleKindEmployee, "EMPLOYEE": coredata.PeopleKindEmployee,
"CONTRACTOR": coredata.PeopleKindContractor, "CONTRACTOR": coredata.PeopleKindContractor,
"SERVICE_ACCOUNT": coredata.PeopleKindServiceAccount,
} }
marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{ marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{
coredata.PeopleKindEmployee: "EMPLOYEE", coredata.PeopleKindEmployee: "EMPLOYEE",
coredata.PeopleKindContractor: "CONTRACTOR", coredata.PeopleKindContractor: "CONTRACTOR",
coredata.PeopleKindServiceAccount: "SERVICE_ACCOUNT",
} }
) )
@@ -20893,10 +20899,12 @@ var (
unmarshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{ unmarshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{
"EMPLOYEE": coredata.PeopleKindEmployee, "EMPLOYEE": coredata.PeopleKindEmployee,
"CONTRACTOR": coredata.PeopleKindContractor, "CONTRACTOR": coredata.PeopleKindContractor,
"SERVICE_ACCOUNT": coredata.PeopleKindServiceAccount,
} }
marshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{ marshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{
coredata.PeopleKindEmployee: "EMPLOYEE", coredata.PeopleKindEmployee: "EMPLOYEE",
coredata.PeopleKindContractor: "CONTRACTOR", coredata.PeopleKindContractor: "CONTRACTOR",
coredata.PeopleKindServiceAccount: "SERVICE_ACCOUNT",
} }
) )