Closes https://github.com/twentyhq/core-team-issues/issues/393 - enforcing object-records permission checks in resolvers for now. we will move the logic to a lower level asap - add integration tests that will still be useful when we have moved the logic - introduce guest seeded role to test limited permissions on object-records
28 lines
695 B
TypeScript
28 lines
695 B
TypeScript
import gql from 'graphql-tag';
|
|
import { capitalize } from 'twenty-shared';
|
|
|
|
type RestoreManyOperationFactoryParams = {
|
|
objectMetadataSingularName: string;
|
|
objectMetadataPluralName: string;
|
|
gqlFields: string;
|
|
filter: object;
|
|
};
|
|
|
|
export const restoreManyOperationFactory = ({
|
|
objectMetadataSingularName,
|
|
objectMetadataPluralName,
|
|
gqlFields,
|
|
filter,
|
|
}: RestoreManyOperationFactoryParams) => ({
|
|
query: gql`
|
|
mutation Restore${capitalize(objectMetadataPluralName)}($filter: ${capitalize(objectMetadataSingularName)}FilterInput!) {
|
|
restore${capitalize(objectMetadataPluralName)}(filter: $filter) {
|
|
${gqlFields}
|
|
}
|
|
}
|
|
`,
|
|
variables: {
|
|
filter,
|
|
},
|
|
});
|