diff --git a/backend/app/core/config.py b/backend/app/core/config.py index c644f96..24d23ad 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -4,9 +4,10 @@ import base64 PROJECT_NAME = "KintoneAppBuilder" -#SQLALCHEMY_DATABASE_URI = "postgres://maxz64:m@xz1205@alicornkintone.postgres.database.azure.com/postgres" -SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/postgres" +SQLALCHEMY_DATABASE_URI = "postgres://maxz64:m@xz1205@alicornkintone.postgres.database.azure.com/postgres" +#SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/postgres" #SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/unittest" +#SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@ktune-prod-db.postgres.database.azure.com/postgres" API_V1_STR = "/k/v1" API_V1_AUTH_KEY = "X-Cybozu-Authorization" diff --git a/backend/app/db/crud.py b/backend/app/db/crud.py index 70ef451..c26073b 100644 --- a/backend/app/db/crud.py +++ b/backend/app/db/crud.py @@ -281,9 +281,35 @@ def get_events(db: Session): raise HTTPException(status_code=404, detail="Data not found") return events +def get_category(db:Session): + categorys=db.query(models.Category).all() + return categorys + 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() + #category = get_category(db) + blackactions = ( + db.query(models.EventAction.actionid) + .filter(models.EventAction.eventid == eventid) + .subquery() + ) + eveactions = ( + db.query( + models.Action.id, + models.Action.name, + models.Action.title, + models.Action.subtitle, + models.Action.outputpoints, + models.Action.property, + models.Action.categoryid, + models.Action.nosort, + models.Category.categoryname) + .join(models.Category,models.Category.id == models.Action.categoryid) + .filter(models.Action.id.notin_(blackactions)) + .order_by(models.Category.nosort,models.Action.nosort) + .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 ed5bae9..b49b0d3 100644 --- a/backend/app/db/models.py +++ b/backend/app/db/models.py @@ -42,6 +42,8 @@ class Action(Base): subtitle = Column(String(500)) outputpoints = Column(String) property = Column(String) + categoryid = Column(Integer,ForeignKey("category.id")) + nosort = Column(Integer) class Flow(Base): __tablename__ = "flow" @@ -95,7 +97,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")) @@ -115,4 +117,10 @@ class KintoneFormat(Base): typecolumn =Column(Integer) codecolumn =Column(Integer) field = Column(String(5000)) - trueformat = Column(String(10)) \ No newline at end of file + trueformat = Column(String(10)) + +class Category(Base): + __tablename__ = "category" + + categoryname = Column(String(20)) + nosort = Column(Integer) \ No newline at end of file diff --git a/backend/app/db/schemas.py b/backend/app/db/schemas.py index 08beedf..e03eea5 100644 --- a/backend/app/db/schemas.py +++ b/backend/app/db/schemas.py @@ -89,7 +89,9 @@ class Action(BaseModel): subtitle: str = None outputpoints: str = None property: str = None - + categoryid: int = None + nosort: int + categoryname : str =None class Config: orm_mode = True diff --git a/frontend/src/components/ActionSelect.vue b/frontend/src/components/ActionSelect.vue index 5e80ea9..0c351d0 100644 --- a/frontend/src/components/ActionSelect.vue +++ b/frontend/src/components/ActionSelect.vue @@ -3,20 +3,46 @@
- - + + +