Add state to MCP profile and refactor contract filter
Add the profile state attribute (ACTIVE/INACTIVE) to the MCP Profile schema so listUsers and getUser tools expose it, and add a state filter to listUsers. Rename excludeContractEnded to contractEnded across the entire stack (MCP, GraphQL, CLI, frontend). The new boolean is two-way: true returns only users with ended contracts, false returns only users with active or no contract, and null returns all. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -65,7 +65,7 @@ function PeopleMultiSelectWithQuery<T extends FieldValues = FieldValues>(
|
||||
) {
|
||||
const { __ } = useTranslate();
|
||||
const { name, organizationId, control, selectedPeople = [], placeholder } = props;
|
||||
const people = usePeople(organizationId, { excludeContractEnded: true });
|
||||
const people = usePeople(organizationId, { contractEnded: false });
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const allPeople = [...people];
|
||||
|
||||
@@ -61,7 +61,7 @@ function PeopleSelectWithQuery<TFieldValues extends FieldValues = FieldValues>(
|
||||
) {
|
||||
const { __ } = useTranslate();
|
||||
const { name, organizationId, control } = props;
|
||||
const people = usePeople(organizationId, { excludeContractEnded: true });
|
||||
const people = usePeople(organizationId, { contractEnded: false });
|
||||
|
||||
return (
|
||||
<Controller
|
||||
|
||||
@@ -31,7 +31,7 @@ export function PeopleCell(props: Props) {
|
||||
query={peopleQuery}
|
||||
variables={{
|
||||
organizationId: props.organizationId,
|
||||
filter: { excludeContractEnded: true },
|
||||
filter: { contractEnded: false },
|
||||
}}
|
||||
items={data =>
|
||||
data.organization?.profiles?.edges.map(edge => edge.node) ?? []}
|
||||
|
||||
@@ -49,13 +49,13 @@ export const peopleQuery = graphql`
|
||||
*/
|
||||
export function usePeople(
|
||||
organizationId: string,
|
||||
{ excludeContractEnded }: { excludeContractEnded?: boolean } = {},
|
||||
{ contractEnded }: { contractEnded?: boolean } = {},
|
||||
) {
|
||||
const data = useLazyLoadQuery<PeopleGraphQuery>(
|
||||
peopleQuery,
|
||||
{
|
||||
organizationId: organizationId,
|
||||
filter: excludeContractEnded ? { excludeContractEnded: true } : null,
|
||||
filter: contractEnded !== undefined ? { contractEnded } : null,
|
||||
},
|
||||
{ fetchPolicy: "network-only" },
|
||||
);
|
||||
|
||||
@@ -196,7 +196,7 @@ function PeopleList({
|
||||
signatureDocumentsDialogPeopleQuery,
|
||||
{
|
||||
organizationId,
|
||||
filter: { excludeContractEnded: true },
|
||||
filter: { contractEnded: false },
|
||||
},
|
||||
);
|
||||
const {
|
||||
|
||||
@@ -27,7 +27,7 @@ export const documentSignaturesPageQuery = graphql`
|
||||
query DocumentSignaturesPageQuery($documentId: ID! $organizationId: ID! $versionId: ID! $versionSpecified: Boolean!) {
|
||||
organization: node(id: $organizationId) {
|
||||
__typename
|
||||
...DocumentSignatureList_peopleFragment @arguments(filter: { excludeContractEnded: true })
|
||||
...DocumentSignatureList_peopleFragment @arguments(filter: { contractEnded: false })
|
||||
}
|
||||
# We use this on /documents/:documentId
|
||||
document: node(id: $documentId) @skip(if: $versionSpecified) {
|
||||
|
||||
@@ -550,7 +550,7 @@ function OwnerFilterSelect({
|
||||
onChange,
|
||||
}: OwnerFilterSelectProps) {
|
||||
const { __ } = useTranslate();
|
||||
const people = usePeople(organizationId, { excludeContractEnded: true });
|
||||
const people = usePeople(organizationId, { contractEnded: false });
|
||||
|
||||
return (
|
||||
<Select value={value ?? "ALL"} onValueChange={onChange}>
|
||||
|
||||
Reference in New Issue
Block a user