Exemple #1
0
class UserActivity(models.Model):
    id = BigAutoField(primary_key=True)
    user = models.ForeignKey(User, on_delete=models.DO_NOTHING, db_constraint=False, db_index=False)
    activity = models.ForeignKey(Activity, on_delete=models.DO_NOTHING, db_constraint=False, db_index=False)

    class Meta:
        db_table = 'user_activity_tab'
Exemple #2
0
class Activity(models.Model):
    id = BigAutoField(primary_key=True)
    activity_category = models.ForeignKey(ActivityCategory, on_delete=models.DO_NOTHING, db_constraint=False, db_index=False)
    longitude = models.DecimalField(max_digits=20, decimal_places=10)
    latitude = models.DecimalField(max_digits=20, decimal_places=10)
    time = PositiveBigIntegerField()
    place_name = models.CharField(max_length=255, default='')
    expiry_time = PositiveBigIntegerField()

    STATUS_INIT = 1
    STATUS_COMPLETED = 2
    STATUS_DENIED = 3
    STATUS_EXPIRED = 4
    status = models.PositiveSmallIntegerField(
        choices=(
            (STATUS_INIT, 'Init'),
            (STATUS_COMPLETED, 'Completed'),
            (STATUS_DENIED, 'Denied'),
            (STATUS_EXPIRED, 'Expired'),
        ),
        default=STATUS_INIT,
    )

    class Meta:
        db_table = 'activity_tab'
Exemple #3
0
class ActivityImage(models.Model):
    id = BigAutoField(primary_key=True)
    activity = models.ForeignKey(Activity, on_delete=models.DO_NOTHING, db_constraint=False, db_index=False)
    image = models.ImageField(upload_to='activity/', null=True, max_length=255)

    class Meta:
        db_table = 'activity_image_tab'
Exemple #4
0
class ActivityCategory(models.Model):
    id = BigAutoField(primary_key=True)
    name = models.CharField(max_length=255)
    complete_point = models.IntegerField()
    fail_point = models.IntegerField()

    class Meta:
        db_table = 'activity_category_tab'
Exemple #5
0
class User(models.Model):
    id = BigAutoField(primary_key=True)
    email = models.CharField(max_length=255)
    full_name = models.CharField(max_length=255)
    salt = models.CharField(max_length=64)
    password_hash = models.CharField(max_length=64)
    image = models.ImageField(upload_to='profile/', null=True, max_length=255)
    total_point = models.BigIntegerField()
    azure_person_id = models.CharField(max_length=64, default='')

    class Meta:
        db_table = 'user_tab'
Exemple #6
0
class UserAttribute(models.Model):
    id = BigAutoField(primary_key=True)
    user = models.ForeignKey(User,
                             on_delete=models.DO_NOTHING,
                             db_constraint=False,
                             db_index=False)
    attribute = models.ForeignKey(Attribute,
                                  on_delete=models.DO_NOTHING,
                                  db_constraint=False,
                                  db_index=False)
    value = models.CharField(max_length=128, default='0')

    class Meta:
        db_table = 'user_attribute_tab'
Exemple #7
0
class UserLuckyDraw(models.Model):
    id = BigAutoField(primary_key=True)
    user = models.ForeignKey(User, on_delete=models.DO_NOTHING, db_constraint=False, db_index=False)
    activity_category = models.ForeignKey(ActivityCategory, on_delete=models.DO_NOTHING, db_constraint=False, db_index=False)

    STATUS_INIT = 1
    STATUS_ACCEPTED = 2
    STATUS_DENIED = 3
    STATUS_MATCHED = 4
    status = models.PositiveSmallIntegerField(
        choices=(
            (STATUS_INIT, 'Init'),
            (STATUS_ACCEPTED, 'Accepted'),
            (STATUS_DENIED, 'Denied'),
            (STATUS_MATCHED, 'Matched'),
        ),
        default=STATUS_INIT,
    )

    class Meta:
        db_table = 'user_lucky_draw_tab'
Exemple #8
0
class Attribute(models.Model):
    id = BigAutoField(primary_key=True)
    name = models.CharField(max_length=128, default='')

    class Meta:
        db_table = 'attribute_tab'