示例#1
0
class user_comments(Model):
    id = fields.BigIntField(generated=True, pk=True)

    author_id = fields.BigIntField(null=False)
    user_id = fields.BigIntField(null=False)
    comment = fields.CharField(max_length=1000, null=False)
    posted = fields.DateField()
示例#2
0
class User(Model, Base):
    """
    User model.

    Stores users, their info and their default feed options.
    """
    id = fields.BigIntField(pk=True, description='Telegram user id, 8Bytes')
    state = fields.SmallIntField(
        default=0,
        description='User state: '
        '-1=banned, 0=guest, 1=user, 50=channel, 51=group, 100=admin')
    lang = fields.CharField(default='zh-Hans',
                            max_length=16,
                            description='Preferred language, lang code')
    admin = fields.BigIntField(
        null=True,
        description='One of the admins of the channel or group, '
        'can be null if this "user" is not a channel or a group')
    subs: fields.ReverseRelation['Sub']

    # default options of a user's feeds
    # interval = fields.SmallIntField(null=True)
    # notify = fields.SmallIntField(null=True)
    # send_mode = fields.SmallIntField(null=True)
    # length_limit = fields.SmallIntField(null=True)
    # display_author = fields.SmallIntField(null=True)
    # display_via = fields.SmallIntField(null=True)
    # display_title = fields.SmallIntField(null=True)

    class Meta:
        table = 'user'

    def __str__(self):
        return self.id
示例#3
0
class Poll(tortoise.Model):
    id = fields.BigIntField(pk=True)
    channel_id = fields.BigIntField()
    message_id = fields.BigIntField()
    author_id = fields.BigIntField()

    content = fields.JSONField()
    is_anonymous = fields.BooleanField()

    available_choices = fields.IntField()

    # noinspection PyUnresolvedReferences
    choices: fields.ManyToManyRelation[
        "Response"] = fields.ManyToManyField(  # type: ignore
            "models.Response", related_name="choices")

    class Meta:
        table = "polls"

    def __str__(self):
        return (f"<Poll id={self.id} "
                f"channel_id={self.channel_id} "
                f"message_id={self.message_id} "
                f"author_id={self.author_id} "
                f"content={self.content} "
                f"is_anonymous={self.is_anonymous} "
                f"available_choices={self.available_choices} "
                f"choices={self.choices}>")

    __repr__ = __str__
示例#4
0
class GuildOptions(Model):
    id = fields.BigIntField(pk=True)
    guild_id = fields.BigIntField()
    dadbot_enabled_channels = fields.JSONField(default=[])

    def __str__(self):
        return 'GuildOptions[{}]'.format(self.guild_id)
示例#5
0
class Configs(Model):
    guild = fields.BigIntField(null=True)
    log_channel = fields.BigIntField(null=True)
    frequency = fields.IntField(null=True)

    class Meta:
        table = "new_configs"
示例#6
0
class BatchBuildPackage(Model):
    id = fields.BigIntField(pk=True)
    build_id = fields.BigIntField()
    batch_build_id = fields.BigIntField()

    class Meta:
        table = "batch_build_packages"
示例#7
0
class Tournaments(Model):
    class Meta:
        table = 'tournaments'
        unique_together = ('schedule_type', 'slug')

    id = fields.IntField(pk=True)
    schedule_type = fields.CharField(45, null=True)
    slug = fields.CharField(45, null=True)
    guild_id = fields.BigIntField(null=True)
    helper_roles = fields.CharField(2000, null=True)
    audit_channel_id = fields.BigIntField(null=True)
    commentary_channel_id = fields.BigIntField(null=True)
    scheduling_needs_channel_id = fields.BigIntField(null=True)
    scheduling_needs_tracker = fields.SmallIntField(null=True)
    mod_channel_id = fields.BigIntField(null=True)
    tracker_roles = fields.CharField(2000, null=True)
    commentator_roles = fields.CharField(2000, null=True)
    mod_roles = fields.CharField(2000, null=True)
    admin_roles = fields.CharField(2000, null=True)
    category = fields.CharField(200, null=True)
    goal = fields.CharField(200, null=True)
    active = fields.SmallIntField(null=True)
    has_submission = fields.BooleanField(null=True)
    lang = fields.CharField(20, null=True)
    coop = fields.BooleanField(null=True)
