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
26 lines
671 B
TypeScript
26 lines
671 B
TypeScript
import gql from 'graphql-tag';
|
|
import { capitalize } from 'twenty-shared';
|
|
|
|
type RestoreOneOperationFactoryParams = {
|
|
objectMetadataSingularName: string;
|
|
gqlFields: string;
|
|
recordId: string;
|
|
};
|
|
|
|
export const restoreOneOperationFactory = ({
|
|
objectMetadataSingularName,
|
|
gqlFields,
|
|
recordId,
|
|
}: RestoreOneOperationFactoryParams) => ({
|
|
query: gql`
|
|
mutation Restore${capitalize(objectMetadataSingularName)}($${objectMetadataSingularName}Id: ID!) {
|
|
restore${capitalize(objectMetadataSingularName)}(id: $${objectMetadataSingularName}Id) {
|
|
${gqlFields}
|
|
}
|
|
}
|
|
`,
|
|
variables: {
|
|
[`${objectMetadataSingularName}Id`]: recordId,
|
|
},
|
|
});
|