Skip to content

Server side data structures

garethnunns edited this page Oct 23, 2012 · 2 revisions

This is a page that is subject to a lot of change regarding the data structures server side. Obviously we haven't decided on a DB yet but I've tried to keep this universal. This document is based on the API documentation that I wrote and I wrote this as well for consistency.

#Users

  • Id - int
  • Username - string
  • Real name - string
  • Hashed password - string
  • User image URL - string

#Keys

  • Id - int
  • Key - string
  • User - int
  • Start date - int (timestamp)
  • Expire date - int (timestamp)

Note that a new key should be provided for each /api/login/ call and all keys for a user should be deleted on /api/logout/. The server should also get rid of expired keys. I guess a search would be for key where User == user and startDate >= 30 days ago and expireDate > now.

#Groups

  • Id - int
  • Name - string
  • Creator - int (user id)
  • Group color - int representing hue of color label

#Group members

  • Id - int
  • Group - int (group id)
  • User - int (user id)
  • Role - int (0 = unapproved, 1 = approved, 2 = staff for group)

#Posts

  • Id - int
  • Plain text - string
  • User - int (user id)
  • Time - int (timestamp)
  • Deleted - int (0 = visible, 1 = invisible)

Note that only the plain text gets stored and

tags get added by the server when building JSON response.

#Reposts

  • Id - int
  • Original - int representing original post Id
  • Repost - int representing new post Id

#Likes/Dislikes

  • Id - int
  • User - int
  • Like (1 = like, -1 = dislike)

Messages

  • Id - int
  • Sender - int
  • Receiver - int
  • Time - int
  • Text - string (again this is plain text)
  • Read - bool/int
  • Direct to - int (the ID of the post that the message is relevant to, such as a repost or reply)