示例#8
0
class NickVerification(Model):
    class Meta:
        table = 'nick_verification'

    key = fields.BigIntField(pk=True, generated=False)
    discord_user_id = fields.BigIntField(null=True)
    timestamp = fields.DatetimeField(auto_now=True, null=True)
示例#9
0
class Bid(Model):
    id = fields.BigIntField(pk=True)
    auction = fields.ForeignKeyField('models.Auction', 'bids')
    bid_amount = fields.BigIntField()
    bidder = fields.ForeignKeyField('models.Address', 'bids')
    level = fields.BigIntField()
    timestamp = fields.DatetimeField()
示例#10
0
class FilterServer(Model):
    guild = fields.BigIntField(pk=True)

    image_filter = fields.BooleanField(default=False, null=True, blank=True)

    allow_nsfw_channels = fields.BooleanField(default=True, null=True, blank=True)
    allow_for_channels = fields.TextField(default='', null=True, blank=True)
    allow_for_roles = fields.TextField(default='', null=True, blank=True) 
    allow_for_permissions = fields.TextField(default='', null=True, blank=True)
    allow_medical = fields.BooleanField(default=False)
    action = fields.TextField(default='', null=True, blank=True)  # placeholder

    google_adult_threshold = fields.IntField(default=6, null=True, blank=True)
    google_racy_threshold = fields.IntField(default=6, null=True, blank=True)
    google_medical_threshold = fields.IntField(default=9, null=True, blank=True)
    google_spoofed_threshold = fields.IntField(default=10, null=True, blank=True)
    google_violence_threshold = fields.IntField(default=7, null=True, blank=True)

    azure_adult_threshold = fields.IntField(default=6, null=True, blank=True)
    azure_racy_threshold = fields.IntField(default=8, null=True, blank=True)
    image_algor_bias = fields.IntField(default=1, null=True, blank=True)

    text_filtering = fields.BooleanField(default=False, null=True, blank=True)
    text_threshold = fields.IntField(default=8, null=True, blank=True)

    facial_recognition = fields.BooleanField(default=False, null=True, blank=True)
    facial_threshold = fields.IntField(default=5, null=True, blank=True)

    event_channel = fields.BigIntField(default=0, null=True, blank=True)
示例#11
0
class Tag(tortoise.Model):
    id = fields.BigIntField(pk=True)
    server_id = fields.BigIntField()
    author_id = fields.BigIntField()

    name = fields.TextField()
    content = fields.TextField()

    uses = fields.IntField(default=0)

    created_at = fields.DatetimeField(auto_now_add=True)

    class Meta:
        table = "tags"

    def __str__(self):
        return (f"<Tag id={self.id} "
                f"server_id={self.server_id} "
                f"author_id={self.author_id} "
                f"name='{self.name}' "
                f"content='{self.content}' "
                f"uses={self.uses} "
                f"created_at={self.created_at}>")

    __repr__ = __str__
示例#12
0
class DiscordGuild(Model):
    id = fields.IntField(pk=True)
    discord_id = fields.BigIntField(index=True)
    name = fields.TextField()
    prefix = fields.CharField(20, null=True)
    permissions = fields.JSONField(default={})
    language = fields.CharField(6, default="en")
    overtime_confirmed = fields.BooleanField(default=False)
    is_premium = fields.BooleanField(default=False)
    enable_tips = fields.BooleanField(default=True)
    disable_simulations = fields.BooleanField(default=False)
    used_updaters = fields.SmallIntField(default=0)
    total_updaters = fields.SmallIntField(default=1)

    minigame_enabled = fields.BooleanField(default=False)
    log_channel = fields.BigIntField(default=None, null=True)
    infected_role = fields.BigIntField(default=None, null=True)
    cured_role = fields.BigIntField(default=None, null=True)
    dead_role = fields.BigIntField(default=None, null=True)

    class Meta:
        table = "guilds"

    def __str__(self):
        return self.name

    def __repr__(self):
        return f"<Guild name={self.name}>"
