generated from Luis/nextjs-python-web-template
reposetories is now also a list in enteties - one to many relation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -101,7 +101,7 @@ class EntityCreate(EntityBase):
|
||||
class Entity(EntityCreate):
|
||||
producers: List[Producer] = []
|
||||
consumers: List[Consumer] = []
|
||||
repository: Optional[Repository] = None
|
||||
repository: List[Repository] = []
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
@@ -34,7 +34,7 @@ class Entity(Base):
|
||||
## Relations ##
|
||||
producers = relationship("Producer", back_populates="entity")
|
||||
consumers = relationship("Consumer", back_populates="entity")
|
||||
repository = relationship("Repository", uselist=False, back_populates="entity")
|
||||
repository = relationship("Repository", back_populates="entity")
|
||||
|
||||
|
||||
class ProducerAbstract(Base):
|
||||
|
||||
Reference in New Issue
Block a user