Пример #1
0
 class StatsChainSeq(orm.Model):
     __tablename__ = 'StatsChainSeq'
     __metadata__ = self.metadata
     __database__ = self.database
     pdb_id = orm.String(max_length=4, primary_key=True)
     entity_id = orm.Integer(primary_key=True)
     chain_id = orm.String(max_length=10)
     struct_asym_id = orm.String(max_length=10, primary_key=True)
     OBS_INDEX = orm.JSON()
     OBS_COUNT = orm.Integer()
     OBS_RATIO_ARRAY = orm.Text()
     BINDING_LIGAND_INDEX = orm.JSON()
     BINDING_LIGAND_COUNT = orm.Integer()
Пример #2
0
 class PISAInterfaceDict(orm.Model):
     __tablename__ = 'PISAInterfaceDict'
     __metadata__ = self.metadata
     __database__ = self.database
     entity_id_1 = orm.Integer()
     chain_id_1 = orm.String(max_length=50)
     struct_asym_id_1 = orm.String(max_length=50)
     struct_asym_id_in_assembly_1 = orm.String(max_length=50)
     asym_id_rank_1 = orm.Integer()
     model_id_1 = orm.Integer()
     molecule_type_1 = orm.Text()
     surface_range_1 = orm.JSON(allow_null=True)
     interface_range_1 = orm.JSON(allow_null=True)
     entity_id_2 = orm.Integer()
     chain_id_2 = orm.String(max_length=50)
     struct_asym_id_2 = orm.String(max_length=50)
     struct_asym_id_in_assembly_2 = orm.String(max_length=50)
     asym_id_rank_2 = orm.Integer()
     model_id_2 = orm.Integer()
     molecule_type_2 = orm.Text()
     surface_range_2 = orm.JSON(allow_null=True)
     interface_range_2 = orm.JSON(allow_null=True)
     pdb_id = orm.String(max_length=4, primary_key=True)
     assembly_id = orm.Integer(primary_key=True)
     interface_id = orm.Integer(primary_key=True)
     use_au = orm.Boolean()
     css = orm.Float()
     is_polymer_1 = orm.Boolean()
     is_polymer_2 = orm.Boolean()
Пример #3
0
class Shelf(orm.Model):
    __tablename__ = "shelf"
    __metadata__ = metadata
    __database__ = database
    id = orm.Integer(primary_key=True)
    organization = orm.ForeignKey(Organization)
    size = orm.Integer()

    @classmethod
    async def get_or_create(cls, data: dict, **kwargs) -> "Shelf":
        try:
            return await cls.objects.get(id=data["id"])
        except:
            return await cls.objects.create(**data)
Пример #4
0
class LitemallGoods(BaseModel):
    __tablename__ = 'litemall_goods'
    goods_sn = orm.String(length=63)
    name = orm.String(length=127)
    category_id = orm.Integer()
    brand_id = orm.Integer()
    gallery = orm.String(length=1023)
    keywords = orm.String(length=255)
    brief = orm.String(length=255)
    is_on_sale = orm.TinyInteger(length=1)
    sort_order = orm.Integer()
    pic_url = orm.String(length=255)
    unit = orm.String(length=31)
    retail_price = orm.Float()
    detail = orm.Text()
Пример #5
0
 class SMRModel(orm.Model):
     __tablename__ = 'SMRModel'
     __metadata__ = self.metadata
     __database__ = self.database
     UniProt = orm.String(max_length=50, primary_key=True)
     coordinates = orm.String(max_length=500, primary_key=True)
     unp_beg = orm.Integer()
     unp_end = orm.Integer()
     identity = orm.Float()
     similarity = orm.Float()
     coverage = orm.Float()
     oligo_state = orm.String(max_length=50)
     with_ligand = orm.Boolean()
     select_rank = orm.Integer()
     select_tag = orm.Boolean()
Пример #6
0
 class ALTERNATIVE_PRODUCTS(orm.Model):
     __tablename__ = 'ALTERNATIVE_PRODUCTS'
     __metadata__ = self.metadata
     __database__ = self.database
     isoform = orm.String(max_length=50, primary_key=True)
     name = orm.JSON(allow_null=True)
     synonyms = orm.JSON(allow_null=True)
     sequenceStatus = orm.String(max_length=50)
     VAR_SEQ = orm.JSON(allow_null=True)
     accession = orm.String(max_length=50, primary_key=True)
     else_iso = orm.JSON(allow_null=True)
     iso_range = orm.JSON(allow_null=True)
     iso_range_len = orm.Integer(allow_null=True)
     sequence = orm.Text(allow_null=True)
     length = orm.Integer(allow_null=True)