示例#13
0
class Inventory(Model):
    player: fields.OneToOneRelation[Player] = fields.OneToOneField(
        "models.Player",
        on_delete=fields.CASCADE,
        related_name="inventory",
        pk=True)

    education = fields.BigIntField(default=1)
    knowledge_points = fields.BigIntField(default=0)
    working_points = fields.BigIntField(default=0)
    research_points = fields.BigIntField(default=0)
    money = fields.BigIntField(default=0)  # Comes from work
    soap = fields.IntField(default=1)  # Can be bought
    food = fields.IntField(default=2)  # Can be bought
    airplane_ticket = fields.IntField(default=0)  # Can be bought
    lottery_ticket = fields.IntField(default=0)  # Can be bought
    herb = fields.IntField(default=0)  # Can be found
    music_cd = fields.IntField(default=0)  # Can be found
    pill = fields.IntField(default=0)  # Can be given to by doctors
    vaccine = fields.IntField(default=0)  # Can be given to by doctors
    mask = fields.IntField(default=0)  # Can be given to by doctors
    toilet_paper = fields.IntField(default=6)  # Can be used only
    gun = fields.IntField(default=0)  # Can be used only
    dagger = fields.IntField(default=1)  # Can be used only
    virus_test = fields.IntField(default=0)  # Can be given to by doctors
示例#14
0
class BatchImportPackage(Model):
    id = fields.BigIntField(pk=True)
    import_id = fields.BigIntField()
    batch_import_id = fields.BigIntField()

    class Meta:
        table = "batch_import_packages"
示例#15
0
class Build(Model):
    id = fields.BigIntField(pk=True)
    created_at = fields.DatetimeField(auto_now_add=True)
    updated_at = fields.DatetimeField(auto_add=True, null=True)
    package = fields.ForeignKeyField("distrobuild.Package",
                                     on_delete="RESTRICT",
                                     related_name="builds")
    status = fields.CharEnumField(BuildStatus)
    mbs = fields.BooleanField(default=False)
    signed = fields.BooleanField(default=False)
    scratch = fields.BooleanField(default=False)
    scratch_merged = fields.BooleanField(default=False)
    koji_id = fields.BigIntField(null=True)
    mbs_id = fields.BigIntField(null=True)
    import_commit = fields.ForeignKeyField("distrobuild.ImportCommit",
                                           on_delete="RESTRICT",
                                           related_name="builds")
    executor_username = fields.CharField(max_length=255)
    force_tag = fields.CharField(max_length=255, null=True)
    arch_override = fields.TextField(null=True)
    exclude_compose = fields.BooleanField(default=False)
    point_release = fields.CharField(max_length=255)

    class Meta:
        table = "builds"
        ordering = ["-created_at"]

    class PydanticMeta:
        exclude = ("batch_builds", )
示例#16
0
class guild(Model):
    id = fields.BigIntField(unique=True, pk=True)
    event_logs = fields.BigIntField(null=True, default=None)
    prefixes = ArrayField(str)
    disabled_commands = ArrayField(str, default=list)
    disabled_users = ArrayField(int, default=list)
    disabled_channels = ArrayField(int, default=list)
示例#17
0
class Message(Model, Base):
    class Meta:
        table = "message"

    db_fields = [
        'id', 'created', 'modified', 'client_id', 'uid', 'type', 'state', 'data'
    ]

    db_field_datetime = [
        'created', 'modified'
    ]
    db_field_enum = [
        'type'
    ]

    id = fields.BigIntField(pk=True)
    created = fields.DatetimeField(auto_now_add=True)
    modified = fields.DatetimeField(auto_now=True)

    client_id = fields.BigIntField(null=True, default=None)
    uid = fields.CharField(max_length=64, index=True, default=None)
    type = fields.CharEnumField(enum_type=MessageType, null=True, default=None)
    state = fields.CharEnumField(enum_type=MessageState, null=True, default=None)
    _data = fields.TextField(source_field='data')

    @property
    def data(self) -> dict:
        return json.loads(self._data) if self._data else {}

    @data.setter
    def data(self, data: dict):
        self._data = json.dumps(data, cls=DefaultJSONEncoder)
示例#18
0
class Raider(Model):
    id = fields.IntField(pk=True, generated=True)
    raid = fields.ForeignKeyField("models.Raid",
                                  related_name="raiders",
                                  source_field="raid_id")
    user_id = fields.BigIntField()
    joined_at = fields.BigIntField()
示例#19
0
class CustomCommand(Model):
    id = fields.IntField(pk=True, generated=True)
    serverid = fields.BigIntField()
    trigger = fields.CharField(max_length=20, collation="utf8mb4_general_ci")
    response = fields.CharField(max_length=2000,
                                collation="utf8mb4_general_ci")
    created_by = fields.BigIntField(null=True)
示例#20
0
class Client(Model, Base):
    class Meta:
        table = "client"

    db_fields = [
        'created', 'modified', 'remote_id', 'uid', 'connection', 'connection_change', 'ip'
    ]

    db_field_datetime = [
        'created', 'modified', 'connection_change'
    ]
    db_field_enum = [
        'connection'
    ]

    id = fields.BigIntField(pk=True)
    created = fields.DatetimeField(auto_now_add=True)
    modified = fields.DatetimeField(auto_now=True)

    access_id = fields.BigIntField(null=True, default=None)
    remote_id = fields.BigIntField(null=True, default=None)
    uid = fields.CharField(max_length=64, index=True, default=None)
    basicauth_password = fields.CharField(max_length=64, null=True, default=None)
    ip = fields.CharField(max_length=64, null=True, default=None)
    connection = fields.CharEnumField(enum_type=Connection, null=True, default=None)
    connection_change = fields.DatetimeField(null=True, default=None)
示例#21
0
class Log(models.Model):
    username = fields.CharField(max_length=32)
    ip = fields.CharField(max_length=64, blank=True, null=True)
    trusted_host = fields.CharField(max_length=128, blank=True, null=True)
    bytes_sent = fields.BigIntField(default=0)
    bytes_received = fields.BigIntField(default=0)
    online_time = fields.DatetimeField(null=True)
    offline_time = fields.DatetimeField(null=True)
示例#22
0
class cm_item(Model):
    user_id = fields.BigIntField()
    added_at = fields.DateField()
    id = fields.BigIntField(generated=True, pk=True)
    rarity = fields.CharField(max_length=50, null=True)
    float = fields.FloatField()
    name = fields.CharField(max_length=2000)
    price = fields.BigIntField()
示例#23
0
class Trade(Model):
    id = fields.BigIntField(pk=True)
    swap = fields.ForeignKeyField('models.Swap', 'trades')
    seller = fields.ForeignKeyField('models.Holder', 'sales')
    buyer = fields.ForeignKeyField('models.Holder', 'purchases')
    amount = fields.BigIntField()
    level = fields.BigIntField()
    timestamp = fields.DatetimeField()
示例#24
0
文件: db.py 项目: nwunderly/ouranos
class Config(Model):
    guild_id = fields.BigIntField(pk=True, generated=False)
    prefix = fields.TextField(default=Settings.prefix)
    modlog_channel_id = fields.BigIntField(default=0)
    mute_role_id = fields.BigIntField(default=0)
    admin_role_id = fields.BigIntField(default=0)
    mod_role_id = fields.BigIntField(default=0)
    dm_on_infraction = fields.BooleanField(default=True)
示例#25
0
class VoiceRole(Model):
    class Meta:
        table = 'voice_role'

    id = fields.IntField(pk=True)
    guild_id = fields.BigIntField(null=False)
    voice_channel_id = fields.BigIntField(null=False)
    role_id = fields.BigIntField(null=False)
示例#26
0
    class Journal(Model):
        timestamp = fields.DatetimeField(auto_now_add=True)
        level = fields.SmallIntField(index=True)
        text = fields.CharField(max_length=255, index=True)

        col_float1 = fields.FloatField(default=2.2)
        col_smallint1 = fields.SmallIntField(default=2)
        col_int1 = fields.IntField(default=2000000)
        col_bigint1 = fields.BigIntField(default=99999999)
        col_char1 = fields.CharField(max_length=255, default='value1')
        col_text1 = fields.TextField(
            default='Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa')
        col_decimal1 = fields.DecimalField(12, 8, default=Decimal('2.2'))
        col_json1 = fields.JSONField(default={
            'a': 1,
            'b': 'b',
            'c': [2],
            'd': {
                'e': 3
            },
            'f': True
        })

        col_float2 = fields.FloatField(null=True)
        col_smallint2 = fields.SmallIntField(null=True)
        col_int2 = fields.IntField(null=True)
        col_bigint2 = fields.BigIntField(null=True)
        col_char2 = fields.CharField(max_length=255, null=True)
        col_text2 = fields.TextField(null=True)
        col_decimal2 = fields.DecimalField(12, 8, null=True)
        col_json2 = fields.JSONField(null=True)

        col_float3 = fields.FloatField(default=2.2)
        col_smallint3 = fields.SmallIntField(default=2)
        col_int3 = fields.IntField(default=2000000)
        col_bigint3 = fields.BigIntField(default=99999999)
        col_char3 = fields.CharField(max_length=255, default='value1')
        col_text3 = fields.TextField(
            default='Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa')
        col_decimal3 = fields.DecimalField(12, 8, default=Decimal('2.2'))
        col_json3 = fields.JSONField(default={
            'a': 1,
            'b': 'b',
            'c': [2],
            'd': {
                'e': 3
            },
            'f': True
        })

        col_float4 = fields.FloatField(null=True)
        col_smallint4 = fields.SmallIntField(null=True)
        col_int4 = fields.IntField(null=True)
        col_bigint4 = fields.BigIntField(null=True)
        col_char4 = fields.CharField(max_length=255, null=True)
        col_text4 = fields.TextField(null=True)
        col_decimal4 = fields.DecimalField(12, 8, null=True)
        col_json4 = fields.JSONField(null=True)
