Model that maps to the user_orgs table (many-to-many)
| 540 | |
| 541 | |
| 542 | class UserOrgModel(BaseModel): |
| 543 | """Model that maps to the user_orgs table (many-to-many)""" |
| 544 | |
| 545 | __tablename__ = "user_orgs" |
| 546 | __table_args__ = {"schema": "public"} |
| 547 | |
| 548 | user_id = model.Column(model.UUID, model.ForeignKey("public.users.id"), primary_key=True) |
| 549 | org_id = model.Column(model.UUID, model.ForeignKey("public.orgs.id"), primary_key=True) |
| 550 | role = model.Column( |
| 551 | model.Enum(OrgRoles, name="org_roles", create_constraint=False, native_enum=True), |
| 552 | default=OrgRoles.owner, |
| 553 | ) |
| 554 | user_email = model.Column(model.String) |
| 555 | is_paid = model.Column(model.Boolean, default=False) |
| 556 | |
| 557 | user = orm.relationship("UserModel", back_populates="orgs") |
| 558 | org = orm.relationship("OrgModel", back_populates="users") |
| 559 | |
| 560 | |
| 561 | class OrgInviteModel(BaseModel): |
no outgoing calls
searching dependent graphs…