Skip to content

Instantly share code, notes, and snippets.

@jcolebrand
Forked from Raynos/Message.json
Created August 26, 2011 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcolebrand/1172575 to your computer and use it in GitHub Desktop.
Save jcolebrand/1172575 to your computer and use it in GitHub Desktop.
{
_id: uint, //gives us format :101123 for replies, etc
owner_id: int,
text: String,
room: int, // id of room
starred: [user_id], // ids of users
flagged: [user_id], // ids of users
timestamp: timestamp, // all timestamps are in unix from UTC
deleted: timestamp, // null indicates not deleted
deletedBy: user_id, // indicates who deleted the message
history: [ { user : user_id, text : String, edited : timestamp } ]
}
{
message_id: int,
flagged: [user_id], // ids of users
}
{
message_id: int,
starred: [user_id], // ids of users
}
{
_id: uint,
owners: [user_id], // ids
name: String,
description: String,
created: timestamp,
created_by: user_id,
last_message: message_id, // we can link back all the info we need from this or denormalize later
total_messages: uint,
total_messages_24hours: uint,
total_users_ever: uint,
total_users_now: uint,
histogram: [int], // ask me about this later .. I want histograms just like SO has on everything
state: int, //locked_deleted/deleted/frozen/active
type: int, //public/gallery/private
explicit_write_access: [user_id], // don't need to be exposed to the user _per-se_
explicit_read_access: [user_id], // don't need to be exposed to the user _per-se_
}
{
submitter: user_id,
text: String,
expiry: timestamp, //may be falsy, requires a user to clear it if so
}
{
_id: int, //users can be negative. Negative users indicates a system account
name: String,
email: String,
password_hash: String,
website: String,
introduction: String,
gravatar_hash: String,
histogram: [int],
rooms_currently_in: [room_id],
last_seen: timestamp,
last_sent_message: message_id,
last_spoke_here: timestamp, // this is only for use on the client, has no need on the server, per-se
total_messages_sent: uint, // can be decremented on deletes
total_flags_ever: uint,
banned: timestamp, // may be null or falsy, indicates no ban active
banned_duration: long, // to be added to the timestamp?
ignored_users: [user_id], // to allow people to ignore others (do we need to support by room ignore?)
role: int, // admin / moderator / user / guest? / trial-admin?
can_talk: bool,
can_read: bool,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment