diff --git a/packages/ra-cubicweb/src/index.ts b/packages/ra-cubicweb/src/index.ts index b89b4d7ca73dc6db0536bf42fbea5ba38feb26c4_cGFja2FnZXMvcmEtY3ViaWN3ZWIvc3JjL2luZGV4LnRz..1d25689923e66069cea213f9d5eb70fa882ae3bf_cGFja2FnZXMvcmEtY3ViaWN3ZWIvc3JjL2luZGV4LnRz 100644 --- a/packages/ra-cubicweb/src/index.ts +++ b/packages/ra-cubicweb/src/index.ts @@ -131,7 +131,19 @@ return { data: [entity] }; }, getManyReference: (_resource, _params) => Promise.reject("Not implemented"), - update: (_resource, _params) => Promise.reject("Not implemented"), + update: async (resource, { data, id }) => { + // FIXME update relations + const attributesUpdates: string[] = []; + Object.entries(data).forEach(([key, value]) => { + if (key in schema.etypes[resource]) { + attributesUpdates.push(`X ${key} ${JSON.stringify(value)}`); + } + }); + await rqlClient.queryRows(` + SET ${attributesUpdates.join(", ")} WHERE X is ${resource}, X eid ${id} + `); + return Promise.resolve({ data: { ...data, id } }); + }, updateMany: (_resource, _params) => Promise.reject("Not implemented"), create: (_resource, _params) => Promise.reject("Not implemented"), delete: (_resource, _params) => Promise.reject("Not implemented"),