Add continual improvement registries
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -0,0 +1,233 @@
|
||||
import { graphql } from "relay-runtime";
|
||||
import { useMutation } from "react-relay";
|
||||
import { useConfirm } from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { promisifyMutation, sprintf } from "@probo/helpers";
|
||||
import { useMutationWithToasts } from "../useMutationWithToasts";
|
||||
|
||||
export const ContinualImprovementRegistriesConnectionKey = "ContinualImprovementRegistriesPage_continualImprovementRegistries";
|
||||
|
||||
export const continualImprovementRegistriesQuery = graphql`
|
||||
query ContinualImprovementRegistryGraphListQuery($organizationId: ID!) {
|
||||
node(id: $organizationId) {
|
||||
... on Organization {
|
||||
...ContinualImprovementRegistriesPageFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const continualImprovementRegistryNodeQuery = graphql`
|
||||
query ContinualImprovementRegistryGraphNodeQuery($continualImprovementRegistryId: ID!) {
|
||||
node(id: $continualImprovementRegistryId) {
|
||||
... on ContinualImprovementRegistry {
|
||||
id
|
||||
referenceId
|
||||
description
|
||||
source
|
||||
targetDate
|
||||
status
|
||||
priority
|
||||
audit {
|
||||
id
|
||||
name
|
||||
framework {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
organization {
|
||||
id
|
||||
name
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const createContinualImprovementRegistryMutation = graphql`
|
||||
mutation ContinualImprovementRegistryGraphCreateMutation(
|
||||
$input: CreateContinualImprovementRegistryInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
createContinualImprovementRegistry(input: $input) {
|
||||
continualImprovementRegistryEdge @prependEdge(connections: $connections) {
|
||||
node {
|
||||
id
|
||||
referenceId
|
||||
description
|
||||
source
|
||||
targetDate
|
||||
status
|
||||
priority
|
||||
audit {
|
||||
id
|
||||
name
|
||||
framework {
|
||||
name
|
||||
}
|
||||
}
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const updateContinualImprovementRegistryMutation = graphql`
|
||||
mutation ContinualImprovementRegistryGraphUpdateMutation($input: UpdateContinualImprovementRegistryInput!) {
|
||||
updateContinualImprovementRegistry(input: $input) {
|
||||
continualImprovementRegistry {
|
||||
id
|
||||
referenceId
|
||||
description
|
||||
source
|
||||
targetDate
|
||||
status
|
||||
priority
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
audit {
|
||||
id
|
||||
name
|
||||
framework {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const deleteContinualImprovementRegistryMutation = graphql`
|
||||
mutation ContinualImprovementRegistryGraphDeleteMutation(
|
||||
$input: DeleteContinualImprovementRegistryInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
deleteContinualImprovementRegistry(input: $input) {
|
||||
deletedContinualImprovementRegistryId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const useDeleteContinualImprovementRegistry = (
|
||||
registry: { id: string; referenceId: string },
|
||||
connectionId: string
|
||||
) => {
|
||||
const { __ } = useTranslate();
|
||||
const [mutate] = useMutationWithToasts(deleteContinualImprovementRegistryMutation, {
|
||||
successMessage: __("Continual improvement registry entry deleted successfully"),
|
||||
errorMessage: __("Failed to delete continual improvement registry entry"),
|
||||
});
|
||||
const confirm = useConfirm();
|
||||
|
||||
return () => {
|
||||
confirm(
|
||||
() =>
|
||||
mutate({
|
||||
variables: {
|
||||
input: {
|
||||
continualImprovementRegistryId: registry.id,
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the continual improvement registry entry %s. This action cannot be undone."
|
||||
),
|
||||
registry.referenceId
|
||||
),
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export const useCreateContinualImprovementRegistry = (connectionId: string) => {
|
||||
const [mutate] = useMutation(createContinualImprovementRegistryMutation);
|
||||
const { __ } = useTranslate();
|
||||
|
||||
return (input: {
|
||||
organizationId: string;
|
||||
referenceId: string;
|
||||
description?: string;
|
||||
source?: string;
|
||||
auditId: string;
|
||||
ownerId: string;
|
||||
targetDate?: string;
|
||||
status: string;
|
||||
priority: string;
|
||||
}) => {
|
||||
if (!input.organizationId) {
|
||||
return alert(__("Failed to create continual improvement registry entry: organization is required"));
|
||||
}
|
||||
if (!input.referenceId) {
|
||||
return alert(__("Failed to create continual improvement registry entry: reference ID is required"));
|
||||
}
|
||||
if (!input.auditId) {
|
||||
return alert(__("Failed to create continual improvement registry entry: audit is required"));
|
||||
}
|
||||
if (!input.ownerId) {
|
||||
return alert(__("Failed to create continual improvement registry entry: owner is required"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
variables: {
|
||||
input: {
|
||||
organizationId: input.organizationId,
|
||||
referenceId: input.referenceId,
|
||||
description: input.description,
|
||||
source: input.source,
|
||||
auditId: input.auditId,
|
||||
ownerId: input.ownerId,
|
||||
targetDate: input.targetDate,
|
||||
status: input.status || "OPEN",
|
||||
priority: input.priority || "MEDIUM",
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const useUpdateContinualImprovementRegistry = () => {
|
||||
const [mutate] = useMutation(updateContinualImprovementRegistryMutation);
|
||||
const { __ } = useTranslate();
|
||||
|
||||
return (input: {
|
||||
id: string;
|
||||
referenceId?: string;
|
||||
description?: string;
|
||||
source?: string;
|
||||
auditId?: string;
|
||||
ownerId?: string;
|
||||
targetDate?: string;
|
||||
status?: string;
|
||||
priority?: string;
|
||||
}) => {
|
||||
if (!input.id) {
|
||||
return alert(__("Failed to update continual improvement registry entry: registry ID is required"));
|
||||
}
|
||||
|
||||
return promisifyMutation(mutate)({
|
||||
variables: {
|
||||
input,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
350
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphCreateMutation.graphql.ts
generated
Normal file
350
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphCreateMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,350 @@
|
||||
/**
|
||||
* @generated SignedSource<<b4f30f53809f3ed05e6830c0afade59b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type ContinualImprovementRegistriesPriority = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type ContinualImprovementRegistriesStatus = "CLOSED" | "IN_PROGRESS" | "OPEN";
|
||||
export type CreateContinualImprovementRegistryInput = {
|
||||
auditId: string;
|
||||
description?: string | null | undefined;
|
||||
organizationId: string;
|
||||
ownerId: string;
|
||||
priority: ContinualImprovementRegistriesPriority;
|
||||
referenceId: string;
|
||||
source?: string | null | undefined;
|
||||
status: ContinualImprovementRegistriesStatus;
|
||||
targetDate?: any | null | undefined;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphCreateMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: CreateContinualImprovementRegistryInput;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphCreateMutation$data = {
|
||||
readonly createContinualImprovementRegistry: {
|
||||
readonly continualImprovementRegistryEdge: {
|
||||
readonly node: {
|
||||
readonly audit: {
|
||||
readonly framework: {
|
||||
readonly name: string;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly name: string | null | undefined;
|
||||
};
|
||||
readonly createdAt: any;
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly priority: ContinualImprovementRegistriesPriority;
|
||||
readonly referenceId: string;
|
||||
readonly source: string | null | undefined;
|
||||
readonly status: ContinualImprovementRegistriesStatus;
|
||||
readonly targetDate: any | null | undefined;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphCreateMutation = {
|
||||
response: ContinualImprovementRegistryGraphCreateMutation$data;
|
||||
variables: ContinualImprovementRegistryGraphCreateMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "connections"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
v8 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
v9 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistryGraphCreateMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "CreateContinualImprovementRegistryPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "createContinualImprovementRegistry",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "continualImprovementRegistryEdge",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v10/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v10/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v1/*: any*/),
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistryGraphCreateMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "CreateContinualImprovementRegistryPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "createContinualImprovementRegistry",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "continualImprovementRegistryEdge",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v10/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v10/*: any*/),
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"filters": null,
|
||||
"handle": "prependEdge",
|
||||
"key": "",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "continualImprovementRegistryEdge",
|
||||
"handleArgs": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "connections",
|
||||
"variableName": "connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "a3ddc3c5ac1f55ef2db276ae41ae213b",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistryGraphCreateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation ContinualImprovementRegistryGraphCreateMutation(\n $input: CreateContinualImprovementRegistryInput!\n) {\n createContinualImprovementRegistry(input: $input) {\n continualImprovementRegistryEdge {\n node {\n id\n referenceId\n description\n source\n targetDate\n status\n priority\n audit {\n id\n name\n framework {\n name\n id\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "5d9e0771c839c6c220dabdb00267a7ee";
|
||||
|
||||
export default node;
|
||||
132
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphDeleteMutation.graphql.ts
generated
Normal file
132
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphDeleteMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* @generated SignedSource<<55e8b0de5cb20c0a479bb4862aab4677>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type DeleteContinualImprovementRegistryInput = {
|
||||
continualImprovementRegistryId: string;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphDeleteMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: DeleteContinualImprovementRegistryInput;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphDeleteMutation$data = {
|
||||
readonly deleteContinualImprovementRegistry: {
|
||||
readonly deletedContinualImprovementRegistryId: string;
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphDeleteMutation = {
|
||||
response: ContinualImprovementRegistryGraphDeleteMutation$data;
|
||||
variables: ContinualImprovementRegistryGraphDeleteMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "connections"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "deletedContinualImprovementRegistryId",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistryGraphDeleteMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "DeleteContinualImprovementRegistryPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "deleteContinualImprovementRegistry",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v1/*: any*/),
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistryGraphDeleteMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "DeleteContinualImprovementRegistryPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "deleteContinualImprovementRegistry",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"filters": null,
|
||||
"handle": "deleteEdge",
|
||||
"key": "",
|
||||
"kind": "ScalarHandle",
|
||||
"name": "deletedContinualImprovementRegistryId",
|
||||
"handleArgs": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "connections",
|
||||
"variableName": "connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "1f973509e72c6a1a729e98a8b4240b25",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistryGraphDeleteMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation ContinualImprovementRegistryGraphDeleteMutation(\n $input: DeleteContinualImprovementRegistryInput!\n) {\n deleteContinualImprovementRegistry(input: $input) {\n deletedContinualImprovementRegistryId\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "7c7512a398e2391d5f7f083395cc6395";
|
||||
|
||||
export default node;
|
||||
340
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphListQuery.graphql.ts
generated
Normal file
340
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphListQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,340 @@
|
||||
/**
|
||||
* @generated SignedSource<<7d5f12e454c99687263a264f59618ebe>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type ContinualImprovementRegistryGraphListQuery$variables = {
|
||||
organizationId: string;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphListQuery$data = {
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"ContinualImprovementRegistriesPageFragment">;
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphListQuery = {
|
||||
response: ContinualImprovementRegistryGraphListQuery$data;
|
||||
variables: ContinualImprovementRegistryGraphListQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 10
|
||||
}
|
||||
],
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistryGraphListQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "ContinualImprovementRegistriesPageFragment"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistryGraphListQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"concreteType": "ContinualImprovementRegistryConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "continualImprovementRegistries",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "totalCount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v5/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": "continualImprovementRegistries(first:10)"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"filters": null,
|
||||
"handle": "connection",
|
||||
"key": "ContinualImprovementRegistriesPage_continualImprovementRegistries",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "continualImprovementRegistries"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "875ae8e8faf73c6c1672d6c033e8dcf0",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistryGraphListQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query ContinualImprovementRegistryGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...ContinualImprovementRegistriesPageFragment\n }\n id\n }\n}\n\nfragment ContinualImprovementRegistriesPageFragment on Organization {\n id\n continualImprovementRegistries(first: 10) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n source\n targetDate\n status\n priority\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "1098fc11629892073fbe6d7561b229e3";
|
||||
|
||||
export default node;
|
||||
291
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphNodeQuery.graphql.ts
generated
Normal file
291
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphNodeQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* @generated SignedSource<<6ac0e2eaa895ed1c2409e524e0333ab6>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type ContinualImprovementRegistriesPriority = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type ContinualImprovementRegistriesStatus = "CLOSED" | "IN_PROGRESS" | "OPEN";
|
||||
export type ContinualImprovementRegistryGraphNodeQuery$variables = {
|
||||
continualImprovementRegistryId: string;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphNodeQuery$data = {
|
||||
readonly node: {
|
||||
readonly audit?: {
|
||||
readonly framework: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly name: string | null | undefined;
|
||||
};
|
||||
readonly createdAt?: any;
|
||||
readonly description?: string | null | undefined;
|
||||
readonly id?: string;
|
||||
readonly organization?: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
readonly owner?: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly priority?: ContinualImprovementRegistriesPriority;
|
||||
readonly referenceId?: string;
|
||||
readonly source?: string | null | undefined;
|
||||
readonly status?: ContinualImprovementRegistriesStatus;
|
||||
readonly targetDate?: any | null | undefined;
|
||||
readonly updatedAt?: any;
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphNodeQuery = {
|
||||
response: ContinualImprovementRegistryGraphNodeQuery$data;
|
||||
variables: ContinualImprovementRegistryGraphNodeQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "continualImprovementRegistryId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "continualImprovementRegistryId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
v8 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
v9 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = [
|
||||
(v2/*: any*/),
|
||||
(v9/*: any*/)
|
||||
],
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": (v10/*: any*/),
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v13 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Organization",
|
||||
"kind": "LinkedField",
|
||||
"name": "organization",
|
||||
"plural": false,
|
||||
"selections": (v10/*: any*/),
|
||||
"storageKey": null
|
||||
},
|
||||
v14 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
v15 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistryGraphNodeQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/),
|
||||
(v13/*: any*/),
|
||||
(v14/*: any*/),
|
||||
(v15/*: any*/)
|
||||
],
|
||||
"type": "ContinualImprovementRegistry",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistryGraphNodeQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/),
|
||||
(v13/*: any*/),
|
||||
(v14/*: any*/),
|
||||
(v15/*: any*/)
|
||||
],
|
||||
"type": "ContinualImprovementRegistry",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "c3195d70369df1a1ca2a73fdfef37039",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistryGraphNodeQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query ContinualImprovementRegistryGraphNodeQuery(\n $continualImprovementRegistryId: ID!\n) {\n node(id: $continualImprovementRegistryId) {\n __typename\n ... on ContinualImprovementRegistry {\n id\n referenceId\n description\n source\n targetDate\n status\n priority\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "fe3c3ff44245eb13ea465ae5809ef5bd";
|
||||
|
||||
export default node;
|
||||
236
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphUpdateMutation.graphql.ts
generated
Normal file
236
apps/console/src/hooks/graph/__generated__/ContinualImprovementRegistryGraphUpdateMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
* @generated SignedSource<<befa49d6faa4e4c918a2ff8a85c7fe7d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type ContinualImprovementRegistriesPriority = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type ContinualImprovementRegistriesStatus = "CLOSED" | "IN_PROGRESS" | "OPEN";
|
||||
export type UpdateContinualImprovementRegistryInput = {
|
||||
auditId?: string | null | undefined;
|
||||
description?: string | null | undefined;
|
||||
id: string;
|
||||
ownerId?: string | null | undefined;
|
||||
priority?: ContinualImprovementRegistriesPriority | null | undefined;
|
||||
referenceId?: string | null | undefined;
|
||||
source?: string | null | undefined;
|
||||
status?: ContinualImprovementRegistriesStatus | null | undefined;
|
||||
targetDate?: any | null | undefined;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphUpdateMutation$variables = {
|
||||
input: UpdateContinualImprovementRegistryInput;
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphUpdateMutation$data = {
|
||||
readonly updateContinualImprovementRegistry: {
|
||||
readonly continualImprovementRegistry: {
|
||||
readonly audit: {
|
||||
readonly framework: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly name: string | null | undefined;
|
||||
};
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly priority: ContinualImprovementRegistriesPriority;
|
||||
readonly referenceId: string;
|
||||
readonly source: string | null | undefined;
|
||||
readonly status: ContinualImprovementRegistriesStatus;
|
||||
readonly targetDate: any | null | undefined;
|
||||
readonly updatedAt: any;
|
||||
};
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistryGraphUpdateMutation = {
|
||||
response: ContinualImprovementRegistryGraphUpdateMutation$data;
|
||||
variables: ContinualImprovementRegistryGraphUpdateMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
}
|
||||
],
|
||||
v1 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
"concreteType": "UpdateContinualImprovementRegistryPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "updateContinualImprovementRegistry",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "continualImprovementRegistry",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistryGraphUpdateMutation",
|
||||
"selections": (v3/*: any*/),
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistryGraphUpdateMutation",
|
||||
"selections": (v3/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "b3b3931c06838e6e60f33738be340d6c",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistryGraphUpdateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation ContinualImprovementRegistryGraphUpdateMutation(\n $input: UpdateContinualImprovementRegistryInput!\n) {\n updateContinualImprovementRegistry(input: $input) {\n continualImprovementRegistry {\n id\n referenceId\n description\n source\n targetDate\n status\n priority\n owner {\n id\n fullName\n }\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n updatedAt\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "e59f20342fd5532b1815034334cd5560";
|
||||
|
||||
export default node;
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
IconListStack,
|
||||
IconBox,
|
||||
IconShield,
|
||||
IconRotateCw,
|
||||
Layout,
|
||||
SidebarItem,
|
||||
UserDropdown as UserDropdownRoot,
|
||||
@@ -144,12 +145,17 @@ export function MainLayout() {
|
||||
<SidebarItem
|
||||
label={__("Nonconformity Registries")}
|
||||
icon={IconCrossLargeX}
|
||||
to={`${prefix}/nonconformityRegistries`}
|
||||
to={`${prefix}/nonconformity-registries`}
|
||||
/>
|
||||
<SidebarItem
|
||||
label={__("Compliance Registries")}
|
||||
icon={IconBook}
|
||||
to={`${prefix}/complianceRegistries`}
|
||||
to={`${prefix}/compliance-registries`}
|
||||
/>
|
||||
<SidebarItem
|
||||
label={__("Continual Improvement Registries")}
|
||||
icon={IconRotateCw}
|
||||
to={`${prefix}/continual-improvement-registries`}
|
||||
/>
|
||||
<SidebarItem
|
||||
label={__("Snapshots")}
|
||||
|
||||
@@ -221,7 +221,7 @@ function RegistryRow({
|
||||
};
|
||||
|
||||
return (
|
||||
<Tr to={`/organizations/${organizationId}/complianceRegistries/${registry.id}`}>
|
||||
<Tr to={`/organizations/${organizationId}/compliance-registries/${registry.id}`}>
|
||||
<Td>
|
||||
<span className="font-mono text-sm">{registry.referenceId}</span>
|
||||
</Td>
|
||||
@@ -233,11 +233,11 @@ function RegistryRow({
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
{registry.audit?.name
|
||||
? `${registry.audit.framework.name} - ${registry.audit.name}`
|
||||
: registry.audit?.framework.name || "-"
|
||||
}
|
||||
</Td>
|
||||
{registry.audit.name
|
||||
? `${registry.audit.framework.name} - ${registry.audit.name}`
|
||||
: registry.audit.framework.name
|
||||
}
|
||||
</Td>
|
||||
<Td>{registry.owner?.fullName || "-"}</Td>
|
||||
<Td>
|
||||
{registry.dueDate ? (
|
||||
|
||||
@@ -133,7 +133,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
|
||||
<div>
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{ label: __("Compliance Registries"), to: "../complianceRegistries" },
|
||||
{ label: __("Compliance Registries"), to: "../compliance-registries" },
|
||||
{ label: registry.referenceId! },
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
import {
|
||||
Button,
|
||||
IconPlusLarge,
|
||||
PageHeader,
|
||||
Card,
|
||||
Thead,
|
||||
Tbody,
|
||||
Tr,
|
||||
Th,
|
||||
Td,
|
||||
Badge,
|
||||
ActionDropdown,
|
||||
DropdownItem,
|
||||
IconTrashCan,
|
||||
Table,
|
||||
useConfirm,
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { usePageTitle } from "@probo/hooks";
|
||||
import {
|
||||
ConnectionHandler,
|
||||
graphql,
|
||||
usePaginationFragment,
|
||||
usePreloadedQuery,
|
||||
useMutation,
|
||||
type PreloadedQuery,
|
||||
} from "react-relay";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
import { CreateContinualImprovementRegistryDialog } from "./dialogs/CreateContinualImprovementRegistryDialog";
|
||||
import { deleteContinualImprovementRegistryMutation, ContinualImprovementRegistriesConnectionKey } from "../../../hooks/graph/ContinualImprovementRegistryGraph";
|
||||
import { sprintf, promisifyMutation, getStatusVariant, getStatusLabel } from "@probo/helpers";
|
||||
import type { NodeOf } from "/types";
|
||||
import type { ContinualImprovementRegistriesPageQuery } from "./__generated__/ContinualImprovementRegistriesPageQuery.graphql";
|
||||
import type {
|
||||
ContinualImprovementRegistriesPageFragment$key,
|
||||
ContinualImprovementRegistriesPageFragment$data,
|
||||
} from "./__generated__/ContinualImprovementRegistriesPageFragment.graphql";
|
||||
|
||||
interface ContinualImprovementRegistriesPageProps {
|
||||
queryRef: PreloadedQuery<ContinualImprovementRegistriesPageQuery>;
|
||||
}
|
||||
|
||||
const continualImprovementRegistriesPageFragment = graphql`
|
||||
fragment ContinualImprovementRegistriesPageFragment on Organization
|
||||
@refetchable(queryName: "ContinualImprovementRegistriesPageRefetchQuery")
|
||||
@argumentDefinitions(
|
||||
first: { type: "Int", defaultValue: 10 }
|
||||
after: { type: "CursorKey" }
|
||||
) {
|
||||
id
|
||||
continualImprovementRegistries(first: $first, after: $after)
|
||||
@connection(key: "ContinualImprovementRegistriesPage_continualImprovementRegistries") {
|
||||
__id
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
referenceId
|
||||
description
|
||||
source
|
||||
targetDate
|
||||
status
|
||||
priority
|
||||
audit {
|
||||
id
|
||||
name
|
||||
framework {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export default function ContinualImprovementRegistriesPage({ queryRef }: ContinualImprovementRegistriesPageProps) {
|
||||
const { __ } = useTranslate();
|
||||
const organizationId = useOrganizationId();
|
||||
|
||||
usePageTitle(__("Continual Improvement Registries"));
|
||||
|
||||
const organization = usePreloadedQuery(
|
||||
graphql`
|
||||
query ContinualImprovementRegistriesPageQuery($organizationId: ID!) {
|
||||
node(id: $organizationId) {
|
||||
... on Organization {
|
||||
...ContinualImprovementRegistriesPageFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
queryRef
|
||||
);
|
||||
|
||||
const {
|
||||
data,
|
||||
loadNext,
|
||||
hasNext,
|
||||
isLoadingNext,
|
||||
} = usePaginationFragment<
|
||||
ContinualImprovementRegistriesPageQuery,
|
||||
ContinualImprovementRegistriesPageFragment$key
|
||||
>(continualImprovementRegistriesPageFragment, organization.node);
|
||||
if (!data) {
|
||||
return <div>{__("Organization not found")}</div>;
|
||||
}
|
||||
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
ContinualImprovementRegistriesConnectionKey
|
||||
);
|
||||
const registries = data?.continualImprovementRegistries?.edges?.map((edge) => edge.node) ?? [];
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<PageHeader title={__("Continual Improvement Registries")} description={__("Manage your continual improvement registry entries")}>
|
||||
<CreateContinualImprovementRegistryDialog
|
||||
organizationId={organizationId}
|
||||
connectionId={connectionId}
|
||||
>
|
||||
<Button icon={IconPlusLarge}>
|
||||
{__("Add continual improvement registry")}
|
||||
</Button>
|
||||
</CreateContinualImprovementRegistryDialog>
|
||||
</PageHeader>
|
||||
|
||||
{registries.length > 0 ? (
|
||||
<Card>
|
||||
<Table>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>{__("Reference ID")}</Th>
|
||||
<Th>{__("Description")}</Th>
|
||||
<Th>{__("Status")}</Th>
|
||||
<Th>{__("Priority")}</Th>
|
||||
<Th>{__("Audit")}</Th>
|
||||
<Th>{__("Owner")}</Th>
|
||||
<Th>{__("Target Date")}</Th>
|
||||
<Th>{__("Actions")}</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{registries.map((registry) => (
|
||||
<RegistryRow
|
||||
key={registry.id}
|
||||
registry={registry}
|
||||
connectionId={connectionId}
|
||||
/>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
|
||||
{hasNext && (
|
||||
<div className="p-4 border-t">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => loadNext(10)}
|
||||
disabled={isLoadingNext}
|
||||
>
|
||||
{isLoadingNext ? __("Loading...") : __("Load more")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
) : (
|
||||
<Card padded>
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-semibold mb-2">
|
||||
{__("No continual improvement registry entries yet")}
|
||||
</h3>
|
||||
<p className="text-txt-tertiary mb-4">
|
||||
{__("Create your first continual improvement registry entry to get started.")}
|
||||
</p>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function RegistryRow({
|
||||
registry,
|
||||
connectionId,
|
||||
}: {
|
||||
registry: NodeOf<NonNullable<ContinualImprovementRegistriesPageFragment$data['continualImprovementRegistries']>>;
|
||||
connectionId: string;
|
||||
}) {
|
||||
const organizationId = useOrganizationId();
|
||||
const { __ } = useTranslate();
|
||||
const [deleteRegistry] = useMutation(deleteContinualImprovementRegistryMutation);
|
||||
const confirm = useConfirm();
|
||||
|
||||
const formatDate = (dateString: string) => {
|
||||
return new Date(dateString).toLocaleDateString();
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
confirm(
|
||||
() =>
|
||||
promisifyMutation(deleteRegistry)({
|
||||
variables: {
|
||||
input: {
|
||||
continualImprovementRegistryId: registry.id,
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the continual improvement registry entry %s. This action cannot be undone."
|
||||
),
|
||||
registry.referenceId
|
||||
),
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Tr to={`/organizations/${organizationId}/continual-improvement-registries/${registry.id}`}>
|
||||
<Td>
|
||||
<span className="font-mono text-sm">{registry.referenceId}</span>
|
||||
</Td>
|
||||
<Td>{registry.description || "-"}</Td>
|
||||
<Td>
|
||||
<Badge variant={getStatusVariant(registry.status)}>
|
||||
{getStatusLabel(registry.status)}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
<Badge variant={registry.priority === "HIGH" ? "danger" : registry.priority === "MEDIUM" ? "warning" : "success"}>
|
||||
{registry.priority === "HIGH" ? __("High") : registry.priority === "MEDIUM" ? __("Medium") : __("Low")}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
{registry.audit.name
|
||||
? `${registry.audit.framework.name} - ${registry.audit.name}`
|
||||
: registry.audit.framework.name
|
||||
}
|
||||
</Td>
|
||||
<Td>{registry.owner?.fullName || "-"}</Td>
|
||||
<Td>
|
||||
{registry.targetDate ? (
|
||||
<time dateTime={registry.targetDate}>
|
||||
{formatDate(registry.targetDate)}
|
||||
</time>
|
||||
) : (
|
||||
<span className="text-txt-tertiary">{__("No target date")}</span>
|
||||
)}
|
||||
</Td>
|
||||
<Td noLink width={50} className="text-end">
|
||||
<ActionDropdown>
|
||||
<DropdownItem
|
||||
icon={IconTrashCan}
|
||||
variant="danger"
|
||||
onSelect={handleDelete}
|
||||
>
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
</ActionDropdown>
|
||||
</Td>
|
||||
</Tr>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
import {
|
||||
ConnectionHandler,
|
||||
usePreloadedQuery,
|
||||
type PreloadedQuery,
|
||||
} from "react-relay";
|
||||
import {
|
||||
continualImprovementRegistryNodeQuery,
|
||||
useDeleteContinualImprovementRegistry,
|
||||
useUpdateContinualImprovementRegistry,
|
||||
ContinualImprovementRegistriesConnectionKey,
|
||||
} from "../../../hooks/graph/ContinualImprovementRegistryGraph";
|
||||
import {
|
||||
ActionDropdown,
|
||||
Badge,
|
||||
Breadcrumb,
|
||||
Button,
|
||||
DropdownItem,
|
||||
Field,
|
||||
Option,
|
||||
Input,
|
||||
Card,
|
||||
Textarea,
|
||||
useToast,
|
||||
Select,
|
||||
Label,
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
import { PeopleSelectField } from "/components/form/PeopleSelectField";
|
||||
import { AuditSelectField } from "/components/form/AuditSelectField";
|
||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||
import { Controller } from "react-hook-form";
|
||||
import z from "zod";
|
||||
import { getStatusVariant, getStatusLabel, formatDatetime } from "@probo/helpers";
|
||||
import type { ContinualImprovementRegistryGraphNodeQuery } from "/hooks/graph/__generated__/ContinualImprovementRegistryGraphNodeQuery.graphql";
|
||||
|
||||
const updateRegistrySchema = z.object({
|
||||
referenceId: z.string().min(1, "Reference ID is required"),
|
||||
description: z.string().optional(),
|
||||
source: z.string().optional(),
|
||||
targetDate: z.string().optional(),
|
||||
status: z.enum(["OPEN", "IN_PROGRESS", "CLOSED"]),
|
||||
priority: z.enum(["LOW", "MEDIUM", "HIGH"]),
|
||||
ownerId: z.string().min(1, "Owner is required"),
|
||||
auditId: z.string().min(1, "Audit is required"),
|
||||
});
|
||||
|
||||
type Props = {
|
||||
queryRef: PreloadedQuery<ContinualImprovementRegistryGraphNodeQuery>;
|
||||
};
|
||||
|
||||
export default function ContinualImprovementRegistryDetailsPage(props: Props) {
|
||||
const data = usePreloadedQuery<ContinualImprovementRegistryGraphNodeQuery>(continualImprovementRegistryNodeQuery, props.queryRef);
|
||||
const registry = data.node;
|
||||
const { __ } = useTranslate();
|
||||
const { toast } = useToast();
|
||||
const organizationId = useOrganizationId();
|
||||
|
||||
if (!registry) {
|
||||
return <div>{__("Continual improvement registry entry not found")}</div>;
|
||||
}
|
||||
|
||||
const updateRegistry = useUpdateContinualImprovementRegistry();
|
||||
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
ContinualImprovementRegistriesConnectionKey
|
||||
);
|
||||
|
||||
const deleteRegistry = useDeleteContinualImprovementRegistry({ id: registry.id!, referenceId: registry.referenceId! }, connectionId);
|
||||
|
||||
const { register, handleSubmit, formState, control } = useFormWithSchema(
|
||||
updateRegistrySchema,
|
||||
{
|
||||
defaultValues: {
|
||||
referenceId: registry.referenceId || "",
|
||||
description: registry.description || "",
|
||||
source: registry.source || "",
|
||||
targetDate: registry.targetDate
|
||||
? new Date(registry.targetDate).toISOString().split("T")[0]
|
||||
: "",
|
||||
status: registry.status || "OPEN",
|
||||
priority: registry.priority || "MEDIUM",
|
||||
ownerId: registry.owner?.id || "",
|
||||
auditId: registry.audit?.id || "",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const onSubmit = handleSubmit(async (formData) => {
|
||||
try {
|
||||
await updateRegistry({
|
||||
id: registry.id!,
|
||||
referenceId: formData.referenceId,
|
||||
description: formData.description || undefined,
|
||||
source: formData.source || undefined,
|
||||
targetDate: formatDatetime(formData.targetDate),
|
||||
status: formData.status,
|
||||
priority: formData.priority,
|
||||
ownerId: formData.ownerId,
|
||||
auditId: formData.auditId,
|
||||
});
|
||||
|
||||
toast({
|
||||
title: __("Success"),
|
||||
description: __("Continual improvement registry entry updated successfully"),
|
||||
variant: "success",
|
||||
});
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: __("Failed to update continual improvement registry entry"),
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const statusOptions = [
|
||||
{ value: "OPEN", label: __("Open") },
|
||||
{ value: "IN_PROGRESS", label: __("In Progress") },
|
||||
{ value: "CLOSED", label: __("Closed") },
|
||||
];
|
||||
|
||||
const priorityOptions = [
|
||||
{ value: "LOW", label: __("Low") },
|
||||
{ value: "MEDIUM", label: __("Medium") },
|
||||
{ value: "HIGH", label: __("High") },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{ label: __("Continual Improvement Registries"), to: "../continual-improvement-registries" },
|
||||
{ label: registry.referenceId! },
|
||||
]}
|
||||
/>
|
||||
<ActionDropdown>
|
||||
<DropdownItem onClick={deleteRegistry} variant="danger">
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
</ActionDropdown>
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
<div className="p-6">
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<h1 className="text-2xl font-bold">{registry.referenceId}</h1>
|
||||
<Badge variant={getStatusVariant(registry.status || "OPEN")}>
|
||||
{getStatusLabel(registry.status || "OPEN")}
|
||||
</Badge>
|
||||
<Badge variant={registry.priority === "HIGH" ? "danger" : registry.priority === "MEDIUM" ? "warning" : "success"}>
|
||||
{registry.priority === "HIGH" ? __("High") : registry.priority === "MEDIUM" ? __("Medium") : __("Low")}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={onSubmit} className="space-y-4">
|
||||
<Field
|
||||
label={__("Reference ID")}
|
||||
{...register("referenceId")}
|
||||
error={formState.errors.referenceId?.message}
|
||||
required
|
||||
/>
|
||||
|
||||
<AuditSelectField
|
||||
organizationId={organizationId}
|
||||
control={control}
|
||||
name="auditId"
|
||||
label={__("Audit")}
|
||||
error={formState.errors.auditId?.message}
|
||||
required
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Label>{__("Description")}</Label>
|
||||
<Textarea
|
||||
{...register("description")}
|
||||
placeholder={__("Enter description")}
|
||||
rows={3}
|
||||
/>
|
||||
{formState.errors.description?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.description.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Field
|
||||
label={__("Source")}
|
||||
{...register("source")}
|
||||
error={formState.errors.source?.message}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Label>{__("Target Date")}</Label>
|
||||
<Input
|
||||
type="date"
|
||||
{...register("targetDate")}
|
||||
/>
|
||||
{formState.errors.targetDate?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.targetDate.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PeopleSelectField
|
||||
organizationId={organizationId}
|
||||
control={control}
|
||||
name="ownerId"
|
||||
label={__("Owner")}
|
||||
error={formState.errors.ownerId?.message}
|
||||
required
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Controller
|
||||
control={control}
|
||||
name="status"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("Status")} *</Label>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{statusOptions.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.status?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.status.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name="priority"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("Priority")} *</Label>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{priorityOptions.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.priority?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.priority.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end pt-4">
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={formState.isSubmitting}
|
||||
>
|
||||
{formState.isSubmitting ? __("Saving...") : __("Save Changes")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
/**
|
||||
* @generated SignedSource<<9fd7671cda5fa074c27aebb356782846>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type ContinualImprovementRegistriesPriority = "HIGH" | "LOW" | "MEDIUM";
|
||||
export type ContinualImprovementRegistriesStatus = "CLOSED" | "IN_PROGRESS" | "OPEN";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type ContinualImprovementRegistriesPageFragment$data = {
|
||||
readonly continualImprovementRegistries: {
|
||||
readonly __id: string;
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly audit: {
|
||||
readonly framework: {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly name: string | null | undefined;
|
||||
};
|
||||
readonly createdAt: any;
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly priority: ContinualImprovementRegistriesPriority;
|
||||
readonly referenceId: string;
|
||||
readonly source: string | null | undefined;
|
||||
readonly status: ContinualImprovementRegistriesStatus;
|
||||
readonly targetDate: any | null | undefined;
|
||||
readonly updatedAt: any;
|
||||
};
|
||||
}>;
|
||||
readonly pageInfo: {
|
||||
readonly endCursor: any | null | undefined;
|
||||
readonly hasNextPage: boolean;
|
||||
};
|
||||
readonly totalCount: number;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly " $fragmentType": "ContinualImprovementRegistriesPageFragment";
|
||||
};
|
||||
export type ContinualImprovementRegistriesPageFragment$key = {
|
||||
readonly " $data"?: ContinualImprovementRegistriesPageFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"ContinualImprovementRegistriesPageFragment">;
|
||||
};
|
||||
|
||||
import ContinualImprovementRegistriesPageRefetchQuery_graphql from './ContinualImprovementRegistriesPageRefetchQuery.graphql';
|
||||
|
||||
const node: ReaderFragment = (function(){
|
||||
var v0 = [
|
||||
"continualImprovementRegistries"
|
||||
],
|
||||
v1 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"argumentDefinitions": [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "after"
|
||||
},
|
||||
{
|
||||
"defaultValue": 10,
|
||||
"kind": "LocalArgument",
|
||||
"name": "first"
|
||||
}
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": {
|
||||
"connection": [
|
||||
{
|
||||
"count": "first",
|
||||
"cursor": "after",
|
||||
"direction": "forward",
|
||||
"path": (v0/*: any*/)
|
||||
}
|
||||
],
|
||||
"refetch": {
|
||||
"connection": {
|
||||
"forward": {
|
||||
"count": "first",
|
||||
"cursor": "after"
|
||||
},
|
||||
"backward": null,
|
||||
"path": (v0/*: any*/)
|
||||
},
|
||||
"fragmentPathInResult": [
|
||||
"node"
|
||||
],
|
||||
"operation": ContinualImprovementRegistriesPageRefetchQuery_graphql,
|
||||
"identifierInfo": {
|
||||
"identifierField": "id",
|
||||
"identifierQueryVariableName": "id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "ContinualImprovementRegistriesPageFragment",
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": "continualImprovementRegistries",
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__ContinualImprovementRegistriesPage_continualImprovementRegistries_connection",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "totalCount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "838609d0047346d2031f045e5227c9f0";
|
||||
|
||||
export default node;
|
||||
@@ -0,0 +1,340 @@
|
||||
/**
|
||||
* @generated SignedSource<<a226745b4849f8d82a412528166f860f>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type ContinualImprovementRegistriesPageQuery$variables = {
|
||||
organizationId: string;
|
||||
};
|
||||
export type ContinualImprovementRegistriesPageQuery$data = {
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"ContinualImprovementRegistriesPageFragment">;
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistriesPageQuery = {
|
||||
response: ContinualImprovementRegistriesPageQuery$data;
|
||||
variables: ContinualImprovementRegistriesPageQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 10
|
||||
}
|
||||
],
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistriesPageQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "ContinualImprovementRegistriesPageFragment"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistriesPageQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"concreteType": "ContinualImprovementRegistryConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "continualImprovementRegistries",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "totalCount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v5/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": "continualImprovementRegistries(first:10)"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"filters": null,
|
||||
"handle": "connection",
|
||||
"key": "ContinualImprovementRegistriesPage_continualImprovementRegistries",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "continualImprovementRegistries"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "734faf62cb9f84c554159d0cc35a9eda",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistriesPageQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query ContinualImprovementRegistriesPageQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...ContinualImprovementRegistriesPageFragment\n }\n id\n }\n}\n\nfragment ContinualImprovementRegistriesPageFragment on Organization {\n id\n continualImprovementRegistries(first: 10) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n source\n targetDate\n status\n priority\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "fcece87ab1695d20b6b5f31379e67f1d";
|
||||
|
||||
export default node;
|
||||
@@ -0,0 +1,350 @@
|
||||
/**
|
||||
* @generated SignedSource<<4ae1cc52a5065a1ee1c8edf344307b6c>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type ContinualImprovementRegistriesPageRefetchQuery$variables = {
|
||||
after?: any | null | undefined;
|
||||
first?: number | null | undefined;
|
||||
id: string;
|
||||
};
|
||||
export type ContinualImprovementRegistriesPageRefetchQuery$data = {
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"ContinualImprovementRegistriesPageFragment">;
|
||||
};
|
||||
};
|
||||
export type ContinualImprovementRegistriesPageRefetchQuery = {
|
||||
response: ContinualImprovementRegistriesPageRefetchQuery$data;
|
||||
variables: ContinualImprovementRegistriesPageRefetchQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "after"
|
||||
},
|
||||
{
|
||||
"defaultValue": 10,
|
||||
"kind": "LocalArgument",
|
||||
"name": "first"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "id"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "id"
|
||||
}
|
||||
],
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "after",
|
||||
"variableName": "after"
|
||||
},
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "first",
|
||||
"variableName": "first"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "ContinualImprovementRegistriesPageRefetchQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"args": (v2/*: any*/),
|
||||
"kind": "FragmentSpread",
|
||||
"name": "ContinualImprovementRegistriesPageFragment"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "ContinualImprovementRegistriesPageRefetchQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "ContinualImprovementRegistryConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "continualImprovementRegistries",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "totalCount",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistryEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ContinualImprovementRegistry",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "referenceId",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "source",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "targetDate",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "priority",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Audit",
|
||||
"kind": "LinkedField",
|
||||
"name": "audit",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "owner",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"filters": null,
|
||||
"handle": "connection",
|
||||
"key": "ContinualImprovementRegistriesPage_continualImprovementRegistries",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "continualImprovementRegistries"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "2b886a4652dbea93012ef2306451ea4e",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ContinualImprovementRegistriesPageRefetchQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query ContinualImprovementRegistriesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...ContinualImprovementRegistriesPageFragment_2HEEH6\n id\n }\n}\n\nfragment ContinualImprovementRegistriesPageFragment_2HEEH6 on Organization {\n id\n continualImprovementRegistries(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n source\n targetDate\n status\n priority\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "838609d0047346d2031f045e5227c9f0";
|
||||
|
||||
export default node;
|
||||
@@ -0,0 +1,248 @@
|
||||
import { type ReactNode } from "react";
|
||||
import {
|
||||
Button,
|
||||
Field,
|
||||
useToast,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
useDialogRef,
|
||||
Textarea,
|
||||
Breadcrumb,
|
||||
Label,
|
||||
Select,
|
||||
Option,
|
||||
Input,
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { z } from "zod";
|
||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||
import { useCreateContinualImprovementRegistry } from "../../../../hooks/graph/ContinualImprovementRegistryGraph";
|
||||
import { PeopleSelectField } from "/components/form/PeopleSelectField";
|
||||
import { AuditSelectField } from "/components/form/AuditSelectField";
|
||||
import { Controller } from "react-hook-form";
|
||||
import { formatDatetime } from "@probo/helpers";
|
||||
|
||||
const schema = z.object({
|
||||
referenceId: z.string().min(1, "Reference ID is required"),
|
||||
description: z.string().optional(),
|
||||
source: z.string().optional(),
|
||||
auditId: z.string().min(1, "Audit is required"),
|
||||
ownerId: z.string().min(1, "Owner is required"),
|
||||
targetDate: z.string().optional(),
|
||||
status: z.enum(["OPEN", "IN_PROGRESS", "CLOSED"]),
|
||||
priority: z.enum(["LOW", "MEDIUM", "HIGH"]),
|
||||
});
|
||||
|
||||
type FormData = z.infer<typeof schema>;
|
||||
|
||||
interface CreateContinualImprovementRegistryDialogProps {
|
||||
children: ReactNode;
|
||||
organizationId: string;
|
||||
connectionId?: string;
|
||||
}
|
||||
|
||||
export function CreateContinualImprovementRegistryDialog({
|
||||
children,
|
||||
organizationId,
|
||||
connectionId,
|
||||
}: CreateContinualImprovementRegistryDialogProps) {
|
||||
const { __ } = useTranslate();
|
||||
const { toast } = useToast();
|
||||
const dialogRef = useDialogRef();
|
||||
|
||||
const createRegistry = useCreateContinualImprovementRegistry(connectionId || "");
|
||||
|
||||
const { register, handleSubmit, formState, reset, control } = useFormWithSchema(schema, {
|
||||
defaultValues: {
|
||||
referenceId: "",
|
||||
description: "",
|
||||
source: "",
|
||||
auditId: "",
|
||||
ownerId: "",
|
||||
targetDate: "",
|
||||
status: "OPEN" as const,
|
||||
priority: "MEDIUM" as const,
|
||||
},
|
||||
});
|
||||
|
||||
const onSubmit = handleSubmit(async (formData: FormData) => {
|
||||
try {
|
||||
await createRegistry({
|
||||
organizationId,
|
||||
referenceId: formData.referenceId,
|
||||
description: formData.description || undefined,
|
||||
source: formData.source || undefined,
|
||||
auditId: formData.auditId,
|
||||
ownerId: formData.ownerId,
|
||||
targetDate: formatDatetime(formData.targetDate),
|
||||
status: formData.status,
|
||||
priority: formData.priority,
|
||||
});
|
||||
|
||||
toast({
|
||||
title: __("Success"),
|
||||
description: __("Continual improvement registry entry created successfully"),
|
||||
variant: "success",
|
||||
});
|
||||
|
||||
reset();
|
||||
dialogRef.current?.close();
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: __("Failed to create continual improvement registry entry"),
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const statusOptions = [
|
||||
{ value: "OPEN", label: __("Open") },
|
||||
{ value: "IN_PROGRESS", label: __("In Progress") },
|
||||
{ value: "CLOSED", label: __("Closed") },
|
||||
];
|
||||
|
||||
const priorityOptions = [
|
||||
{ value: "LOW", label: __("Low") },
|
||||
{ value: "MEDIUM", label: __("Medium") },
|
||||
{ value: "HIGH", label: __("High") },
|
||||
];
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
ref={dialogRef}
|
||||
trigger={children}
|
||||
title={<Breadcrumb items={[__("Registries"), __("Create Continual Improvement Entry")]} />}
|
||||
className="max-w-2xl"
|
||||
>
|
||||
<form onSubmit={onSubmit}>
|
||||
<DialogContent padded className="space-y-4">
|
||||
<Field
|
||||
label={__("Reference ID")}
|
||||
{...register("referenceId")}
|
||||
placeholder="CI-001"
|
||||
error={formState.errors.referenceId?.message}
|
||||
required
|
||||
/>
|
||||
|
||||
<AuditSelectField
|
||||
organizationId={organizationId}
|
||||
control={control}
|
||||
name="auditId"
|
||||
label={__("Audit")}
|
||||
error={formState.errors.auditId?.message}
|
||||
required
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Label>{__("Description")}</Label>
|
||||
<Textarea
|
||||
{...register("description")}
|
||||
placeholder={__("Enter description of the continual improvement item")}
|
||||
rows={3}
|
||||
/>
|
||||
{formState.errors.description?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.description.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Field
|
||||
label={__("Source")}
|
||||
{...register("source")}
|
||||
placeholder={__("Enter source")}
|
||||
error={formState.errors.source?.message}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Label>{__("Target Date")}</Label>
|
||||
<Input
|
||||
type="date"
|
||||
{...register("targetDate")}
|
||||
/>
|
||||
{formState.errors.targetDate?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.targetDate.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PeopleSelectField
|
||||
organizationId={organizationId}
|
||||
control={control}
|
||||
name="ownerId"
|
||||
label={__("Owner")}
|
||||
error={formState.errors.ownerId?.message}
|
||||
required
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Controller
|
||||
control={control}
|
||||
name="status"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("Status")} *</Label>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{statusOptions.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.status?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.status.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name="priority"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("Priority")} *</Label>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{priorityOptions.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.priority?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.priority.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</DialogContent>
|
||||
|
||||
<DialogFooter>
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={formState.isSubmitting}
|
||||
>
|
||||
{formState.isSubmitting ? __("Creating...") : __("Create Entry")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ function RegistryRow({
|
||||
};
|
||||
|
||||
return (
|
||||
<Tr to={`/organizations/${organizationId}/nonconformityRegistries/${registry.id}`}>
|
||||
<Tr to={`/organizations/${organizationId}/nonconformity-registries/${registry.id}`}>
|
||||
<Td>
|
||||
<span className="font-mono text-sm">{registry.referenceId}</span>
|
||||
</Td>
|
||||
|
||||
@@ -125,7 +125,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
||||
items={[
|
||||
{
|
||||
label: __("Nonconformity Registries"),
|
||||
to: `/organizations/${organizationId}/nonconformityRegistries`,
|
||||
to: `/organizations/${organizationId}/nonconformity-registries`,
|
||||
},
|
||||
{
|
||||
label: registry.referenceId || __("Unknown Nonconformity Registry"),
|
||||
|
||||
@@ -32,6 +32,7 @@ import { trustCenterRoutes } from "./routes/trustCenterRoutes.ts";
|
||||
import { nonconformityRegistryRoutes } from "./routes/nonconformityRegistryRoutes.ts";
|
||||
import { complianceRegistryRoutes } from "./routes/complianceRegistryRoutes.ts";
|
||||
import { snapshotsRoutes } from "./routes/snapshotsRoutes.ts";
|
||||
import { continualImprovementRegistryRoutes } from "./routes/continualImprovementRegistryRoutes.ts";
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
|
||||
export type AppRoute = Omit<RouteObject, "Component" | "children"> & {
|
||||
@@ -155,6 +156,7 @@ const routes = [
|
||||
...nonconformityRegistryRoutes,
|
||||
...complianceRegistryRoutes,
|
||||
...snapshotsRoutes,
|
||||
...continualImprovementRegistryRoutes,
|
||||
...trustCenterRoutes,
|
||||
{
|
||||
path: "*",
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { AppRoute } from "/routes";
|
||||
|
||||
export const complianceRegistryRoutes = [
|
||||
{
|
||||
path: "complianceRegistries",
|
||||
path: "compliance-registries",
|
||||
fallback: PageSkeleton,
|
||||
queryLoader: ({ organizationId }: { organizationId: string }) =>
|
||||
loadQuery(relayEnvironment, complianceRegistriesQuery, { organizationId }),
|
||||
@@ -16,7 +16,7 @@ export const complianceRegistryRoutes = [
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "complianceRegistries/:registryId",
|
||||
path: "compliance-registries/:registryId",
|
||||
fallback: PageSkeleton,
|
||||
queryLoader: (params: Record<string, string>) =>
|
||||
loadQuery(relayEnvironment, complianceRegistryNodeQuery, {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { loadQuery } from "react-relay";
|
||||
import { relayEnvironment } from "/providers/RelayProviders";
|
||||
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
import { continualImprovementRegistriesQuery, continualImprovementRegistryNodeQuery } from "/hooks/graph/ContinualImprovementRegistryGraph";
|
||||
import type { AppRoute } from "/routes";
|
||||
|
||||
export const continualImprovementRegistryRoutes = [
|
||||
{
|
||||
path: "continual-improvement-registries",
|
||||
fallback: PageSkeleton,
|
||||
queryLoader: ({ organizationId }: { organizationId: string }) =>
|
||||
loadQuery(relayEnvironment, continualImprovementRegistriesQuery, { organizationId }),
|
||||
Component: lazy(
|
||||
() => import("/pages/organizations/continualImprovementRegistries/ContinualImprovementRegistriesPage")
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "continual-improvement-registries/:registryId",
|
||||
fallback: PageSkeleton,
|
||||
queryLoader: (params: Record<string, string>) =>
|
||||
loadQuery(relayEnvironment, continualImprovementRegistryNodeQuery, {
|
||||
continualImprovementRegistryId: params.registryId
|
||||
}),
|
||||
Component: lazy(
|
||||
() => import("/pages/organizations/continualImprovementRegistries/ContinualImprovementRegistryDetailsPage")
|
||||
),
|
||||
},
|
||||
] satisfies AppRoute[];
|
||||
@@ -7,7 +7,7 @@ import type { AppRoute } from "/routes";
|
||||
|
||||
export const nonconformityRegistryRoutes= [
|
||||
{
|
||||
path: "nonconformityRegistries",
|
||||
path: "nonconformity-registries",
|
||||
fallback: PageSkeleton,
|
||||
queryLoader: ({ organizationId }: { organizationId: string }) =>
|
||||
loadQuery(relayEnvironment, nonconformityRegistriesQuery, { organizationId }),
|
||||
@@ -16,7 +16,7 @@ export const nonconformityRegistryRoutes= [
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "nonconformityRegistries/:registryId",
|
||||
path: "nonconformity-registries/:registryId",
|
||||
fallback: PageSkeleton,
|
||||
queryLoader: (params: Record<string, string>) =>
|
||||
loadQuery(relayEnvironment, nonconformityRegistryNodeQuery, {
|
||||
|
||||
10
packages/ui/src/Atoms/Icons/IconRotateCw.tsx
Normal file
10
packages/ui/src/Atoms/Icons/IconRotateCw.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import type {IconProps} from "./type.ts";
|
||||
|
||||
// Source: Lucide Icons "rotate-cw" - https://lucide.dev/icons/rotate-cw
|
||||
// Licensed under ISC License
|
||||
export function IconRotateCw({size = 24, className}: IconProps) {
|
||||
return <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className} xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/>
|
||||
<path d="M21 3v5h-5"/>
|
||||
</svg>
|
||||
}
|
||||
@@ -78,3 +78,4 @@ export { IconChevronUp } from "./IconChevronUp.tsx";
|
||||
export { IconBlock } from "./IconBlock.tsx";
|
||||
export { IconChevronDown } from "./IconChevronDown.tsx";
|
||||
export { IconPageCross } from "./IconPageCross.tsx";
|
||||
export { IconRotateCw } from "./IconRotateCw.tsx";
|
||||
|
||||
@@ -17,7 +17,7 @@ export function Sidebar({ children }: PropsWithChildren) {
|
||||
<aside
|
||||
className={clsx(
|
||||
"border-r border-border-solid relative pt-16 flex-none",
|
||||
open ? "px-4 w-[270px]" : "px-2",
|
||||
open ? "px-4 w-[330px]" : "px-2",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
324
pkg/coredata/continual_improvement_registries.go
Normal file
324
pkg/coredata/continual_improvement_registries.go
Normal file
@@ -0,0 +1,324 @@
|
||||
// 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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"maps"
|
||||
"time"
|
||||
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/page"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"go.gearno.de/kit/pg"
|
||||
)
|
||||
|
||||
type (
|
||||
ContinualImprovementRegistry struct {
|
||||
ID gid.GID `db:"id"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
ReferenceID string `db:"reference_id"`
|
||||
Description *string `db:"description"`
|
||||
AuditID gid.GID `db:"audit_id"`
|
||||
Source *string `db:"source"`
|
||||
OwnerID gid.GID `db:"owner_id"`
|
||||
TargetDate *time.Time `db:"target_date"`
|
||||
Status ContinualImprovementRegistriesStatus `db:"status"`
|
||||
Priority ContinualImprovementRegistriesPriority `db:"priority"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
ContinualImprovementRegistries []*ContinualImprovementRegistry
|
||||
)
|
||||
|
||||
func (cir *ContinualImprovementRegistry) CursorKey(field ContinualImprovementRegistriesOrderField) page.CursorKey {
|
||||
switch field {
|
||||
case ContinualImprovementRegistriesOrderFieldCreatedAt:
|
||||
return page.NewCursorKey(cir.ID, cir.CreatedAt)
|
||||
case ContinualImprovementRegistriesOrderFieldTargetDate:
|
||||
return page.NewCursorKey(cir.ID, cir.TargetDate)
|
||||
case ContinualImprovementRegistriesOrderFieldStatus:
|
||||
return page.NewCursorKey(cir.ID, cir.Status)
|
||||
case ContinualImprovementRegistriesOrderFieldPriority:
|
||||
return page.NewCursorKey(cir.ID, cir.Priority)
|
||||
case ContinualImprovementRegistriesOrderFieldReferenceId:
|
||||
return page.NewCursorKey(cir.ID, cir.ReferenceID)
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
}
|
||||
|
||||
func (cir *ContinualImprovementRegistry) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
continualImprovementRegistryID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
reference_id,
|
||||
description,
|
||||
audit_id,
|
||||
source,
|
||||
owner_id,
|
||||
target_date,
|
||||
status,
|
||||
priority,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
continual_improvement_registries
|
||||
WHERE
|
||||
%s
|
||||
AND id = @continual_improvement_registry_id
|
||||
LIMIT 1;
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"continual_improvement_registry_id": continualImprovementRegistryID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
rows, err := conn.Query(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot query continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
registry, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[ContinualImprovementRegistry])
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot collect continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
*cir = registry
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cirs *ContinualImprovementRegistries) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
q := `
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM
|
||||
continual_improvement_registries
|
||||
WHERE
|
||||
%s
|
||||
AND organization_id = @organization_id
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
row := conn.QueryRow(ctx, q, args)
|
||||
|
||||
var count int
|
||||
err := row.Scan(&count)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count continual improvement registries: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (cirs *ContinualImprovementRegistries) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[ContinualImprovementRegistriesOrderField],
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
reference_id,
|
||||
description,
|
||||
audit_id,
|
||||
source,
|
||||
owner_id,
|
||||
target_date,
|
||||
status,
|
||||
priority,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
continual_improvement_registries
|
||||
WHERE
|
||||
%s
|
||||
AND organization_id = @organization_id
|
||||
AND %s
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, cursor.SQLArguments())
|
||||
|
||||
rows, err := conn.Query(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot query continual improvement registries: %w", err)
|
||||
}
|
||||
|
||||
registries, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[ContinualImprovementRegistry])
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot collect continual improvement registries: %w", err)
|
||||
}
|
||||
|
||||
*cirs = registries
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cir *ContinualImprovementRegistry) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO continual_improvement_registries (
|
||||
id,
|
||||
tenant_id,
|
||||
organization_id,
|
||||
reference_id,
|
||||
description,
|
||||
audit_id,
|
||||
source,
|
||||
owner_id,
|
||||
target_date,
|
||||
status,
|
||||
priority,
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (
|
||||
@id,
|
||||
@tenant_id,
|
||||
@organization_id,
|
||||
@reference_id,
|
||||
@description,
|
||||
@audit_id,
|
||||
@source,
|
||||
@owner_id,
|
||||
@target_date,
|
||||
@status,
|
||||
@priority,
|
||||
@created_at,
|
||||
@updated_at
|
||||
)
|
||||
`
|
||||
|
||||
args := pgx.StrictNamedArgs{
|
||||
"id": cir.ID,
|
||||
"tenant_id": scope.GetTenantID(),
|
||||
"organization_id": cir.OrganizationID,
|
||||
"reference_id": cir.ReferenceID,
|
||||
"description": cir.Description,
|
||||
"audit_id": cir.AuditID,
|
||||
"source": cir.Source,
|
||||
"owner_id": cir.OwnerID,
|
||||
"target_date": cir.TargetDate,
|
||||
"status": cir.Status,
|
||||
"priority": cir.Priority,
|
||||
"created_at": cir.CreatedAt,
|
||||
"updated_at": cir.UpdatedAt,
|
||||
}
|
||||
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot insert continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cir *ContinualImprovementRegistry) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
UPDATE continual_improvement_registries SET
|
||||
reference_id = @reference_id,
|
||||
description = @description,
|
||||
audit_id = @audit_id,
|
||||
source = @source,
|
||||
owner_id = @owner_id,
|
||||
target_date = @target_date,
|
||||
status = @status,
|
||||
priority = @priority,
|
||||
updated_at = @updated_at
|
||||
WHERE
|
||||
%s
|
||||
AND id = @id
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{
|
||||
"id": cir.ID,
|
||||
"reference_id": cir.ReferenceID,
|
||||
"description": cir.Description,
|
||||
"audit_id": cir.AuditID,
|
||||
"source": cir.Source,
|
||||
"owner_id": cir.OwnerID,
|
||||
"target_date": cir.TargetDate,
|
||||
"status": cir.Status,
|
||||
"priority": cir.Priority,
|
||||
"updated_at": cir.UpdatedAt,
|
||||
}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot update continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cir *ContinualImprovementRegistry) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
DELETE FROM continual_improvement_registries
|
||||
WHERE
|
||||
%s
|
||||
AND id = @id
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"id": cir.ID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot delete continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
55
pkg/coredata/continual_improvement_registries_order_field.go
Normal file
55
pkg/coredata/continual_improvement_registries_order_field.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// 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 (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ContinualImprovementRegistriesOrderField string
|
||||
|
||||
const (
|
||||
ContinualImprovementRegistriesOrderFieldCreatedAt ContinualImprovementRegistriesOrderField = "CREATED_AT"
|
||||
ContinualImprovementRegistriesOrderFieldTargetDate ContinualImprovementRegistriesOrderField = "TARGET_DATE"
|
||||
ContinualImprovementRegistriesOrderFieldStatus ContinualImprovementRegistriesOrderField = "STATUS"
|
||||
ContinualImprovementRegistriesOrderFieldPriority ContinualImprovementRegistriesOrderField = "PRIORITY"
|
||||
ContinualImprovementRegistriesOrderFieldReferenceId ContinualImprovementRegistriesOrderField = "REFERENCE_ID"
|
||||
)
|
||||
|
||||
func (p ContinualImprovementRegistriesOrderField) Column() string {
|
||||
return string(p)
|
||||
}
|
||||
|
||||
func (p ContinualImprovementRegistriesOrderField) String() string {
|
||||
return string(p)
|
||||
}
|
||||
|
||||
func (p ContinualImprovementRegistriesOrderField) MarshalText() ([]byte, error) {
|
||||
return []byte(p.String()), nil
|
||||
}
|
||||
|
||||
func (p *ContinualImprovementRegistriesOrderField) UnmarshalText(text []byte) error {
|
||||
val := string(text)
|
||||
switch val {
|
||||
case string(ContinualImprovementRegistriesOrderFieldCreatedAt),
|
||||
string(ContinualImprovementRegistriesOrderFieldTargetDate),
|
||||
string(ContinualImprovementRegistriesOrderFieldStatus),
|
||||
string(ContinualImprovementRegistriesOrderFieldPriority),
|
||||
string(ContinualImprovementRegistriesOrderFieldReferenceId):
|
||||
*p = ContinualImprovementRegistriesOrderField(val)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("invalid ContinualImprovementRegistriesOrderField value: %q", val)
|
||||
}
|
||||
60
pkg/coredata/continual_improvement_registries_priority.go
Normal file
60
pkg/coredata/continual_improvement_registries_priority.go
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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 ContinualImprovementRegistriesPriority string
|
||||
|
||||
const (
|
||||
ContinualImprovementRegistriesPriorityLow ContinualImprovementRegistriesPriority = "LOW"
|
||||
ContinualImprovementRegistriesPriorityMedium ContinualImprovementRegistriesPriority = "MEDIUM"
|
||||
ContinualImprovementRegistriesPriorityHigh ContinualImprovementRegistriesPriority = "HIGH"
|
||||
)
|
||||
|
||||
func (cirp ContinualImprovementRegistriesPriority) String() string {
|
||||
return string(cirp)
|
||||
}
|
||||
|
||||
func (cirp *ContinualImprovementRegistriesPriority) Scan(value any) error {
|
||||
var s string
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
s = v
|
||||
case []byte:
|
||||
s = string(v)
|
||||
default:
|
||||
return fmt.Errorf("unsupported type for ContinualImprovementRegistriesPriority: %T", value)
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "LOW":
|
||||
*cirp = ContinualImprovementRegistriesPriorityLow
|
||||
case "MEDIUM":
|
||||
*cirp = ContinualImprovementRegistriesPriorityMedium
|
||||
case "HIGH":
|
||||
*cirp = ContinualImprovementRegistriesPriorityHigh
|
||||
default:
|
||||
return fmt.Errorf("invalid ContinualImprovementRegistriesPriority value: %q", s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cirp ContinualImprovementRegistriesPriority) Value() (driver.Value, error) {
|
||||
return cirp.String(), nil
|
||||
}
|
||||
60
pkg/coredata/continual_improvement_registries_status.go
Normal file
60
pkg/coredata/continual_improvement_registries_status.go
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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 ContinualImprovementRegistriesStatus string
|
||||
|
||||
const (
|
||||
ContinualImprovementRegistriesStatusOpen ContinualImprovementRegistriesStatus = "OPEN"
|
||||
ContinualImprovementRegistriesStatusInProgress ContinualImprovementRegistriesStatus = "IN_PROGRESS"
|
||||
ContinualImprovementRegistriesStatusClosed ContinualImprovementRegistriesStatus = "CLOSED"
|
||||
)
|
||||
|
||||
func (cirs ContinualImprovementRegistriesStatus) String() string {
|
||||
return string(cirs)
|
||||
}
|
||||
|
||||
func (cirs *ContinualImprovementRegistriesStatus) Scan(value any) error {
|
||||
var s string
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
s = v
|
||||
case []byte:
|
||||
s = string(v)
|
||||
default:
|
||||
return fmt.Errorf("unsupported type for ContinualImprovementRegistriesStatus: %T", value)
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "OPEN":
|
||||
*cirs = ContinualImprovementRegistriesStatusOpen
|
||||
case "IN_PROGRESS":
|
||||
*cirs = ContinualImprovementRegistriesStatusInProgress
|
||||
case "CLOSED":
|
||||
*cirs = ContinualImprovementRegistriesStatusClosed
|
||||
default:
|
||||
return fmt.Errorf("invalid ContinualImprovementRegistriesStatus value: %q", s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cirs ContinualImprovementRegistriesStatus) Value() (driver.Value, error) {
|
||||
return cirs.String(), nil
|
||||
}
|
||||
@@ -47,4 +47,5 @@ const (
|
||||
ComplianceRegistryEntityType
|
||||
VendorServiceEntityType
|
||||
SnapshotEntityType
|
||||
ContinualImprovementRegistryEntityType
|
||||
)
|
||||
|
||||
45
pkg/coredata/migrations/20250826T121441Z.sql
Normal file
45
pkg/coredata/migrations/20250826T121441Z.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
CREATE TYPE continual_improvement_registries_status AS ENUM (
|
||||
'OPEN',
|
||||
'IN_PROGRESS',
|
||||
'CLOSED'
|
||||
);
|
||||
|
||||
CREATE TYPE continual_improvement_registries_priority AS ENUM (
|
||||
'LOW',
|
||||
'MEDIUM',
|
||||
'HIGH'
|
||||
);
|
||||
|
||||
CREATE TABLE continual_improvement_registries (
|
||||
id TEXT PRIMARY KEY,
|
||||
tenant_id TEXT NOT NULL,
|
||||
organization_id TEXT NOT NULL,
|
||||
reference_id TEXT NOT NULL,
|
||||
description TEXT,
|
||||
audit_id TEXT NOT NULL,
|
||||
source TEXT,
|
||||
owner_id TEXT NOT NULL,
|
||||
target_date DATE,
|
||||
status continual_improvement_registries_status NOT NULL,
|
||||
priority continual_improvement_registries_priority NOT NULL,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
|
||||
CONSTRAINT continual_improvement_registries_organization_id_fkey
|
||||
FOREIGN KEY (organization_id)
|
||||
REFERENCES organizations(id)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE,
|
||||
|
||||
CONSTRAINT continual_improvement_registries_owner_id_fkey
|
||||
FOREIGN KEY (owner_id)
|
||||
REFERENCES peoples(id)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE RESTRICT,
|
||||
|
||||
CONSTRAINT continual_improvement_registries_audit_id_fkey
|
||||
FOREIGN KEY (audit_id)
|
||||
REFERENCES audits(id)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
279
pkg/probo/continual_improvement_registries_service.go
Normal file
279
pkg/probo/continual_improvement_registries_service.go
Normal file
@@ -0,0 +1,279 @@
|
||||
// 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 probo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/getprobo/probo/pkg/coredata"
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/page"
|
||||
"go.gearno.de/kit/pg"
|
||||
)
|
||||
|
||||
type ContinualImprovementRegistriesService struct {
|
||||
svc *TenantService
|
||||
}
|
||||
|
||||
type (
|
||||
CreateContinualImprovementRegistryRequest struct {
|
||||
OrganizationID gid.GID
|
||||
ReferenceID string
|
||||
Description *string
|
||||
AuditID gid.GID
|
||||
Source *string
|
||||
OwnerID gid.GID
|
||||
TargetDate *time.Time
|
||||
Status *coredata.ContinualImprovementRegistriesStatus
|
||||
Priority *coredata.ContinualImprovementRegistriesPriority
|
||||
}
|
||||
|
||||
UpdateContinualImprovementRegistryRequest struct {
|
||||
ID gid.GID
|
||||
ReferenceID *string
|
||||
Description **string
|
||||
AuditID *gid.GID
|
||||
Source **string
|
||||
OwnerID *gid.GID
|
||||
TargetDate **time.Time
|
||||
Status *coredata.ContinualImprovementRegistriesStatus
|
||||
Priority *coredata.ContinualImprovementRegistriesPriority
|
||||
}
|
||||
)
|
||||
|
||||
func (s ContinualImprovementRegistriesService) Get(
|
||||
ctx context.Context,
|
||||
continualImprovementRegistryID gid.GID,
|
||||
) (*coredata.ContinualImprovementRegistry, error) {
|
||||
registry := &coredata.ContinualImprovementRegistry{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := registry.LoadByID(ctx, conn, s.svc.scope, continualImprovementRegistryID); err != nil {
|
||||
return fmt.Errorf("cannot load continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return registry, nil
|
||||
}
|
||||
|
||||
func (s *ContinualImprovementRegistriesService) Create(
|
||||
ctx context.Context,
|
||||
req *CreateContinualImprovementRegistryRequest,
|
||||
) (*coredata.ContinualImprovementRegistry, error) {
|
||||
now := time.Now()
|
||||
|
||||
registry := &coredata.ContinualImprovementRegistry{
|
||||
ID: gid.New(s.svc.scope.GetTenantID(), coredata.ContinualImprovementRegistryEntityType),
|
||||
OrganizationID: req.OrganizationID,
|
||||
ReferenceID: req.ReferenceID,
|
||||
Description: req.Description,
|
||||
AuditID: req.AuditID,
|
||||
Source: req.Source,
|
||||
OwnerID: req.OwnerID,
|
||||
TargetDate: req.TargetDate,
|
||||
Status: *req.Status,
|
||||
Priority: *req.Priority,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
err := s.svc.pg.WithTx(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
organization := &coredata.Organization{}
|
||||
if err := organization.LoadByID(ctx, conn, s.svc.scope, req.OrganizationID); err != nil {
|
||||
return fmt.Errorf("cannot load organization: %w", err)
|
||||
}
|
||||
|
||||
audit := &coredata.Audit{}
|
||||
if err := audit.LoadByID(ctx, conn, s.svc.scope, req.AuditID); err != nil {
|
||||
return fmt.Errorf("cannot load audit: %w", err)
|
||||
}
|
||||
|
||||
owner := &coredata.People{}
|
||||
if err := owner.LoadByID(ctx, conn, s.svc.scope, req.OwnerID); err != nil {
|
||||
return fmt.Errorf("cannot load owner: %w", err)
|
||||
}
|
||||
|
||||
if err := registry.Insert(ctx, conn, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot insert continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return registry, nil
|
||||
}
|
||||
|
||||
func (s *ContinualImprovementRegistriesService) Update(
|
||||
ctx context.Context,
|
||||
req *UpdateContinualImprovementRegistryRequest,
|
||||
) (*coredata.ContinualImprovementRegistry, error) {
|
||||
registry := &coredata.ContinualImprovementRegistry{}
|
||||
|
||||
err := s.svc.pg.WithTx(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := registry.LoadByID(ctx, conn, s.svc.scope, req.ID); err != nil {
|
||||
return fmt.Errorf("cannot load continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
if req.ReferenceID != nil {
|
||||
registry.ReferenceID = *req.ReferenceID
|
||||
}
|
||||
|
||||
if req.Description != nil {
|
||||
registry.Description = *req.Description
|
||||
}
|
||||
|
||||
if req.AuditID != nil {
|
||||
audit := &coredata.Audit{}
|
||||
if err := audit.LoadByID(ctx, conn, s.svc.scope, *req.AuditID); err != nil {
|
||||
return fmt.Errorf("cannot load audit: %w", err)
|
||||
}
|
||||
registry.AuditID = *req.AuditID
|
||||
}
|
||||
|
||||
if req.Source != nil {
|
||||
registry.Source = *req.Source
|
||||
}
|
||||
|
||||
if req.OwnerID != nil {
|
||||
owner := &coredata.People{}
|
||||
if err := owner.LoadByID(ctx, conn, s.svc.scope, *req.OwnerID); err != nil {
|
||||
return fmt.Errorf("cannot load owner: %w", err)
|
||||
}
|
||||
registry.OwnerID = *req.OwnerID
|
||||
}
|
||||
|
||||
if req.TargetDate != nil {
|
||||
registry.TargetDate = *req.TargetDate
|
||||
}
|
||||
|
||||
if req.Status != nil {
|
||||
registry.Status = *req.Status
|
||||
}
|
||||
|
||||
if req.Priority != nil {
|
||||
registry.Priority = *req.Priority
|
||||
}
|
||||
|
||||
registry.UpdatedAt = time.Now()
|
||||
|
||||
if err := registry.Update(ctx, conn, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot update continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return registry, nil
|
||||
}
|
||||
|
||||
func (s *ContinualImprovementRegistriesService) Delete(
|
||||
ctx context.Context,
|
||||
continualImprovementRegistryID gid.GID,
|
||||
) error {
|
||||
err := s.svc.pg.WithTx(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
registry := &coredata.ContinualImprovementRegistry{}
|
||||
if err := registry.LoadByID(ctx, conn, s.svc.scope, continualImprovementRegistryID); err != nil {
|
||||
return fmt.Errorf("cannot load continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
if err := registry.Delete(ctx, conn, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot delete continual improvement registry: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (s ContinualImprovementRegistriesService) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
var count int
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) (err error) {
|
||||
registries := coredata.ContinualImprovementRegistries{}
|
||||
count, err = registries.CountByOrganizationID(ctx, conn, s.svc.scope, organizationID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count continual improvement registries: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s ContinualImprovementRegistriesService) ListForOrganizationID(
|
||||
ctx context.Context,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[coredata.ContinualImprovementRegistriesOrderField],
|
||||
) (*page.Page[*coredata.ContinualImprovementRegistry, coredata.ContinualImprovementRegistriesOrderField], error) {
|
||||
var registries coredata.ContinualImprovementRegistries
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
err := registries.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot load continual improvement registries: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return page.NewPage(registries, cursor), nil
|
||||
}
|
||||
@@ -85,6 +85,7 @@ type (
|
||||
NonconformityRegistries *NonconformityRegistryService
|
||||
ComplianceRegistries *ComplianceRegistryService
|
||||
Snapshots *SnapshotService
|
||||
ContinualImprovementRegistries *ContinualImprovementRegistriesService
|
||||
}
|
||||
)
|
||||
|
||||
@@ -174,12 +175,10 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
||||
tenantService.Audits = &AuditService{svc: tenantService}
|
||||
tenantService.Reports = &ReportService{svc: tenantService}
|
||||
tenantService.TrustCenters = &TrustCenterService{svc: tenantService}
|
||||
tenantService.TrustCenterAccesses = &TrustCenterAccessService{
|
||||
svc: tenantService,
|
||||
usrmgr: s.usrmgr,
|
||||
}
|
||||
tenantService.TrustCenterAccesses = &TrustCenterAccessService{svc: tenantService, usrmgr: s.usrmgr}
|
||||
tenantService.NonconformityRegistries = &NonconformityRegistryService{svc: tenantService}
|
||||
tenantService.ComplianceRegistries = &ComplianceRegistryService{svc: tenantService}
|
||||
tenantService.Snapshots = &SnapshotService{svc: tenantService}
|
||||
tenantService.ContinualImprovementRegistries = &ContinualImprovementRegistriesService{svc: tenantService}
|
||||
return tenantService
|
||||
}
|
||||
|
||||
@@ -183,6 +183,38 @@ enum ComplianceRegistryStatus
|
||||
)
|
||||
}
|
||||
|
||||
enum ContinualImprovementRegistriesStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesStatus") {
|
||||
OPEN
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesStatusOpen"
|
||||
)
|
||||
IN_PROGRESS
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesStatusInProgress"
|
||||
)
|
||||
CLOSED
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesStatusClosed"
|
||||
)
|
||||
}
|
||||
|
||||
enum ContinualImprovementRegistriesPriority
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesPriority") {
|
||||
LOW
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesPriorityLow"
|
||||
)
|
||||
MEDIUM
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesPriorityMedium"
|
||||
)
|
||||
HIGH
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesPriorityHigh"
|
||||
)
|
||||
}
|
||||
|
||||
# Order Field Enums
|
||||
enum UserOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.UserOrderField") {
|
||||
@@ -678,6 +710,30 @@ enum ComplianceRegistryOrderField
|
||||
)
|
||||
}
|
||||
|
||||
enum ContinualImprovementRegistriesOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesOrderField") {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesOrderFieldCreatedAt"
|
||||
)
|
||||
REFERENCE_ID
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesOrderFieldReferenceId"
|
||||
)
|
||||
TARGET_DATE
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesOrderFieldTargetDate"
|
||||
)
|
||||
STATUS
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesOrderFieldStatus"
|
||||
)
|
||||
PRIORITY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.ContinualImprovementRegistriesOrderFieldPriority"
|
||||
)
|
||||
}
|
||||
|
||||
enum TrustCenterAccessOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.TrustCenterAccessOrderField") {
|
||||
CREATED_AT
|
||||
@@ -827,6 +883,14 @@ input ComplianceRegistryOrder
|
||||
field: ComplianceRegistryOrderField!
|
||||
}
|
||||
|
||||
input ContinualImprovementRegistriesOrder
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.ContinualImprovementRegistriesOrderBy"
|
||||
) {
|
||||
direction: OrderDirection!
|
||||
field: ContinualImprovementRegistriesOrderField!
|
||||
}
|
||||
|
||||
input TrustCenterAccessOrder
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.TrustCenterAccessOrderBy"
|
||||
@@ -1079,6 +1143,14 @@ type Organization implements Node {
|
||||
orderBy: ComplianceRegistryOrder
|
||||
): ComplianceRegistryConnection! @goField(forceResolver: true)
|
||||
|
||||
continualImprovementRegistries(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
orderBy: ContinualImprovementRegistriesOrder
|
||||
): ContinualImprovementRegistryConnection! @goField(forceResolver: true)
|
||||
|
||||
snapshots(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
@@ -1539,6 +1611,21 @@ type ComplianceRegistry implements Node {
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type ContinualImprovementRegistry implements Node {
|
||||
id: ID!
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
referenceId: String!
|
||||
description: String
|
||||
audit: Audit! @goField(forceResolver: true)
|
||||
source: String
|
||||
owner: People! @goField(forceResolver: true)
|
||||
targetDate: Datetime
|
||||
status: ContinualImprovementRegistriesStatus!
|
||||
priority: ContinualImprovementRegistriesPriority!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
|
||||
type Snapshot implements Node {
|
||||
id: ID!
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
@@ -1880,6 +1967,20 @@ type ComplianceRegistryEdge {
|
||||
node: ComplianceRegistry!
|
||||
}
|
||||
|
||||
type ContinualImprovementRegistryConnection
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.ContinualImprovementRegistryConnection"
|
||||
) {
|
||||
totalCount: Int! @goField(forceResolver: true)
|
||||
edges: [ContinualImprovementRegistryEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type ContinualImprovementRegistryEdge {
|
||||
cursor: CursorKey!
|
||||
node: ContinualImprovementRegistry!
|
||||
}
|
||||
|
||||
type SnapshotConnection
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.SnapshotConnection"
|
||||
@@ -2151,6 +2252,17 @@ type Mutation {
|
||||
input: DeleteComplianceRegistryInput!
|
||||
): DeleteComplianceRegistryPayload!
|
||||
|
||||
# Continual Improvement Registry mutations
|
||||
createContinualImprovementRegistry(
|
||||
input: CreateContinualImprovementRegistryInput!
|
||||
): CreateContinualImprovementRegistryPayload!
|
||||
updateContinualImprovementRegistry(
|
||||
input: UpdateContinualImprovementRegistryInput!
|
||||
): UpdateContinualImprovementRegistryPayload!
|
||||
deleteContinualImprovementRegistry(
|
||||
input: DeleteContinualImprovementRegistryInput!
|
||||
): DeleteContinualImprovementRegistryPayload!
|
||||
|
||||
# Snapshot mutations
|
||||
createSnapshot(input: CreateSnapshotInput!): CreateSnapshotPayload!
|
||||
deleteSnapshot(input: DeleteSnapshotInput!): DeleteSnapshotPayload!
|
||||
@@ -2719,6 +2831,34 @@ input DeleteComplianceRegistryInput {
|
||||
complianceRegistryId: ID!
|
||||
}
|
||||
|
||||
input CreateContinualImprovementRegistryInput {
|
||||
organizationId: ID!
|
||||
referenceId: String!
|
||||
description: String
|
||||
auditId: ID!
|
||||
source: String
|
||||
ownerId: ID!
|
||||
targetDate: Datetime
|
||||
status: ContinualImprovementRegistriesStatus!
|
||||
priority: ContinualImprovementRegistriesPriority!
|
||||
}
|
||||
|
||||
input UpdateContinualImprovementRegistryInput {
|
||||
id: ID!
|
||||
referenceId: String
|
||||
description: String
|
||||
auditId: ID
|
||||
source: String
|
||||
ownerId: ID
|
||||
targetDate: Datetime
|
||||
status: ContinualImprovementRegistriesStatus
|
||||
priority: ContinualImprovementRegistriesPriority
|
||||
}
|
||||
|
||||
input DeleteContinualImprovementRegistryInput {
|
||||
continualImprovementRegistryId: ID!
|
||||
}
|
||||
|
||||
input CreateSnapshotInput {
|
||||
organizationId: ID!
|
||||
name: String!
|
||||
@@ -3450,6 +3590,18 @@ type DeleteComplianceRegistryPayload {
|
||||
deletedComplianceRegistryId: ID!
|
||||
}
|
||||
|
||||
type CreateContinualImprovementRegistryPayload {
|
||||
continualImprovementRegistryEdge: ContinualImprovementRegistryEdge!
|
||||
}
|
||||
|
||||
type UpdateContinualImprovementRegistryPayload {
|
||||
continualImprovementRegistry: ContinualImprovementRegistry!
|
||||
}
|
||||
|
||||
type DeleteContinualImprovementRegistryPayload {
|
||||
deletedContinualImprovementRegistryId: ID!
|
||||
}
|
||||
|
||||
type CreateSnapshotPayload {
|
||||
snapshotEdge: SnapshotEdge!
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
// 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 types
|
||||
|
||||
import (
|
||||
"github.com/getprobo/probo/pkg/coredata"
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/page"
|
||||
)
|
||||
|
||||
type (
|
||||
ContinualImprovementRegistriesOrderBy OrderBy[coredata.ContinualImprovementRegistriesOrderField]
|
||||
|
||||
ContinualImprovementRegistryConnection struct {
|
||||
TotalCount int
|
||||
Edges []*ContinualImprovementRegistryEdge
|
||||
PageInfo PageInfo
|
||||
|
||||
Resolver any
|
||||
ParentID gid.GID
|
||||
}
|
||||
)
|
||||
|
||||
func NewContinualImprovementRegistryConnection(
|
||||
p *page.Page[*coredata.ContinualImprovementRegistry, coredata.ContinualImprovementRegistriesOrderField],
|
||||
parentType any,
|
||||
parentID gid.GID,
|
||||
) *ContinualImprovementRegistryConnection {
|
||||
edges := make([]*ContinualImprovementRegistryEdge, len(p.Data))
|
||||
for i, registry := range p.Data {
|
||||
edges[i] = NewContinualImprovementRegistryEdge(registry, p.Cursor.OrderBy.Field)
|
||||
}
|
||||
|
||||
return &ContinualImprovementRegistryConnection{
|
||||
Edges: edges,
|
||||
PageInfo: *NewPageInfo(p),
|
||||
|
||||
Resolver: parentType,
|
||||
ParentID: parentID,
|
||||
}
|
||||
}
|
||||
|
||||
func NewContinualImprovementRegistry(cir *coredata.ContinualImprovementRegistry) *ContinualImprovementRegistry {
|
||||
return &ContinualImprovementRegistry{
|
||||
ID: cir.ID,
|
||||
ReferenceID: cir.ReferenceID,
|
||||
Description: cir.Description,
|
||||
Source: cir.Source,
|
||||
TargetDate: cir.TargetDate,
|
||||
Status: cir.Status,
|
||||
Priority: cir.Priority,
|
||||
CreatedAt: cir.CreatedAt,
|
||||
UpdatedAt: cir.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func NewContinualImprovementRegistryEdge(cir *coredata.ContinualImprovementRegistry, orderField coredata.ContinualImprovementRegistriesOrderField) *ContinualImprovementRegistryEdge {
|
||||
return &ContinualImprovementRegistryEdge{
|
||||
Node: NewContinualImprovementRegistry(cir),
|
||||
Cursor: cir.CursorKey(orderField),
|
||||
}
|
||||
}
|
||||
@@ -167,6 +167,29 @@ type ConnectorOrder struct {
|
||||
Direction page.OrderDirection `json:"direction"`
|
||||
}
|
||||
|
||||
type ContinualImprovementRegistry struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Organization *Organization `json:"organization"`
|
||||
ReferenceID string `json:"referenceId"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Audit *Audit `json:"audit"`
|
||||
Source *string `json:"source,omitempty"`
|
||||
Owner *People `json:"owner"`
|
||||
TargetDate *time.Time `json:"targetDate,omitempty"`
|
||||
Status coredata.ContinualImprovementRegistriesStatus `json:"status"`
|
||||
Priority coredata.ContinualImprovementRegistriesPriority `json:"priority"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (ContinualImprovementRegistry) IsNode() {}
|
||||
func (this ContinualImprovementRegistry) GetID() gid.GID { return this.ID }
|
||||
|
||||
type ContinualImprovementRegistryEdge struct {
|
||||
Cursor page.CursorKey `json:"cursor"`
|
||||
Node *ContinualImprovementRegistry `json:"node"`
|
||||
}
|
||||
|
||||
type Control struct {
|
||||
ID gid.GID `json:"id"`
|
||||
SectionTitle string `json:"sectionTitle"`
|
||||
@@ -242,6 +265,22 @@ type CreateComplianceRegistryPayload struct {
|
||||
ComplianceRegistryEdge *ComplianceRegistryEdge `json:"complianceRegistryEdge"`
|
||||
}
|
||||
|
||||
type CreateContinualImprovementRegistryInput struct {
|
||||
OrganizationID gid.GID `json:"organizationId"`
|
||||
ReferenceID string `json:"referenceId"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AuditID gid.GID `json:"auditId"`
|
||||
Source *string `json:"source,omitempty"`
|
||||
OwnerID gid.GID `json:"ownerId"`
|
||||
TargetDate *time.Time `json:"targetDate,omitempty"`
|
||||
Status coredata.ContinualImprovementRegistriesStatus `json:"status"`
|
||||
Priority coredata.ContinualImprovementRegistriesPriority `json:"priority"`
|
||||
}
|
||||
|
||||
type CreateContinualImprovementRegistryPayload struct {
|
||||
ContinualImprovementRegistryEdge *ContinualImprovementRegistryEdge `json:"continualImprovementRegistryEdge"`
|
||||
}
|
||||
|
||||
type CreateControlAuditMappingInput struct {
|
||||
ControlID gid.GID `json:"controlId"`
|
||||
AuditID gid.GID `json:"auditId"`
|
||||
@@ -595,6 +634,14 @@ type DeleteComplianceRegistryPayload struct {
|
||||
DeletedComplianceRegistryID gid.GID `json:"deletedComplianceRegistryId"`
|
||||
}
|
||||
|
||||
type DeleteContinualImprovementRegistryInput struct {
|
||||
ContinualImprovementRegistryID gid.GID `json:"continualImprovementRegistryId"`
|
||||
}
|
||||
|
||||
type DeleteContinualImprovementRegistryPayload struct {
|
||||
DeletedContinualImprovementRegistryID gid.GID `json:"deletedContinualImprovementRegistryId"`
|
||||
}
|
||||
|
||||
type DeleteControlAuditMappingInput struct {
|
||||
ControlID gid.GID `json:"controlId"`
|
||||
AuditID gid.GID `json:"auditId"`
|
||||
@@ -1065,28 +1112,29 @@ type NonconformityRegistryEdge struct {
|
||||
}
|
||||
|
||||
type Organization struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
LogoURL *string `json:"logoUrl,omitempty"`
|
||||
Users *UserConnection `json:"users"`
|
||||
Connectors *ConnectorConnection `json:"connectors"`
|
||||
Frameworks *FrameworkConnection `json:"frameworks"`
|
||||
Controls *ControlConnection `json:"controls"`
|
||||
Vendors *VendorConnection `json:"vendors"`
|
||||
Peoples *PeopleConnection `json:"peoples"`
|
||||
Documents *DocumentConnection `json:"documents"`
|
||||
Measures *MeasureConnection `json:"measures"`
|
||||
Risks *RiskConnection `json:"risks"`
|
||||
Tasks *TaskConnection `json:"tasks"`
|
||||
Assets *AssetConnection `json:"assets"`
|
||||
Data *DatumConnection `json:"data"`
|
||||
Audits *AuditConnection `json:"audits"`
|
||||
NonconformityRegistries *NonconformityRegistryConnection `json:"nonconformityRegistries"`
|
||||
ComplianceRegistries *ComplianceRegistryConnection `json:"complianceRegistries"`
|
||||
Snapshots *SnapshotConnection `json:"snapshots"`
|
||||
TrustCenter *TrustCenter `json:"trustCenter,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
LogoURL *string `json:"logoUrl,omitempty"`
|
||||
Users *UserConnection `json:"users"`
|
||||
Connectors *ConnectorConnection `json:"connectors"`
|
||||
Frameworks *FrameworkConnection `json:"frameworks"`
|
||||
Controls *ControlConnection `json:"controls"`
|
||||
Vendors *VendorConnection `json:"vendors"`
|
||||
Peoples *PeopleConnection `json:"peoples"`
|
||||
Documents *DocumentConnection `json:"documents"`
|
||||
Measures *MeasureConnection `json:"measures"`
|
||||
Risks *RiskConnection `json:"risks"`
|
||||
Tasks *TaskConnection `json:"tasks"`
|
||||
Assets *AssetConnection `json:"assets"`
|
||||
Data *DatumConnection `json:"data"`
|
||||
Audits *AuditConnection `json:"audits"`
|
||||
NonconformityRegistries *NonconformityRegistryConnection `json:"nonconformityRegistries"`
|
||||
ComplianceRegistries *ComplianceRegistryConnection `json:"complianceRegistries"`
|
||||
ContinualImprovementRegistries *ContinualImprovementRegistryConnection `json:"continualImprovementRegistries"`
|
||||
Snapshots *SnapshotConnection `json:"snapshots"`
|
||||
TrustCenter *TrustCenter `json:"trustCenter,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Organization) IsNode() {}
|
||||
@@ -1391,6 +1439,22 @@ type UpdateComplianceRegistryPayload struct {
|
||||
ComplianceRegistry *ComplianceRegistry `json:"complianceRegistry"`
|
||||
}
|
||||
|
||||
type UpdateContinualImprovementRegistryInput struct {
|
||||
ID gid.GID `json:"id"`
|
||||
ReferenceID *string `json:"referenceId,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AuditID *gid.GID `json:"auditId,omitempty"`
|
||||
Source *string `json:"source,omitempty"`
|
||||
OwnerID *gid.GID `json:"ownerId,omitempty"`
|
||||
TargetDate *time.Time `json:"targetDate,omitempty"`
|
||||
Status *coredata.ContinualImprovementRegistriesStatus `json:"status,omitempty"`
|
||||
Priority *coredata.ContinualImprovementRegistriesPriority `json:"priority,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateContinualImprovementRegistryPayload struct {
|
||||
ContinualImprovementRegistry *ContinualImprovementRegistry `json:"continualImprovementRegistry"`
|
||||
}
|
||||
|
||||
type UpdateControlInput struct {
|
||||
ID gid.GID `json:"id"`
|
||||
SectionTitle *string `json:"sectionTitle,omitempty"`
|
||||
|
||||
@@ -287,6 +287,73 @@ func (r *complianceRegistryConnectionResolver) TotalCount(ctx context.Context, o
|
||||
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
|
||||
}
|
||||
|
||||
// Organization is the resolver for the organization field.
|
||||
func (r *continualImprovementRegistryResolver) Organization(ctx context.Context, obj *types.ContinualImprovementRegistry) (*types.Organization, error) {
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
registry, err := prb.ContinualImprovementRegistries.Get(ctx, obj.ID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry: %w", err))
|
||||
}
|
||||
|
||||
organization, err := prb.Organizations.Get(ctx, registry.OrganizationID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry organization: %w", err))
|
||||
}
|
||||
|
||||
return types.NewOrganization(organization), nil
|
||||
}
|
||||
|
||||
// Audit is the resolver for the audit field.
|
||||
func (r *continualImprovementRegistryResolver) Audit(ctx context.Context, obj *types.ContinualImprovementRegistry) (*types.Audit, error) {
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
registry, err := prb.ContinualImprovementRegistries.Get(ctx, obj.ID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry: %w", err))
|
||||
}
|
||||
|
||||
audit, err := prb.Audits.Get(ctx, registry.AuditID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry audit: %w", err))
|
||||
}
|
||||
|
||||
return types.NewAudit(audit), nil
|
||||
}
|
||||
|
||||
// Owner is the resolver for the owner field.
|
||||
func (r *continualImprovementRegistryResolver) Owner(ctx context.Context, obj *types.ContinualImprovementRegistry) (*types.People, error) {
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
registry, err := prb.ContinualImprovementRegistries.Get(ctx, obj.ID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry: %w", err))
|
||||
}
|
||||
|
||||
people, err := prb.Peoples.Get(ctx, registry.OwnerID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry owner: %w", err))
|
||||
}
|
||||
|
||||
return types.NewPeople(people), nil
|
||||
}
|
||||
|
||||
// TotalCount is the resolver for the totalCount field.
|
||||
func (r *continualImprovementRegistryConnectionResolver) TotalCount(ctx context.Context, obj *types.ContinualImprovementRegistryConnection) (int, error) {
|
||||
prb := r.ProboService(ctx, obj.ParentID.TenantID())
|
||||
|
||||
switch obj.Resolver.(type) {
|
||||
case *organizationResolver:
|
||||
count, err := prb.ContinualImprovementRegistries.CountByOrganizationID(ctx, obj.ParentID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot count continual improvement registries: %w", err))
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
|
||||
}
|
||||
|
||||
// Framework is the resolver for the framework field.
|
||||
func (r *controlResolver) Framework(ctx context.Context, obj *types.Control) (*types.Framework, error) {
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
@@ -3051,6 +3118,72 @@ func (r *mutationResolver) DeleteComplianceRegistry(ctx context.Context, input t
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateContinualImprovementRegistry is the resolver for the createContinualImprovementRegistry field.
|
||||
func (r *mutationResolver) CreateContinualImprovementRegistry(ctx context.Context, input types.CreateContinualImprovementRegistryInput) (*types.CreateContinualImprovementRegistryPayload, error) {
|
||||
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
||||
|
||||
req := probo.CreateContinualImprovementRegistryRequest{
|
||||
OrganizationID: input.OrganizationID,
|
||||
ReferenceID: input.ReferenceID,
|
||||
Description: input.Description,
|
||||
AuditID: input.AuditID,
|
||||
Source: input.Source,
|
||||
OwnerID: input.OwnerID,
|
||||
TargetDate: input.TargetDate,
|
||||
Status: &input.Status,
|
||||
Priority: &input.Priority,
|
||||
}
|
||||
|
||||
registry, err := prb.ContinualImprovementRegistries.Create(ctx, &req)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot create continual improvement registry: %w", err))
|
||||
}
|
||||
|
||||
return &types.CreateContinualImprovementRegistryPayload{
|
||||
ContinualImprovementRegistryEdge: types.NewContinualImprovementRegistryEdge(registry, coredata.ContinualImprovementRegistriesOrderFieldCreatedAt),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdateContinualImprovementRegistry is the resolver for the updateContinualImprovementRegistry field.
|
||||
func (r *mutationResolver) UpdateContinualImprovementRegistry(ctx context.Context, input types.UpdateContinualImprovementRegistryInput) (*types.UpdateContinualImprovementRegistryPayload, error) {
|
||||
prb := r.ProboService(ctx, input.ID.TenantID())
|
||||
|
||||
req := probo.UpdateContinualImprovementRegistryRequest{
|
||||
ID: input.ID,
|
||||
ReferenceID: input.ReferenceID,
|
||||
Description: &input.Description,
|
||||
AuditID: input.AuditID,
|
||||
Source: &input.Source,
|
||||
OwnerID: input.OwnerID,
|
||||
TargetDate: &input.TargetDate,
|
||||
Status: input.Status,
|
||||
Priority: input.Priority,
|
||||
}
|
||||
|
||||
registry, err := prb.ContinualImprovementRegistries.Update(ctx, &req)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot update continual improvement registry: %w", err))
|
||||
}
|
||||
|
||||
return &types.UpdateContinualImprovementRegistryPayload{
|
||||
ContinualImprovementRegistry: types.NewContinualImprovementRegistry(registry),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DeleteContinualImprovementRegistry is the resolver for the deleteContinualImprovementRegistry field.
|
||||
func (r *mutationResolver) DeleteContinualImprovementRegistry(ctx context.Context, input types.DeleteContinualImprovementRegistryInput) (*types.DeleteContinualImprovementRegistryPayload, error) {
|
||||
prb := r.ProboService(ctx, input.ContinualImprovementRegistryID.TenantID())
|
||||
|
||||
err := prb.ContinualImprovementRegistries.Delete(ctx, input.ContinualImprovementRegistryID)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot delete continual improvement registry: %w", err))
|
||||
}
|
||||
|
||||
return &types.DeleteContinualImprovementRegistryPayload{
|
||||
DeletedContinualImprovementRegistryID: input.ContinualImprovementRegistryID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateSnapshot is the resolver for the createSnapshot field.
|
||||
func (r *mutationResolver) CreateSnapshot(ctx context.Context, input types.CreateSnapshotInput) (*types.CreateSnapshotPayload, error) {
|
||||
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
||||
@@ -3562,6 +3695,32 @@ func (r *organizationResolver) ComplianceRegistries(ctx context.Context, obj *ty
|
||||
return types.NewComplianceRegistryConnection(page, r, obj.ID), nil
|
||||
}
|
||||
|
||||
// ContinualImprovementRegistries is the resolver for the continualImprovementRegistries field.
|
||||
func (r *organizationResolver) ContinualImprovementRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ContinualImprovementRegistriesOrderBy) (*types.ContinualImprovementRegistryConnection, error) {
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
pageOrderBy := page.OrderBy[coredata.ContinualImprovementRegistriesOrderField]{
|
||||
Field: coredata.ContinualImprovementRegistriesOrderFieldCreatedAt,
|
||||
Direction: page.OrderDirectionDesc,
|
||||
}
|
||||
|
||||
if orderBy != nil {
|
||||
pageOrderBy = page.OrderBy[coredata.ContinualImprovementRegistriesOrderField]{
|
||||
Field: orderBy.Field,
|
||||
Direction: orderBy.Direction,
|
||||
}
|
||||
}
|
||||
|
||||
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
|
||||
|
||||
page, err := prb.ContinualImprovementRegistries.ListForOrganizationID(ctx, obj.ID, cursor)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot list organization continual improvement registries: %w", err))
|
||||
}
|
||||
|
||||
return types.NewContinualImprovementRegistryConnection(page, r, obj.ID), nil
|
||||
}
|
||||
|
||||
// Snapshots is the resolver for the snapshots field.
|
||||
func (r *organizationResolver) Snapshots(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.SnapshotOrderBy) (*types.SnapshotConnection, error) {
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
@@ -3748,6 +3907,12 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
|
||||
panic(fmt.Errorf("cannot get compliance registry: %w", err))
|
||||
}
|
||||
return types.NewComplianceRegistry(complianceRegistry), nil
|
||||
case coredata.ContinualImprovementRegistryEntityType:
|
||||
continualImprovementRegistry, err := prb.ContinualImprovementRegistries.Get(ctx, id)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get continual improvement registry: %w", err))
|
||||
}
|
||||
return types.NewContinualImprovementRegistry(continualImprovementRegistry), nil
|
||||
case coredata.ReportEntityType:
|
||||
report, err := prb.Reports.Get(ctx, id)
|
||||
if err != nil {
|
||||
@@ -4568,6 +4733,16 @@ func (r *Resolver) ComplianceRegistryConnection() schema.ComplianceRegistryConne
|
||||
return &complianceRegistryConnectionResolver{r}
|
||||
}
|
||||
|
||||
// ContinualImprovementRegistry returns schema.ContinualImprovementRegistryResolver implementation.
|
||||
func (r *Resolver) ContinualImprovementRegistry() schema.ContinualImprovementRegistryResolver {
|
||||
return &continualImprovementRegistryResolver{r}
|
||||
}
|
||||
|
||||
// ContinualImprovementRegistryConnection returns schema.ContinualImprovementRegistryConnectionResolver implementation.
|
||||
func (r *Resolver) ContinualImprovementRegistryConnection() schema.ContinualImprovementRegistryConnectionResolver {
|
||||
return &continualImprovementRegistryConnectionResolver{r}
|
||||
}
|
||||
|
||||
// Control returns schema.ControlResolver implementation.
|
||||
func (r *Resolver) Control() schema.ControlResolver { return &controlResolver{r} }
|
||||
|
||||
@@ -4722,6 +4897,8 @@ type auditResolver struct{ *Resolver }
|
||||
type auditConnectionResolver struct{ *Resolver }
|
||||
type complianceRegistryResolver struct{ *Resolver }
|
||||
type complianceRegistryConnectionResolver struct{ *Resolver }
|
||||
type continualImprovementRegistryResolver struct{ *Resolver }
|
||||
type continualImprovementRegistryConnectionResolver struct{ *Resolver }
|
||||
type controlResolver struct{ *Resolver }
|
||||
type controlConnectionResolver struct{ *Resolver }
|
||||
type datumResolver struct{ *Resolver }
|
||||
|
||||
Reference in New Issue
Block a user