How to handle these types of data formats?


#1

Hi everyone,

either I haven’t read the spec properly or there is no information about this:

Say I have this data structure:

{ 
  campaign: "some-id",
  related_to: { typeof_relation: 'verwandt', event_id: '0' },
  attendees: [ { kickoff: true, user: 'some-id' } ],
  supervisors: [ '1bef28cf-ef32-4e20-a353-12d42ad6dcf2' ]
}

Would attendees in this case be a relationship? or just an attribute?
I know that the supervisors relationship would look like this:

"relationships": {
    "supervisors": {
        "data": [
            {
                "type": "people",
               "id": "1bef28cf-ef32-4e20-a353-12d42ad6dcf2"
            }
        ]
    }
}

Is it possible to represent the attendees which are stored with an additional kickoffboolean value as a relationship? Or are they simply attributes even though user is a different resource?

Should attendee be another resource (mongodb collection)?


#2

Hey,

Have a look at this thread: Working with data on relationships.


#3

I understand all examples in that thread except for the one using meta.

Say I would use the meta attribute like this:

{
    "data": [
        {
            "type": "people",
            "id": "some-people-id",
            "meta": {
                "kickoff": false
            }
        }
    ]
}

Will meta here be actual data that a serialiser can deserialise properly?

Say the output format has to be:

[
        {
            "user": "some-people-id",
            "kickoff": false
        }
    ]

Can you elaborate on how the meta object will be handled once deserialised? Is it actually part of the original document in the database? In my case it would have to be.

Edit: We are now using the option 3 with two relationship arrays btw.


#4

Never mind I understand the meta object now.