コード例 #1
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()
コード例 #2
0
ファイル: files.py プロジェクト: spacebeam/openresty-sif
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())
コード例 #3
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()
コード例 #4
0
ファイル: files.py プロジェクト: spacebeam/openresty-sif
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())
コード例 #5
0
class BaseAccount(models.Model):
    '''
        Base account
    '''
    uuid = types.UUIDType(default=uuid.uuid4)

    passwords = compound.ListType(compound.ModelType(Password))

    # api samples, remove after finish work on passwords or otherwise secret keys.
    api_key = types.StringType(required=False)
    # api_keys = compound.ListType(compound.ModelType(Mon))

    # system admin account
    is_admin = types.BooleanType(default=False)

    active = types.BooleanType(default=True)
    account = types.StringType(required=True)
    name = types.StringType(required=False)
    email = types.EmailType(required=True)
    phone_number = types.StringType()
    country_code = types.StringType()
    timezone = types.StringType()
    location = types.StringType()
    resources = compound.ModelType(Resource)
    
    routes = compound.ListType(compound.ModelType(Route))

    uri = types.StringType(required=False)
    url = types.URLType()

    # move this to howler and spider?
    max_channels = types.IntType()
コード例 #6
0
class Org(BaseAccount):
    '''
        Org account
    '''
    account_type = types.StringType(default='org')
    
    # tests for members and teams.
    members = compound.ListType(types.StringType())
    teams = compound.ListType(compound.ModelType(Team))
    description = types.StringType()
コード例 #7
0
ファイル: accounts.py プロジェクト: spacebeam/mango
class Orgs(BaseAccount):
    '''
        Org account
    '''
    account_type = types.StringType(
        choices=['org', ],
        default='org',
        required=True
    )
    name = types.StringType()
    description = types.StringType()
    members = compound.ListType(types.StringType())
    owners = compound.ListType(types.StringType())
    teams = compound.ListType(types.DictType(types.StringType))
コード例 #8
0
ファイル: __init__.py プロジェクト: jh3rnand3z/cebus
class ResourceContainer(models.Model):
    '''
        Cebus resource container
    '''
    contains = compound.ListType(types.UUIDType())

    total = types.IntType()
コード例 #9
0
ファイル: __init__.py プロジェクト: jh3rnand3z/extractor
class SimpleResource(models.Model):
    '''
        Simple resource
    '''
    contains = compound.ListType(types.UUIDType())

    total = types.IntType()
コード例 #10
0
ファイル: games.py プロジェクト: spacebeam/bw
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()
コード例 #11
0
ファイル: tasks.py プロジェクト: jh3rnand3z/mango
class Comment(models.Model):
    ''' 
        Comment
    '''
    comments = compound.ListType(compound.ModelType(SimpleEntry))

    total = types.IntType()
コード例 #12
0
ファイル: __init__.py プロジェクト: spacebeam/bw
class BaseResult(models.Model):
    '''
        Base result
    '''
    count = types.IntType()
    page = types.IntType()
    results = compound.ListType(types.StringType())
コード例 #13
0
class Application(BaseApp):
    '''
        Cebus application

        Application data structure
    '''
    accounts = compound.ListType(types.StringType())
    total = types.IntType()
コード例 #14
0
 class Schema:
     foo = types.StringType(required=True)
     bar = types.StringType(required=True)
     baz = types.StringType(required=True)
     count = types.IntType()
     child = compound.DictType(types.StringType)
     things = compound.ListType(types.BaseType)
     when = types.DateTimeType()
     created = DynamoTimestampType()
コード例 #15
0
class Team(models.Model):
    '''
        Org team
    '''
    name = types.StringType(required=True)
    permission = types.StringType(choices=['read',
                                           'write',
                                           'admin'], required=True)
    members = compound.ListType(types.StringType())
    resources = compound.ModelType(Resource)
コード例 #16
0
class Users(BaseAccount):
    '''
        User account
    '''
    role = types.StringType(choices=['admin', 'user'],
                            default='user',
                            required=True)
    account_type = types.StringType(choices=[
        'user',
    ],
                                    default='user',
                                    required=True)
    nickname = types.StringType()
    first_name = types.StringType()
    middle_name = types.StringType()
    last_name = types.StringType()
    password = types.StringType(required=True)
    orgs = compound.ListType(types.DictType(types.StringType))
    teams = compound.ListType(types.DictType(types.StringType))
