diff --git a/backend/app/api/api_v1/routers/platform.py b/backend/app/api/api_v1/routers/platform.py index 0a3e421..f199563 100644 --- a/backend/app/api/api_v1/routers/platform.py +++ b/backend/app/api/api_v1/routers/platform.py @@ -328,7 +328,7 @@ async def event_data( @r.get( - "/eventactions/{eventid}", + "/eventactions", response_model=t.List[Action], response_model_exclude={"id"}, response_model_exclude_none=True, diff --git a/backend/app/db/crud.py b/backend/app/db/crud.py index 9250a54..7d8fc2d 100644 --- a/backend/app/db/crud.py +++ b/backend/app/db/crud.py @@ -280,7 +280,8 @@ def get_events(db: Session): def get_eventactions(db: Session,eventid: str): #eveactions = db.query(models.Action).join(models.EventAction,models.EventAction.actionid == models.Action.id ).join(models.Event,models.Event.id == models.EventAction.eventid).filter(models.Event.eventid == eventid).all() - eveactions = db.query(models.Action).join(models.EventAction,models.EventAction.actionid != models.Action.id and models.EventAction.eventid == eventid ).join(models.Event,models.Event.id == models.EventAction.eventid).filter(models.Event.eventid == eventid).all() + blackactions = db.query(models.Action.id).join(models.EventAction,models.EventAction.actionid == models.Action.id and models.EventAction.eventid == eventid ) + eveactions = db.query(models.Action).filter(models.Action.id.notin_(blackactions)).all() if not eveactions: raise HTTPException(status_code=404, detail="Data not found") return eveactions diff --git a/backend/app/db/models.py b/backend/app/db/models.py index c0876d5..bbc789e 100644 --- a/backend/app/db/models.py +++ b/backend/app/db/models.py @@ -90,7 +90,7 @@ class Event(Base): class EventAction(Base): __tablename__ = "eventaction" - eventid = Column(Integer,ForeignKey("event.id")) + eventid = Column(String(100),ForeignKey("event.eventid")) actionid = Column(Integer,ForeignKey("action.id"))