Feat/metadata add update and delete on frontend (#2102)
* Reworked metadata creation * Wip * Fix from PR * Removed consolelog * Post merge * Fixed seeds
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
export const formatPagedObjectsToObjects = <
|
||||
ObjectType extends { id: string },
|
||||
ObjectType extends { id: string } & Record<string, any>,
|
||||
ObjectTypeQuery extends {
|
||||
[objectNamePlural: string]: {
|
||||
edges: ObjectEdge[];
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
import { capitalize } from '~/utils/string/capitalize';
|
||||
|
||||
import { MetadataObject } from '../types/MetadataObject';
|
||||
|
||||
export const generateCreateOneObjectMutation = ({
|
||||
metadataObject,
|
||||
}: {
|
||||
metadataObject: MetadataObject;
|
||||
}) => {
|
||||
const capitalizedObjectName = capitalize(metadataObject.nameSingular);
|
||||
|
||||
return gql`
|
||||
mutation CreateOne${capitalizedObjectName}($input: ${capitalizedObjectName}CreateInput!) {
|
||||
createOne${capitalizedObjectName}(data: $input) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
};
|
||||
Reference in New Issue
Block a user