コード例 #17
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()
コード例 #18
0
class SchematicsFieldsModel(BaseModel):
    # base fields
    type_string = types.StringType()
    type_int = types.IntType()
    type_uuid = types.UUIDType()
    type_IPv4 = types.IPv4Type()
    type_url = types.URLType()
    type_email = types.EmailType()
    type_number = types.NumberType(int, "integer")
    type_int = types.IntType()
    type_long = types.LongType()
    type_float = types.FloatType()
    type_decimal = types.DecimalType()
    type_md5 = types.MD5Type()
    type_sha1 = types.SHA1Type()
    type_boolean = types.BooleanType()
    type_date = types.DateType()
    type_datetime = types.DateTimeType()
    type_geopoint = types.GeoPointType()
    # type_multilingualstring = types.MultilingualStringType(default_locale='localized_value')

    # compound fields
    type_list = compound.ListType(types.StringType)
    type_dict = compound.DictType(
        types.IntType)  # dict values can be only integers
    type_list_of_dict = compound.ListType(compound.DictType,
                                          compound_field=types.StringType)
    type_dict_of_list = compound.DictType(compound.ListType,
                                          compound_field=types.IntType)
    type_model = compound.ModelType(NestedModel)
    type_list_model = compound.ListType(compound.ModelType(NestedModel))

    # reference fields
    type_ref_simplemodel = ModelReferenceType(SimpleModel)
    type_ref_usermodel = ModelReferenceType(User)

    class Options:
        # namespace = 'st'
        collection = 'st'
        serialize_when_none = False
コード例 #19
0
ファイル: teams.py プロジェクト: spacebeam/mango
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()
コード例 #20
0
class ModifyUser(BaseAccount):
    '''
        Modify account
    '''
    account_type = types.StringType(default='user')
    orgs = compound.ListType(types.StringType())
    password = types.StringType()
    
    # move company to baseAccount class?
    company = types.StringType()

    # clx stuff, please move this to another place that makes more sense.
    UserId = types.IntType()
    AccountNum = types.StringType()
コード例 #21
0
ファイル: teams.py プロジェクト: spacebeam/mango
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()
コード例 #22
0
ファイル: __init__.py プロジェクト: jh3rnand3z/cebus
class Unit(models.Model):
    '''
        Cebus base unit model
    '''
    name = types.StringType(required=False)
    uuid = types.UUIDType(default=uuid.uuid4)

    contacts = compound.ModelType(ContactsContainer)

    url = types.URLType()
    urls = compound.ListType(types.StringType())

    resources = compound.ModelType(Resource)

    cores = types.IntType(default=1)
    total = types.IntType()
コード例 #23
0
class User(BaseAccount):
    '''
        User account
    '''
    first_name = types.StringType()
    last_name = types.StringType()
    account_type = types.StringType(default='user')
    orgs = compound.ListType(types.StringType())
    password = types.StringType(required=True)
    
    # move company to baseAccount class?
    company = types.StringType()

    # clx stuff, please move this to another place that makes more sense.
    UserId = types.IntType()
    AccountNum = types.StringType()
コード例 #24
0
class ParentE(BaseModel):
    childs = compound.ListType(
        ModelReferenceType(ChildA, reverse_delete_rule=DO_NOTHING))
コード例 #25
0
class ParentG(BaseModel):
    childs = compound.ListType(
        ModelReferenceType(ChildA, reverse_delete_rule=CASCADE))
コード例 #26
0
class Brand(BaseModel):
    title = types.StringType()
    menu = compound.ListType(DynamicType)
コード例 #27
0
class RecordSeries(BaseModel):
    title = types.StringType()
    records = compound.ListType(ModelReferenceType(Record))
    simplies = compound.ListType(ModelReferenceType(SimpleModel))
    main_event = ModelReferenceType(Event)
コード例 #28
0
class ParentI(BaseModel):
    childs = compound.ListType(
        ModelReferenceType(ChildA, reverse_delete_rule=PULL))
コード例 #29
0
class ParentBase(BaseModel):
    friends = compound.ListType(
        ModelReferenceType(ChildB, reverse_delete_rule=PULL))
コード例 #30
0
class ParentMixin(Model):
    """
    Need to subclass schematics.Model, so declared fields will be collected
    """
    friends = compound.ListType(
        ModelReferenceType(ChildB, reverse_delete_rule=PULL))