m-ld / timeld

Live shared timesheets
MIT License
1 stars 1 forks source link

Create entry in fedb/fedt project #66

Closed kroky closed 2 years ago

kroky commented 2 years ago

@gsvarovsky I am trying to create an entry under this project via the import API. Submitting this:

{"@id":"fedb/fedt","@type":"Project"}
{"@type":"Timesheet","project":{"@id":"fedb/fedt"},"@id":"victor/federated-timesheets"}
{"@type":"Entry","session":{"@id":"victor/federated-timesheets"},"activity":"Meeting with Michiel, George and others to discuss initial steps for defining the data model of the federated timesheets and other complexities","duration":69,"start":{"@value":"2022-03-10T05:00:00+00:00","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"vf:provider":{"@id":"http://timeld.org/victor"},"external":{"@id":"http://localhost/tiki-git/api/trackers/71/items/3426"}}

Getting this:

{"code":"BadRequest","message":"Malformed domain entity [\n  {\n    instancePath: [ 'project' ],\n    schemaPath: [\n      'mapping',\n      'Timesheet',\n      'optionalProperties',\n      'project',\n      'elements'\n    ]\n  }\n]"}

I have already created victor/federated-timesheets Timesheet and linked to fedb/fedt project via the timeld cli:

add link victor/federated-timesheets --project fedb/fedt

What am I doing wrong?

gsvarovsky commented 2 years ago

Hi Victor, the error is stating that the project field requires an array of references. This should do it:

{"@type":"Timesheet","project":[{"@id":"fedb/fedt"}],"@id":"victor/federated-timesheets"}
kroky commented 2 years ago

Yes, this makes sense. I resolved the issue, thanks!