class Group(orm.Model):
    __tablename__ = GROUP_TABLENAME
    __database__ = database
    __metadata__ = metadata

    id = orm.Integer(primary_key=True, allow_null=False)
    name = orm.String(max_length=50, unique=True, allow_null=False)
class User(orm.Model):
    __tablename__ = USER_TABLENAME
    __database__ = database
    __metadata__ = metadata

    id = orm.Integer(primary_key=True, allow_null=False)
    name = orm.String(max_length=50, allow_null=False)
Пример #9
0
 class UniProtSeq(orm.Model):
     __tablename__ = 'UniProtSeq'
     __metadata__ = self.metadata
     __database__ = self.database
     isoform = orm.String(max_length=20, primary_key=True)
     Pos = orm.Integer(primary_key=True)
     Ref = orm.String(max_length=1, primary_key=True)
Пример #10
0
class Language(orm.Model):
    __metadata__ = metadata
    __database__ = database
    __tablename__ = "languages"

    id = orm.Integer(primary_key=True)
    name = orm.String(max_length=3)
Пример #11
0
class Domain(orm.Model):
    __tablename__ = "domains"
    __database__ = database
    __metadata__ = metadata

    id = orm.Integer(primary_key=True)
    name = orm.String(max_length=100, unique=True)
    registrar = orm.ForeignKey(Registrar)
    dns = orm.ForeignKey(DNSProvider, allow_null=True)
    site = orm.ForeignKey(Site, allow_null=True)
    waf = orm.ForeignKey(WAFProvider, allow_null=True)
    update_apex = orm.Boolean(default=True)
    update_a_records = orm.Text(default="www")
    google_site_verification = orm.String(max_length=64, allow_null=True)
    state = orm.Text(default="{}")
    active = orm.Boolean(default=True)

    async def serialize(self, full=False):
        r = {
            "id": self.id,
            "name": self.name,
        }
        if self.registrar.id:
            r["registrar"] = await self.registrar.serialize()
        if self.dns.id:
            r["dns"] = await self.dns.serialize()
        if self.site.id:
            r["site"] = await self.site.serialize()
        if self.waf.id:
            r["waf"] = await self.waf.serialize()
        if self.active:
            r["active"] = True
        return r
Пример #12
0
 class StatsProteinEntitySeq(orm.Model):
     __tablename__ = 'StatsProteinEntitySeq'
     __metadata__ = self.metadata
     __database__ = self.database
     pdb_id = orm.String(max_length=4, primary_key=True)
     molecule_type = orm.Text()
     entity_id = orm.Integer(primary_key=True)
     ca_p_only = orm.Boolean()
     SEQRES_COUNT = orm.Integer()
     STD_INDEX = orm.JSON()
     STD_COUNT = orm.Integer()
     NON_INDEX = orm.JSON()
     NON_COUNT = orm.Integer()
     UNK_INDEX = orm.JSON()
     UNK_COUNT = orm.Integer()
     ARTIFACT_INDEX = orm.JSON()
Пример #13
0
class User(orm.Model):
    __tablename__ = "user"
    __metadata__ = metadata
    __database__ = database

    id = orm.Integer(primary_key=True)
    username = orm.String(max_length=50, unique=True)

    @property
    def auth_token(self) -> str:
        s = Serializer(str(settings.SECRET_KEY))
        return s.dumps({"id": self.id}).decode()

    @staticmethod
    async def verify_auth_token(token: str) -> "User":
        s = Serializer(str(settings.SECRET_KEY))
        try:
            data = s.loads(token)
        except BadSignature:
            return None  # invalid token
        user = await User.objects.get(id=data["id"])
        return user

    @classmethod
    async def get_or_create(cls, data: dict, **kwargs) -> "User":
        try:
            return await cls.objects.get(id=data["id"])
        except:
            return await cls.objects.create(**data)
Пример #14
0
class BaseModel(orm.Model):
    __abstract__ = True

    id = orm.Integer(primary_key=True)
    created_at = orm.DateTime(allow_null=True, default=datetime.now())
    updated_at = orm.DateTime(allow_null=True)
    deleted_at = orm.DateTime(allow_null=True)
Пример #15
0
class UserEmail(orm.Model):
    __tablename__ = 'UserEmail'
    __metadata__ = metadata
    __database__ = database
    id = orm.Integer(primary_key=True)
    email_verify = orm.String(max_length=70, index=True)
    is_activatet = orm.Boolean(default=False)
Пример #16
0
class Notebook(orm.Model):
    __tablename__ = "notebooks"
    __database__ = database
    __metadata__ = metadata

    id = orm.Integer(primary_key=True, index=True)
    name = orm.String(max_length=100)
