refactor: moving more models to mapped_column
This commit is contained in:
parent
ea020d6edd
commit
75b2c1adf0
9 changed files with 272 additions and 94 deletions
|
@ -1,9 +1,13 @@
|
|||
import base64
|
||||
import hashlib
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.brm.brn import BRN
|
||||
from app.extensions import db
|
||||
from app.models import AbstractConfiguration, AbstractResource
|
||||
from app.models.base import Group
|
||||
|
||||
|
||||
class Onion(AbstractConfiguration):
|
||||
|
@ -47,12 +51,12 @@ class Onion(AbstractConfiguration):
|
|||
|
||||
|
||||
class Eotk(AbstractResource):
|
||||
group_id = db.Column(db.Integer(), db.ForeignKey("group.id"), nullable=False)
|
||||
instance_id = db.Column(db.String(100), nullable=True)
|
||||
provider = db.Column(db.String(20), nullable=False)
|
||||
region = db.Column(db.String(20), nullable=False)
|
||||
group_id: Mapped[int] = mapped_column(db.Integer(), db.ForeignKey("group.id"))
|
||||
instance_id: Mapped[Optional[str]]
|
||||
provider: Mapped[str]
|
||||
region: Mapped[str]
|
||||
|
||||
group = db.relationship("Group", back_populates="eotks")
|
||||
group: Mapped[Group] = relationship("Group", back_populates="eotks")
|
||||
|
||||
@property
|
||||
def brn(self) -> BRN:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue