-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Maxcutex/PA-refactoring
updte file
- Loading branch information
Showing
6 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
from .base_model import BaseModel, db | ||
from ..utils.enums import EmploymentType | ||
|
||
|
||
class UserClient(BaseModel): | ||
__tablename__ = "user_clients" | ||
|
||
institution_name = db.Column(db.String, nullable=False) | ||
job_title = db.Column(db.String, nullable=False) | ||
employment_type = db.Column( | ||
db.Enum(EmploymentType, values_callable=lambda obj: [e.value for e in obj]), | ||
nullable=True, | ||
) | ||
institution_url = db.Column(db.String, nullable=True) | ||
institution_city = db.Column(db.String, nullable=False) | ||
institution_country = db.Column(db.String, nullable=False) | ||
institution_size = db.Column(db.String, nullable=True) | ||
user_id = db.Column(db.Integer(), db.ForeignKey("users.id")) | ||
user = db.relationship("User", lazy=False) | ||
client_id = db.Column(db.Integer(), db.ForeignKey("clients.id")) | ||
client = db.relationship("Client", lazy=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import factory | ||
from app.utils import db | ||
from app.models.client import Client | ||
|
||
# Any Table fields that cannot be generated by factory.Faker() should be defined out here and used inside the class. | ||
# This is a limitation on how factory-boy serializes args created in the Factory class. | ||
# example | ||
# fake_cohort_position = 'Vice President' | ||
|
||
|
||
class ClientFactory(factory.alchemy.SQLAlchemyModelFactory): | ||
class Meta: | ||
model = Client | ||
sqlalchemy_session = db.session | ||
|
||
id = factory.Sequence(lambda n: n) | ||
# name = factory.Faker('name') | ||
# cohort_position = fake_cohort_position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import factory | ||
from app.utils import db | ||
from app.models.user_client import UserClient | ||
|
||
# Any Table fields that cannot be generated by factory.Faker() should be defined out here and used inside the class. | ||
# This is a limitation on how factory-boy serializes args created in the Factory class. | ||
# example | ||
# fake_cohort_position = 'Vice President' | ||
|
||
|
||
class UserClientFactory(factory.alchemy.SQLAlchemyModelFactory): | ||
class Meta: | ||
model = UserClient | ||
sqlalchemy_session = db.session | ||
|
||
id = factory.Sequence(lambda n: n) | ||
# name = factory.Faker('name') | ||
# cohort_position = fake_cohort_position |