mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-25 13:02:15 +03:00
Fix Rest API id UUID error (#5321)
A user has reported an issue with REST API. We have recently migrated the graphql IDs from UUID to ID type. As Rest API is leveraging the graphql API under the hood, the Rest API query builder should be updated accordingly
This commit is contained in:
parent
b691894254
commit
ce4e78aa85
@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil';
|
||||
import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation';
|
||||
|
||||
const expectedQueryTemplate = `
|
||||
mutation UpdateOnePerson($idToUpdate: UUID!, $input: PersonUpdateInput!) {
|
||||
mutation UpdateOnePerson($idToUpdate: ID!, $input: PersonUpdateInput!) {
|
||||
updatePerson(id: $idToUpdate, data: $input) {
|
||||
__typename
|
||||
xLink {
|
||||
@ -36,13 +36,11 @@ mutation UpdateOnePerson($idToUpdate: UUID!, $input: PersonUpdateInput!) {
|
||||
describe('useUpdateOneRecordMutation', () => {
|
||||
it('should return a valid createManyRecordsMutation', () => {
|
||||
const objectNameSingular = 'person';
|
||||
const depth = 2;
|
||||
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useUpdateOneRecordMutation({
|
||||
objectNameSingular,
|
||||
depth,
|
||||
}),
|
||||
{
|
||||
wrapper: RecoilRoot,
|
||||
|
@ -8,7 +8,7 @@ export class DeleteQueryFactory {
|
||||
const objectNameSingular = capitalize(objectMetadataItem.nameSingular);
|
||||
|
||||
return `
|
||||
mutation Delete${objectNameSingular}($id: UUID!) {
|
||||
mutation Delete${objectNameSingular}($id: ID!) {
|
||||
delete${objectNameSingular}(id: $id) {
|
||||
id
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ export class UpdateQueryFactory {
|
||||
return `
|
||||
mutation Update${capitalize(
|
||||
objectNameSingular,
|
||||
)}($id: UUID!, $data: ${capitalize(objectNameSingular)}UpdateInput!) {
|
||||
)}($id: ID!, $data: ${capitalize(objectNameSingular)}UpdateInput!) {
|
||||
update${capitalize(objectNameSingular)}(id: $id, data: $data) {
|
||||
id
|
||||
${objectMetadata.objectMetadataItem.fields
|
||||
|
@ -181,7 +181,7 @@ export class ApiRestMetadataService {
|
||||
|
||||
return `
|
||||
query FindOne${capitalize(objectNameSingular)}(
|
||||
$id: UUID!,
|
||||
$id: ID!,
|
||||
) {
|
||||
${objectNameSingular}(id: $id) {
|
||||
id
|
||||
|
Loading…
Reference in New Issue
Block a user