Refactor update payload

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-02-27 14:47:36 +01:00
parent c946e51015
commit 4bb7c116b9
10 changed files with 705 additions and 312 deletions

View File

@@ -39,13 +39,15 @@ const peopleOverviewPageQuery = graphql`
const updatePeopleMutation = graphql`
mutation PeopleOverviewPageUpdatePeopleMutation($input: UpdatePeopleInput!) {
updatePeople(input: $input) {
id
fullName
primaryEmailAddress
additionalEmailAddresses
kind
updatedAt
version
people {
id
fullName
primaryEmailAddress
additionalEmailAddresses
kind
updatedAt
version
}
}
}
`;
@@ -96,7 +98,7 @@ function PeopleOverviewPageContent({
});
const [commit] = useMutation(updatePeopleMutation);
const [, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>(
peopleOverviewPageQuery,
peopleOverviewPageQuery
);
const { toast } = useToast();
@@ -198,7 +200,7 @@ function PeopleOverviewPageContent({
onClick={() => {
const newEmails =
formData.additionalEmailAddresses.filter(
(_, i) => i !== index,
(_, i) => i !== index
);
handleFieldChange("additionalEmailAddresses", newEmails);
}}
@@ -243,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
@@ -254,7 +256,7 @@ 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
@@ -303,7 +305,7 @@ function PeopleOverviewPageFallback() {
export default function PeopleOverviewPage() {
const { peopleId } = useParams();
const [queryRef, loadQuery] = useQueryLoader<PeopleOverviewPageQueryType>(
peopleOverviewPageQuery,
peopleOverviewPageQuery
);
useEffect(() => {

View File

@@ -24,10 +24,12 @@ const updateFrameworkMutation = graphql`
$input: UpdateFrameworkInput!
) {
updateFramework(input: $input) {
id
name
description
version
framework {
id
name
description
version
}
}
}
`;

View File

@@ -44,18 +44,20 @@ const vendorOverviewPageQuery = graphql`
const updateVendorMutation = graphql`
mutation VendorOverviewPageUpdateVendorMutation($input: UpdateVendorInput!) {
updateVendor(input: $input) {
id
name
description
serviceStartAt
serviceTerminationAt
serviceCriticality
riskTier
statusPageUrl
termsOfServiceUrl
privacyPolicyUrl
updatedAt
version
vendor {
id
name
description
serviceStartAt
serviceTerminationAt
serviceCriticality
riskTier
statusPageUrl
termsOfServiceUrl
privacyPolicyUrl
updatedAt
version
}
}
}
`;
@@ -125,7 +127,7 @@ function VendorOverviewPageContent({
});
const [commit] = useMutation(updateVendorMutation);
const [, loadQuery] = useQueryLoader<VendorOverviewPageQueryType>(
vendorOverviewPageQuery,
vendorOverviewPageQuery
);
const { toast } = useToast();
@@ -259,7 +261,7 @@ function VendorOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors",
formData.serviceCriticality === "LOW"
? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Low
@@ -272,7 +274,7 @@ function VendorOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors",
formData.serviceCriticality === "MEDIUM"
? "bg-yellow-100 text-yellow-900 ring-2 ring-yellow-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Medium
@@ -285,7 +287,7 @@ function VendorOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors",
formData.serviceCriticality === "HIGH"
? "bg-red-100 text-red-900 ring-2 ring-red-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
High
@@ -313,7 +315,7 @@ function VendorOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors",
formData.riskTier === "CRITICAL"
? "bg-red-100 text-red-900 ring-2 ring-red-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Critical
@@ -326,7 +328,7 @@ function VendorOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors",
formData.riskTier === "SIGNIFICANT"
? "bg-yellow-100 text-yellow-900 ring-2 ring-yellow-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
Significant
@@ -337,7 +339,7 @@ function VendorOverviewPageContent({
"rounded-full px-4 py-1 text-sm transition-colors",
formData.riskTier === "GENERAL"
? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200",
: "bg-gray-100 text-gray-900 hover:bg-gray-200"
)}
>
General
@@ -418,7 +420,7 @@ function VendorOverviewPageFallback() {
export default function VendorOverviewPage() {
const { vendorId } = useParams();
const [queryRef, loadQuery] = useQueryLoader<VendorOverviewPageQueryType>(
vendorOverviewPageQuery,
vendorOverviewPageQuery
);
useEffect(() => {

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<b950e6a3b56e0545050b3bbe076c2f65>>
* @generated SignedSource<<aa7d9efd2aaaa6af57bfc956754c69dd>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -23,13 +23,15 @@ export type PeopleOverviewPageUpdatePeopleMutation$variables = {
};
export type PeopleOverviewPageUpdatePeopleMutation$data = {
readonly updatePeople: {
readonly additionalEmailAddresses: ReadonlyArray<string>;
readonly fullName: string;
readonly id: string;
readonly kind: PeopleKind;
readonly primaryEmailAddress: string;
readonly updatedAt: any;
readonly version: number;
readonly people: {
readonly additionalEmailAddresses: ReadonlyArray<string>;
readonly fullName: string;
readonly id: string;
readonly kind: PeopleKind;
readonly primaryEmailAddress: string;
readonly updatedAt: any;
readonly version: number;
};
};
};
export type PeopleOverviewPageUpdatePeopleMutation = {
@@ -55,7 +57,7 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "People",
"concreteType": "UpdatePeoplePayload",
"kind": "LinkedField",
"name": "updatePeople",
"plural": false,
@@ -63,50 +65,61 @@ v1 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "additionalEmailAddresses",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "kind",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"concreteType": "People",
"kind": "LinkedField",
"name": "people",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "additionalEmailAddresses",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "kind",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"storageKey": null
}
],
"storageKey": null
}
],
@@ -131,16 +144,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "85b62bd3c79a01fc437649a9c8a217b3",
"cacheID": "6961fac292b72111b2d0a46f078e3efc",
"id": null,
"metadata": {},
"name": "PeopleOverviewPageUpdatePeopleMutation",
"operationKind": "mutation",
"text": "mutation PeopleOverviewPageUpdatePeopleMutation(\n $input: UpdatePeopleInput!\n) {\n updatePeople(input: $input) {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n kind\n updatedAt\n version\n }\n}\n"
"text": "mutation PeopleOverviewPageUpdatePeopleMutation(\n $input: UpdatePeopleInput!\n) {\n updatePeople(input: $input) {\n people {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n kind\n updatedAt\n version\n }\n }\n}\n"
}
};
})();
(node as any).hash = "3fba4023eb9fa1520ed88bb9b4501dc7";
(node as any).hash = "01a8fefe43cdc344f9a4dd62a60edc6c";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<190ec3d14b98c4685fcc363fc41cee96>>
* @generated SignedSource<<822ef9b3867da7de4bca37e5be0e077e>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -20,10 +20,12 @@ export type UpdateFrameworkPageUpdateFrameworkMutation$variables = {
};
export type UpdateFrameworkPageUpdateFrameworkMutation$data = {
readonly updateFramework: {
readonly description: string;
readonly id: string;
readonly name: string;
readonly version: number;
readonly framework: {
readonly description: string;
readonly id: string;
readonly name: string;
readonly version: number;
};
};
};
export type UpdateFrameworkPageUpdateFrameworkMutation = {
@@ -49,7 +51,7 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "Framework",
"concreteType": "UpdateFrameworkPayload",
"kind": "LinkedField",
"name": "updateFramework",
"plural": false,
@@ -57,29 +59,40 @@ v1 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"concreteType": "Framework",
"kind": "LinkedField",
"name": "framework",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"storageKey": null
}
],
"storageKey": null
}
],
@@ -104,16 +117,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "f0f708c6034a6f3c27fbad0193535e51",
"cacheID": "d85d38851d3d94709a5b6c4090678ea4",
"id": null,
"metadata": {},
"name": "UpdateFrameworkPageUpdateFrameworkMutation",
"operationKind": "mutation",
"text": "mutation UpdateFrameworkPageUpdateFrameworkMutation(\n $input: UpdateFrameworkInput!\n) {\n updateFramework(input: $input) {\n id\n name\n description\n version\n }\n}\n"
"text": "mutation UpdateFrameworkPageUpdateFrameworkMutation(\n $input: UpdateFrameworkInput!\n) {\n updateFramework(input: $input) {\n framework {\n id\n name\n description\n version\n }\n }\n}\n"
}
};
})();
(node as any).hash = "b8a8cebfad0ef454a5d5436b61cc595c";
(node as any).hash = "c363b35a095da9142d61907ca7ba3c62";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<0c1d84470c9beda41d05161fad1608f2>>
* @generated SignedSource<<6453606aec7f5a8548c5cc76e9d775f0>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -29,18 +29,20 @@ export type VendorOverviewPageUpdateVendorMutation$variables = {
};
export type VendorOverviewPageUpdateVendorMutation$data = {
readonly updateVendor: {
readonly description: string;
readonly id: string;
readonly name: string;
readonly privacyPolicyUrl: string | null | undefined;
readonly riskTier: RiskTier;
readonly serviceCriticality: ServiceCriticality;
readonly serviceStartAt: any;
readonly serviceTerminationAt: any | null | undefined;
readonly statusPageUrl: string | null | undefined;
readonly termsOfServiceUrl: string | null | undefined;
readonly updatedAt: any;
readonly version: number;
readonly vendor: {
readonly description: string;
readonly id: string;
readonly name: string;
readonly privacyPolicyUrl: string | null | undefined;
readonly riskTier: RiskTier;
readonly serviceCriticality: ServiceCriticality;
readonly serviceStartAt: any;
readonly serviceTerminationAt: any | null | undefined;
readonly statusPageUrl: string | null | undefined;
readonly termsOfServiceUrl: string | null | undefined;
readonly updatedAt: any;
readonly version: number;
};
};
};
export type VendorOverviewPageUpdateVendorMutation = {
@@ -66,7 +68,7 @@ v1 = [
"variableName": "input"
}
],
"concreteType": "Vendor",
"concreteType": "UpdateVendorPayload",
"kind": "LinkedField",
"name": "updateVendor",
"plural": false,
@@ -74,85 +76,96 @@ v1 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "serviceStartAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "serviceTerminationAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "serviceCriticality",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "riskTier",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "statusPageUrl",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "termsOfServiceUrl",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "privacyPolicyUrl",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"concreteType": "Vendor",
"kind": "LinkedField",
"name": "vendor",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "serviceStartAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "serviceTerminationAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "serviceCriticality",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "riskTier",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "statusPageUrl",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "termsOfServiceUrl",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "privacyPolicyUrl",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"storageKey": null
}
],
"storageKey": null
}
],
@@ -177,16 +190,16 @@ return {
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "d0dd4f7b7219b20cc57a57e25b2b1197",
"cacheID": "30449b25e96907e852ae1638ab425111",
"id": null,
"metadata": {},
"name": "VendorOverviewPageUpdateVendorMutation",
"operationKind": "mutation",
"text": "mutation VendorOverviewPageUpdateVendorMutation(\n $input: UpdateVendorInput!\n) {\n updateVendor(input: $input) {\n id\n name\n description\n serviceStartAt\n serviceTerminationAt\n serviceCriticality\n riskTier\n statusPageUrl\n termsOfServiceUrl\n privacyPolicyUrl\n updatedAt\n version\n }\n}\n"
"text": "mutation VendorOverviewPageUpdateVendorMutation(\n $input: UpdateVendorInput!\n) {\n updateVendor(input: $input) {\n vendor {\n id\n name\n description\n serviceStartAt\n serviceTerminationAt\n serviceCriticality\n riskTier\n statusPageUrl\n termsOfServiceUrl\n privacyPolicyUrl\n updatedAt\n version\n }\n }\n}\n"
}
};
})();
(node as any).hash = "be093542424cdd4a329ec389312d0f83";
(node as any).hash = "e07426684611544b6f4c8d1668a19794";
export default node;