示例#27
0
    class Journal(Model):
        timestamp = fields.DatetimeField(auto_now_add=True)
        level = fields.SmallIntField(index=True)
        text = fields.CharField(max_length=255, index=True)

        col_float1 = fields.FloatField(default=2.2)
        col_smallint1 = fields.SmallIntField(default=2)
        col_int1 = fields.IntField(default=2000000)
        col_bigint1 = fields.BigIntField(default=99999999)
        col_char1 = fields.CharField(max_length=255, default="value1")
        col_text1 = fields.TextField(
            default="Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa")
        col_decimal1 = fields.DecimalField(12, 8, default=Decimal("2.2"))
        col_json1 = fields.JSONField(default={
            "a": 1,
            "b": "b",
            "c": [2],
            "d": {
                "e": 3
            },
            "f": True
        })

        col_float2 = fields.FloatField(null=True)
        col_smallint2 = fields.SmallIntField(null=True)
        col_int2 = fields.IntField(null=True)
        col_bigint2 = fields.BigIntField(null=True)
        col_char2 = fields.CharField(max_length=255, null=True)
        col_text2 = fields.TextField(null=True)
        col_decimal2 = fields.DecimalField(12, 8, null=True)
        col_json2 = fields.JSONField(null=True)

        col_float3 = fields.FloatField(default=2.2)
        col_smallint3 = fields.SmallIntField(default=2)
        col_int3 = fields.IntField(default=2000000)
        col_bigint3 = fields.BigIntField(default=99999999)
        col_char3 = fields.CharField(max_length=255, default="value1")
        col_text3 = fields.TextField(
            default="Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa")
        col_decimal3 = fields.DecimalField(12, 8, default=Decimal("2.2"))
        col_json3 = fields.JSONField(default={
            "a": 1,
            "b": "b",
            "c": [2],
            "d": {
                "e": 3
            },
            "f": True
        })

        col_float4 = fields.FloatField(null=True)
        col_smallint4 = fields.SmallIntField(null=True)
        col_int4 = fields.IntField(null=True)
        col_bigint4 = fields.BigIntField(null=True)
        col_char4 = fields.CharField(max_length=255, null=True)
        col_text4 = fields.TextField(null=True)
        col_decimal4 = fields.DecimalField(12, 8, null=True)
        col_json4 = fields.JSONField(null=True)
class dynamic_cache(Model):
    dynamic_id = fields.BigIntField(pk=True, unique=True)
    rid = fields.BigIntField(unique=True)
    content: dict = fields.JSONField()
    created = fields.DatetimeField(auto_now=True)
    timeout = timedelta(days=10)

    class Meta:
        table = "dynamic"
示例#29
0
class Swap(Model):
    id = fields.BigIntField(pk=True)
    creator = fields.ForeignKeyField('models.Holder', 'swaps')
    price = fields.BigIntField()
    amount = fields.BigIntField()
    amount_left = fields.BigIntField()
    level = fields.BigIntField()
    status = fields.IntEnumField(SwapStatus)
    timestamp = fields.DatetimeField()
示例#30
0
class SMZ3Multiworld(Model):
    class Meta:
        table = 'smz3_multiworld'

    message_id = fields.BigIntField(pk=True, generated=False)
    owner_id = fields.BigIntField(null=True)
    randomizer = fields.CharField(45, null=True)
    preset = fields.CharField(45, null=True)
    status = fields.CharField(20, null=True)