Repository navigation
Models
defrex edited this page May 30, 2011
·
9 revisions
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.
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.
key: user
fields:
{
name: string,
avatar: string
}
create:
{
name: string
}
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, ...]
}
key: offer
fields:
{
amount: number,
listing: listing.id
}
relationships:
{
messages: [message.id, ...]
}
key: message
fields:
{
message: string,
offer: offer.id
}
key: inquiry
fields:
{
question: string,
answer: string,
listing: listing.id
}