ambassador map and replace relationships with integer fields
This commit is contained in:
parent
67264b3da6
commit
71d1910988
8 changed files with 17 additions and 6 deletions
Binary file not shown.
BIN
app/campaigns/__pycache__/models.cpython-310.pyc
Normal file
BIN
app/campaigns/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
|
|
@ -6,12 +6,20 @@ import jwt
|
|||
from datetime import datetime, timezone, timedelta
|
||||
|
||||
|
||||
class AmbassadorMap(db.Model):
|
||||
__tablename__ = 'ambassador_map'
|
||||
id = Column('id', INTEGER(), primary_key=True)
|
||||
campaign_id = Column('campaign_id', INTEGER(), nullable=False)
|
||||
user_id = Column('user_id', INTEGER(), nullable=False)
|
||||
|
||||
|
||||
|
||||
class Campaign(db.Model):
|
||||
__tablename__ = 'campaign'
|
||||
id = Column('id', INTEGER(), primary_key=True)
|
||||
title = Column('title', TEXT(), nullable=False)
|
||||
donations = db.relationship('Donation', backref='campaign', lazy='dynamic')
|
||||
id = Column('id', INTEGER(), primary_key=True)
|
||||
title = Column('title', TEXT(), nullable=False)
|
||||
|
||||
# donations = db.relationship('Donation', backref='campaign', lazy='dynamic')
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"{self.id} - {self.title}"
|
||||
|
|
|
|||
BIN
app/main/__pycache__/models.cpython-310.pyc
Normal file
BIN
app/main/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
|
|
@ -11,9 +11,11 @@ class Donation(db.Model):
|
|||
id = Column('id', INTEGER(), primary_key=True, autoincrement=True)
|
||||
currency_type = Column('currency_type', TEXT(), nullable=False)
|
||||
amount = Column('amount', INTEGER(), nullable=False)
|
||||
user_id = Column('user_id', INTEGER(), nullable=False)
|
||||
campaign_id = Column('campaign_id', INTEGER(), nullable=False)
|
||||
|
||||
user_id = Column(INTEGER, ForeignKey('user.id'))
|
||||
campaign_id = Column(INTEGER, ForeignKey('campaign.id'))
|
||||
# user_id = Column(INTEGER, ForeignKey('user.id'))
|
||||
# campaign_id = Column(INTEGER, ForeignKey('campaign.id'))
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"{self.id} - {self.currency_type} - {self.amount}"
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -14,7 +14,8 @@ class User(db.Model, UserMixin):
|
|||
email = Column('email', TEXT(), nullable=False, unique=True)
|
||||
password = Column('password', TEXT(), nullable=False)
|
||||
user_type = Column('user_type', TEXT(), nullable=False)
|
||||
donations = db.relationship('Donation', backref='user', lazy='dynamic')
|
||||
|
||||
# donations = db.relationship('Donation', backref='user', lazy='dynamic')
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue