Skip to content
defrex edited this page May 30, 2011 · 9 revisions

Models

All models must have the following fields

{
    id: string,
    created: timestamp,
    modified: timestamp,
    deleted: boolean,
    creator: user.id
}

None of these fields can be altered by the client.

Create data versus Real data

Models are created via a create method (See Protocol). The data passed to create is not the same as the data returned by sub, though it will be similar. The above mandatory fields, for example, are not sent to create, but are added by the server. The differences for each data type will be noted, excluding the above global fields.

Data Types

Users

key: user

fields:

{
    name: string,
    avatar: string
}

create:

{
    name: string
}

Listings

key: listing

fields:

{
    photo: string,
    description: string,
    latitude: number,
    longitude: number,
    price: number
}

relationships: (TODO: document how these work).

{
    offers: [offer.id, ...],
    inqueries: [inquiry.id, ...]
}

Offers

key: offer

fields:

{
    amount: number,
    listing: listing.id
}

relationships:

{
    messages: [message.id, ...]
}

Messages

key: message

fields:

{
    message: string,
    offer: offer.id
}

Inquiries

key: inquiry

fields:

{
    question: string,
    answer: string,
    listing: listing.id
}

Clone this wiki locally