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:
Charles Bochet 2024-05-07 21:04:45 +02:00 committed by GitHub
parent b691894254
commit ce4e78aa85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 6 deletions

View File

@ -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,

View File

@ -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
}

View File

@ -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

View File

@ -181,7 +181,7 @@ export class ApiRestMetadataService {
return `
query FindOne${capitalize(objectNameSingular)}(
$id: UUID!,
$id: ID!,
) {
${objectNameSingular}(id: $id) {
id