Esempio n. 1
0
class Video(Content):
    __polymorphic_key__ = 'video'
    # objectid is the id of a container: photo album, blog post or status update
    object_id       = columns.TimeUUID(required = True, index=True)
    caption         = columns.Text(required = False)
    url_original    = columns.Text(required = True)
    location        = columns.Text()
Esempio n. 2
0
class Message(Model):
    """
    Represents messages received by an avatar. A message consists of:
    * a command
      Indicates if the message is a request or a response.
      For a response, 'ERR' is used for reporting error, 'RES' is to return successful result.
      Some commands from HTTP/1.1 are defined.
      - 'GET': The result of a GET request might be cached by the hub.
      - 'POST':
      - 'PUT':
      - 'DELETE':
      The URI part is designated as 'Destination' header.

    * a headers
      Contains metadata regarding the payload. Some well-known headers are:
      - 'Content-type': the content type of the payload, e.g. 'application/json'.
      - 'Content-length': the length in bytes of the payload
      - 'Destination': the resource intended to be the receiver on final target.
    * a payload(optional)
      The content to be sent as is. That is, the hub doesn't interpret or modify the payload.

    """
    avatar_xid = columns.Text(primary_key=True, partition_key=True)
    message_id = columns.TimeUUID(primary_key=True, clustering_order="DESC")
    command = columns.Text(default='POST')
    headers = columns.Text()
    payload = columns.Text(default=None)
Esempio n. 3
0
class AggregatedActivity(Model):
    __table_name__ = "aggregated"
    feed_id = columns.Ascii(primary_key=True, partition_key=True)
    group = columns.Ascii(primary_key=True, partition_key=True)
    updated_at = columns.DateTime(primary_key=True, clustering_order='desc')
    activity_id = columns.TimeUUID(required=True)
    activities = columns.Bytes(required=False)
    created_at = columns.DateTime(required=False)
Esempio n. 4
0
class Activity(BaseActivity):
    actor = columns.Text(required=True)
    extra_context = columns.Bytes(required=False)
    object = columns.TimeUUID(required=True)
    object_type = columns.Text(required=True)
    target = columns.Text(required=False)
    target_type = columns.Text(required=False)
    time = columns.DateTime(required=False)
    verb = columns.Integer(required=True)
Esempio n. 5
0
class Comment(Model):
    object_id       = columns.UUID(primary_key = True)
    id              = columns.TimeUUID(primary_key = True, default=uuid1, clustering_order="desc")
    author          = columns.Text(primary_key=True)
    created_at      = columns.DateTime(default=datetime.datetime.now())
    updated_at      = columns.DateTime()
    view_count      = columns.Integer(default=0)
    like_count      = columns.Integer(default=0)
    body	        = columns.Text()
Esempio n. 6
0
class Photo(Content):
    __polymorphic_key__ = 'photo'
    # objectid is the id of a container: photo album, blog post or status update
    object_id		= columns.TimeUUID(required = True, index=True)
    caption			= columns.Text(required = False)
    data     		= columns.Bytes(required = False)
    url_original    = columns.Text(required = True)
    url_thumbnail   = columns.Text(required=False)
    location        = columns.Text(required=False)
    image_type      = columns.Text(required=False)
    filename        = columns.Text(required=False)
    width           = columns.Integer(required=False)
    height          = columns.Integer(required=False)
Esempio n. 7
0
class Content(Model):

    __table_name__  = 'content'
    id              = columns.TimeUUID(primary_key = True, default=uuid1)
    author          = columns.Text(primary_key=True, clustering_order='ASC')
    content_type    = columns.Text(polymorphic_key=True, index=True)
    #created_at      = columns.DateTime(default=datetime.now(), primary_key = True, clustering_order='DESC')
    created_at      = columns.DateTime(default=datetime.datetime.now())
    updated_at      = columns.DateTime()
    view_count      = columns.Integer(default=0)
    like_count      = columns.Integer(default=0)
    comment_count   = columns.Integer(default=0)
    tags            = columns.List(value_type=columns.Text(), default=[])
    images          = columns.List(value_type=columns.Bytes(), default=[]) #['url1','url2',...'urln']
    img             = columns.Bytes()

    def create(self):
        pass

    def commenting(self):
        pass

    def liking(self):
        pass
Esempio n. 8
0
class BaseActivity(Model):
    feed_id = columns.Ascii(primary_key=True, partition_key=True)
    activity_id = columns.TimeUUID(primary_key=True, clustering_order='desc')
Esempio n. 9
0
class TimeUUIDQueryModel(Model):
    partition = columns.UUID(primary_key=True)
    time = columns.TimeUUID(primary_key=True)
    data = columns.Text(required=False)
Esempio n. 10
0
class PostFollower(MBase):
    post_id = columns.TimeUUID(primary_key=True)
    user_id = columns.Integer(primary_key=True)
    created_at = columns.BigInt(default=unix_time(dt.utcnow()))
Esempio n. 11
0
class PostFollower(MBase):
    post_id = columns.TimeUUID(primary_key=True)
    user_id = columns.Integer(primary_key=True)
Esempio n. 12
0
class Funny(Model):
    id = columns.Integer(primary_key=True)
    tt = columns.TimeUUID(primary_key=True, clustering_order="DESC")
    reading = columns.Text()