Пример #17
0
class User(app.db.Model, AuthUser):
    __tablename__ = "users"

    id = orm.Integer(primary_key=True)
    username = orm.String(max_length=16, unique=True)
    password_hash = orm.String(max_length=60)

    @property
    def display_name(self):
        return self.username

    @classmethod
    def create_from_token(cls, token: str):
        user = User(username=token)
        return user

    async def full(self):
        full_user = await User.objects.get(username=self.username)
        return full_user

    @classmethod
    def display_name_from_token(cls, token):
        return token

    def to_token(self):
        return self.username
Пример #18
0
class Person(orm.Model):
    registry = models
    fields = {
        "id": orm.Integer(primary_key=True),
        "email": orm.String(max_length=100),
        "profile": orm.OneToOne(Profile),
    }
Пример #19
0
class User(orm.Model):

    __tablename__ = "user"
    __database__ = database
    __metadata__ = metadata

    id = orm.Integer(primary_key=True)
    username = orm.String(max_length=50,
                          allow_null=False,
                          allow_blank=False,
                          index=True,
                          unique=True)
    email = orm.String(max_length=50,
                       unique=True,
                       index=True,
                       allow_null=True,
                       allow_blank=True)
    password = orm.String(max_length=255, allow_null=False, allow_blank=False)
    phone = orm.String(max_length=11,
                       min_length=11,
                       allow_null=True,
                       allow_blank=True)
    # 用户权限scopes字段
    permission = orm.String(max_length=50,
                            default="normal",
                            allow_null=True,
                            allow_blank=True)
    created_at = orm.String(allow_null=True, allow_blank=True, max_length=50)
    updated_at = orm.String(allow_null=True, allow_blank=True, max_length=50)
    deleted_at = orm.String(allow_null=True, allow_blank=True, max_length=50)
Пример #20
0
class Team(orm.Model):
    registry = models
    fields = {
        "id": orm.Integer(primary_key=True),
        "org": orm.ForeignKey(Organisation, on_delete=orm.RESTRICT),
        "name": orm.String(max_length=100),
    }
Пример #21
0
class Member(orm.Model):
    registry = models
    fields = {
        "id": orm.Integer(primary_key=True),
        "team": orm.ForeignKey(Team, on_delete=orm.SET_NULL, allow_null=True),
        "email": orm.String(max_length=100),
    }
Пример #22
0
class Test1(orm.Model):
    __tablename__ = "test1"
    __database__ = core.database
    __metadata__ = core.metadata

    id = orm.Integer(primary_key=True)
    name = orm.String(index=True, max_length=10)
Пример #23
0
class LitemallAddress(BaseModel):
    __tablename__ = 'litemall_address'
    name = orm.String(length=63)
    user_id = orm.Integer()
    address = orm.String(length=127)
    mobile = orm.String(length=20)
    is_default = orm.TinyInteger(length=1)
Пример #24
0
class Organisation(orm.Model):
    __tablename__ = "org"
    __metadata__ = metadata
    __database__ = database

    id = orm.Integer(primary_key=True)
    ident = orm.String(max_length=100)
Пример #25
0
class Album(orm.Model):
    __tablename__ = "album"
    __metadata__ = metadata
    __database__ = database

    id = orm.Integer(primary_key=True)
    name = orm.String(max_length=100)
Пример #26
0
class User(orm.Table):
    firstName = orm.String()
    lastName = orm.String()
    height = orm.Float(blank=True)
    age = orm.Integer(blank=True)

    def __repr__(self):
        return "<User: %s %s>" % (self.firstName, self.lastName)
Пример #27
0
class Penguin(orm.Model):
    __database__ = DATABASE
    __metadata__ = metadata
    __tablename__ = "penguins"

    id = orm.Integer(primary_key=True)
    nickname = orm.String(max_length=30, allow_null=False)
    swid = orm.String(max_length=40, allow_null=False, unique=True)
Пример #28
0
class Member(orm.Model):
    __tablename__ = "member"
    __metadata__ = metadata
    __database__ = database

    id = orm.Integer(primary_key=True)
    team = orm.ForeignKey(Team)
    email = orm.String(max_length=100)
Пример #29
0
class Team(orm.Model):
    __tablename__ = "team"
    __metadata__ = metadata
    __database__ = database

    id = orm.Integer(primary_key=True)
    org = orm.ForeignKey(Organisation)
    name = orm.String(max_length=100)
Пример #30
0
class RegistrarNotifier(orm.Model):
    __tablename__ = "registrar_notifiers"
    __database__ = database
    __metadata__ = metadata

    id = orm.Integer(primary_key=True)
    registrar = orm.ForeignKey(Registrar)
    notifier = orm.ForeignKey(Notifier)