Exemplo n.º 1
0
class RequiredBase(models.Model):
    '''
        Very self explanatory
    '''
    status = types.StringType(required=False)
    account = types.StringType(required=True)
    role = types.StringType(required=False)
    email = types.EmailType(required=True)
    phone_number = types.StringType()
    extension = types.StringType()
    country_code = types.StringType()
    timezone = types.StringType()
    affiliation = types.StringType()
    location = types.StringType()
    phones = compound.ListType(compound.ModelType(Phone))
    emails = compound.ListType(compound.ModelType(Email))
    labels = types.DictType(types.StringType)
    history = compound.ListType(types.StringType())
    checked = types.BooleanType(default=False)
    checked_by = types.StringType()
    checked_at = types.TimestampType()
    created_by = types.StringType(required=True)
    created_at = types.TimestampType(default=arrow.utcnow().timestamp)
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()
Exemplo n.º 2
0
class ModifyFile(models.Model):
    '''
        Modify File

        This model is similar to File.

        It lacks of require and default values on it's fields.

        The reason of it existence is that we need to validate
        every input data that came from outside the system, with
        this we prevent users from using PATCH to create fields
        outside the scope of the resource.
    '''
    uuid = types.UUIDType()
    url = types.StringType()
    account = types.StringType()
    checksum = types.StringType()
    head = types.StringType()
    payload = types.StringType()
    public = types.BooleanType()
    labels = compound.ListType(types.StringType())
    hashes = compound.ListType(types.StringType())
    chunks = compound.ListType(types.StringType())
    status = types.StringType()
    created_by = types.StringType()
    created_at = types.TimestampType()
    updated = types.BooleanType()
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()
    checked = types.BooleanType()
    checked_by = types.StringType()
    checked_at = types.TimestampType()
    active = types.BooleanType()
    watchers = compound.ListType(types.StringType())
Exemplo n.º 3
0
class File(models.Model):
    '''
        File Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    url = types.StringType()
    account = types.StringType(required=True)
    checksum = types.StringType()
    head = types.StringType()
    payload = types.StringType()
    public = types.BooleanType(default=False)
    labels = compound.ListType(types.StringType())
    hashes = compound.ListType(types.StringType())
    chunks = compound.ListType(types.StringType())
    status = types.StringType()
    created_by = types.StringType()
    created_at = types.TimestampType(default=arrow.utcnow().timestamp)
    updated = types.BooleanType(default=False)
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()
    checked = types.BooleanType(default=False)
    checked_by = types.StringType()
    checked_at = types.TimestampType()
    active = types.BooleanType(default=True)
    watchers = compound.ListType(types.StringType())
Exemplo n.º 4
0
class Game(models.Model):
    '''
        Game Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    game = types.IntType(required=True)
    status = types.StringType(
        choices=['new', 'starting', 'in-progress', 'completed', 'deleted'],
        default='new')
    labels = types.DictType(types.StringType)
    history = compound.ListType(types.StringType())
    address = types.IPAddressType()
    session = types.UUIDType()
    bots = types.StringType(required=True)
    map = types.StringType(required=True)
    replay = types.StringType()
    home = types.StringType()
    home_is_winner = types.BooleanType(default=False)
    home_crashed = types.BooleanType(default=False)
    home_timed_out = types.BooleanType(default=False)
    home_building_score = types.IntType()
    home_razing_score = types.IntType()
    home_unit_score = types.IntType()
    away = types.StringType()
    away_is_winner = types.BooleanType(default=False)
    away_crashed = types.BooleanType(default=False)
    away_timed_out = types.BooleanType(default=False)
    away_building_score = types.IntType()
    away_razing_score = types.IntType()
    away_unit_score = types.IntType()
    created_by = types.UUIDType()
    created_at = types.DateTimeType(default=datetime.datetime.utcnow)
    last_update_by = types.UUIDType()
    last_update_at = types.TimestampType()
Exemplo n.º 5
0
class Task(models.Model):
    '''
        Task Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    account = types.StringType(required=True)
    subject = types.StringType()
    description = types.StringType()
    data = types.StringType()
    assign = compound.ListType(types.StringType())
    public = types.BooleanType(default=False)
    source = types.StringType()
    destination = types.StringType()
    labels = types.DictType(types.StringType)
    start_time = types.TimestampType()
    ack_time = types.TimestampType()
    stop_time = types.TimestampType()
    deadline = types.TimestampType()
    duration = types.StringType()
    comments = compound.ListType(types.StringType())
    status = types.StringType(choices=['new', 'now', 'later', 'done'],
                              default='new',
                              required=True)
    history = compound.ListType(types.StringType())
    checked = types.BooleanType(default=False)
    checked_by = types.StringType()
    checked_at = types.TimestampType(default=arrow.utcnow().timestamp)
    created_by = types.StringType()
    created_at = types.TimestampType(default=arrow.utcnow().timestamp)
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()
Exemplo n.º 6
0
class ModifyTeam(models.Model):
    '''
        Modify (ORG) Team
    '''
    uuid = types.UUIDType()
    # MUST be an organization account!
    account = types.StringType()
    status = types.StringType()
    name = types.StringType()
    description = types.StringType()
    permissions = types.StringType()
    members = compound.ListType(types.StringType())
    resources = compound.ListType(types.StringType())
    labels = compound.ListType(types.StringType())
    history = compound.ListType(types.StringType())
    checked = types.BooleanType()
    checked_by = types.StringType()
    checked_at = types.TimestampType()
    created_by = types.StringType()
    created_at = types.TimestampType()
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()
Exemplo n.º 7
0
class Team(models.Model):
    '''
       (ORG) Team
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    # MUST be an organization account!
    account = types.StringType(required=True)
    status = types.StringType(required=True)
    name = types.StringType(required=True)
    description = types.StringType()
    permissions = types.StringType(choices=['read',
                                           'write',
                                           'owner'], required=True)
    members = compound.ListType(types.StringType(), required=True)
    resources = compound.ListType(types.StringType()) # [resource:uuid, noun:*]
    labels = compound.ListType(types.StringType())
    history = compound.ListType(types.StringType())
    checked = types.BooleanType(default=False)
    checked_by = types.StringType()
    checked_at = types.TimestampType()
    created_by = types.StringType(required=True)
    created_at = types.TimestampType(default=arrow.utcnow().timestamp)
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()
Exemplo n.º 8
0
class ModifyTask(models.Model):
    '''
        Modify task

        This model is similar to Task.

        It lacks of require and default values on it's fields.

        The reason of it existence is that we need to validate
        every input data that came from outside the system, with
        this we prevent users from using PATCH to create fields
        outside the scope of the resource.
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    account = types.StringType()
    subject = types.StringType()
    description = types.StringType()
    data = types.StringType()
    assign = compound.ListType(types.StringType())
    public = types.BooleanType(default=False)
    source = types.StringType()
    destination = types.StringType()
    labels = types.DictType(types.StringType)
    start_time = types.TimestampType()
    ack_time = types.TimestampType()
    stop_time = types.TimestampType()
    deadline = types.TimestampType()
    duration = types.StringType()
    comments = compound.ListType(types.StringType())
    status = types.StringType(choices=['new', 'now', 'later', 'done'],
                              default='new',
                              required=True)
    history = compound.ListType(types.StringType())
    checked = types.BooleanType(default=False)
    checked_by = types.StringType()
    checked_at = types.TimestampType(default=arrow.utcnow().timestamp)
    created_by = types.StringType()
    created_at = types.TimestampType(default=arrow.utcnow().timestamp)
    last_update_by = types.StringType()
    last_update_at = types.TimestampType()