Add service account people kind
Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
@@ -75,7 +75,7 @@ function CreatePeoplePageContent() {
|
||||
fullName: "",
|
||||
primaryEmailAddress: "",
|
||||
additionalEmailAddresses: [] as string[],
|
||||
kind: "EMPLOYEE" as "EMPLOYEE" | "CONTRACTOR",
|
||||
kind: "EMPLOYEE" as "EMPLOYEE" | "CONTRACTOR" | "SERVICE_ACCOUNT",
|
||||
});
|
||||
|
||||
const handleFieldChange = (field: keyof typeof formData, value: unknown) => {
|
||||
@@ -255,6 +255,20 @@ function CreatePeoplePageContent() {
|
||||
>
|
||||
Contractor
|
||||
</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>
|
||||
|
||||
@@ -227,6 +227,8 @@ function PeopleListContent({
|
||||
? "Employee"
|
||||
: person?.kind === "CONTRACTOR"
|
||||
? "Contractor"
|
||||
: person?.kind === "SERVICE_ACCOUNT"
|
||||
? "Service Account"
|
||||
: "Vendor"}
|
||||
</Badge>
|
||||
<Button
|
||||
|
||||
@@ -98,7 +98,7 @@ function PeopleOverviewPageContent({
|
||||
});
|
||||
const [commit] = useMutation(updatePeopleMutation);
|
||||
const [, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>(
|
||||
peopleOverviewPageQuery,
|
||||
peopleOverviewPageQuery
|
||||
);
|
||||
const { toast } = useToast();
|
||||
|
||||
@@ -200,7 +200,7 @@ function PeopleOverviewPageContent({
|
||||
onClick={() => {
|
||||
const newEmails =
|
||||
formData.additionalEmailAddresses.filter(
|
||||
(_, i) => i !== index,
|
||||
(_, i) => i !== index
|
||||
);
|
||||
handleFieldChange("additionalEmailAddresses", newEmails);
|
||||
}}
|
||||
@@ -245,7 +245,7 @@ function PeopleOverviewPageContent({
|
||||
"rounded-full px-4 py-1 text-sm transition-colors",
|
||||
formData.kind === "EMPLOYEE"
|
||||
? "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
|
||||
@@ -256,11 +256,24 @@ function PeopleOverviewPageContent({
|
||||
"rounded-full px-4 py-1 text-sm transition-colors",
|
||||
formData.kind === "CONTRACTOR"
|
||||
? "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
|
||||
</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>
|
||||
@@ -305,7 +318,7 @@ function PeopleOverviewPageFallback() {
|
||||
export default function PeopleOverviewPage() {
|
||||
const { peopleId } = useParams();
|
||||
const [queryRef, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>(
|
||||
peopleOverviewPageQuery,
|
||||
peopleOverviewPageQuery
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<e7e22eec683ab324fcd1cfe498845353>>
|
||||
* @generated SignedSource<<6c8122e298c594879d1cd54bf297c11b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -9,7 +9,7 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE";
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
|
||||
export type CreatePeopleInput = {
|
||||
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
|
||||
fullName: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<f4f654235ec0210a616d4e317c3273bc>>
|
||||
* @generated SignedSource<<876cec536b2a9c33f73956901b0b5b1b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -9,7 +9,7 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE";
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type PeopleListPage_peoples$data = {
|
||||
readonly id: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<12b9bffcb7d1b32602592f77810dd9cb>>
|
||||
* @generated SignedSource<<4ff94d3e8f2e4c6c0d8c3ad43abee2d6>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -9,7 +9,7 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE";
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
|
||||
export type PeopleOverviewPageQuery$variables = {
|
||||
peopleId: string;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<6ab9b7473f7ac19f7ed988d416de4ccd>>
|
||||
* @generated SignedSource<<4da12585c00c981fc6f2a6f74d5d3ef6>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -9,7 +9,7 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE";
|
||||
export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT";
|
||||
export type UpdatePeopleInput = {
|
||||
additionalEmailAddresses?: ReadonlyArray<string> | null | undefined;
|
||||
expectedVersion: number;
|
||||
|
||||
1
pkg/coredata/migrations/20250316T183600Z.sql
Normal file
1
pkg/coredata/migrations/20250316T183600Z.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TYPE people_kind ADD VALUE 'SERVICE_ACCOUNT';
|
||||
@@ -26,6 +26,7 @@ type (
|
||||
const (
|
||||
PeopleKindEmployee PeopleKind = iota
|
||||
PeopleKindContractor
|
||||
PeopleKindServiceAccount
|
||||
)
|
||||
|
||||
func (ps PeopleKind) MarshalText() ([]byte, error) {
|
||||
@@ -40,6 +41,8 @@ func (ps *PeopleKind) UnmarshalText(data []byte) error {
|
||||
*ps = PeopleKindEmployee
|
||||
case PeopleKindContractor.String():
|
||||
*ps = PeopleKindContractor
|
||||
case PeopleKindServiceAccount.String():
|
||||
*ps = PeopleKindServiceAccount
|
||||
default:
|
||||
return fmt.Errorf("invalid PeopleKind value: %q", val)
|
||||
}
|
||||
@@ -55,6 +58,8 @@ func (ts PeopleKind) String() string {
|
||||
val = "EMPLOYEE"
|
||||
case PeopleKindContractor:
|
||||
val = "CONTRACTOR"
|
||||
case PeopleKindServiceAccount:
|
||||
val = "SERVICE_ACCOUNT"
|
||||
}
|
||||
|
||||
return val
|
||||
|
||||
@@ -69,6 +69,10 @@ enum PeopleKind
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindContractor"
|
||||
)
|
||||
SERVICE_ACCOUNT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindServiceAccount"
|
||||
)
|
||||
}
|
||||
|
||||
enum ControlImportance
|
||||
|
||||
@@ -2151,6 +2151,10 @@ enum PeopleKind
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindContractor"
|
||||
)
|
||||
SERVICE_ACCOUNT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.PeopleKindServiceAccount"
|
||||
)
|
||||
}
|
||||
|
||||
enum ControlImportance
|
||||
@@ -19793,12 +19797,14 @@ func (ec *executionContext) marshalNPeopleKind2githubᚗcomᚋgetproboᚋprobo
|
||||
|
||||
var (
|
||||
unmarshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{
|
||||
"EMPLOYEE": coredata.PeopleKindEmployee,
|
||||
"CONTRACTOR": coredata.PeopleKindContractor,
|
||||
"EMPLOYEE": coredata.PeopleKindEmployee,
|
||||
"CONTRACTOR": coredata.PeopleKindContractor,
|
||||
"SERVICE_ACCOUNT": coredata.PeopleKindServiceAccount,
|
||||
}
|
||||
marshalNPeopleKind2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{
|
||||
coredata.PeopleKindEmployee: "EMPLOYEE",
|
||||
coredata.PeopleKindContractor: "CONTRACTOR",
|
||||
coredata.PeopleKindEmployee: "EMPLOYEE",
|
||||
coredata.PeopleKindContractor: "CONTRACTOR",
|
||||
coredata.PeopleKindServiceAccount: "SERVICE_ACCOUNT",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -20891,12 +20897,14 @@ func (ec *executionContext) marshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋprob
|
||||
|
||||
var (
|
||||
unmarshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[string]coredata.PeopleKind{
|
||||
"EMPLOYEE": coredata.PeopleKindEmployee,
|
||||
"CONTRACTOR": coredata.PeopleKindContractor,
|
||||
"EMPLOYEE": coredata.PeopleKindEmployee,
|
||||
"CONTRACTOR": coredata.PeopleKindContractor,
|
||||
"SERVICE_ACCOUNT": coredata.PeopleKindServiceAccount,
|
||||
}
|
||||
marshalOPeopleKind2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐPeopleKind = map[coredata.PeopleKind]string{
|
||||
coredata.PeopleKindEmployee: "EMPLOYEE",
|
||||
coredata.PeopleKindContractor: "CONTRACTOR",
|
||||
coredata.PeopleKindEmployee: "EMPLOYEE",
|
||||
coredata.PeopleKindContractor: "CONTRACTOR",
|
||||
coredata.PeopleKindServiceAccount: "SERVICE_ACCOUNT",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user