Merge branch 'mvp_step2_dev' of https://dev.azure.com/alicorn-dev/KintoneAppBuilder/_git/KintoneAppBuilder into mvp_step2_dev
This commit is contained in:
@@ -103,9 +103,11 @@ async def flow_details(
|
|||||||
async def flow_list(
|
async def flow_list(
|
||||||
request: Request,
|
request: Request,
|
||||||
appid: str,
|
appid: str,
|
||||||
|
user=Depends(get_current_user),
|
||||||
db=Depends(get_db),
|
db=Depends(get_db),
|
||||||
):
|
):
|
||||||
flows = get_flows_by_app(db, appid)
|
domain = get_activedomain(db, user.id)
|
||||||
|
flows = get_flows_by_app(db, domain.id, appid)
|
||||||
return flows
|
return flows
|
||||||
|
|
||||||
|
|
||||||
@@ -113,9 +115,11 @@ async def flow_list(
|
|||||||
async def flow_create(
|
async def flow_create(
|
||||||
request: Request,
|
request: Request,
|
||||||
flow: FlowBase,
|
flow: FlowBase,
|
||||||
|
user=Depends(get_current_user),
|
||||||
db=Depends(get_db),
|
db=Depends(get_db),
|
||||||
):
|
):
|
||||||
return create_flow(db, flow)
|
domain = get_activedomain(db, user.id)
|
||||||
|
return create_flow(db, domain.id, flow)
|
||||||
|
|
||||||
|
|
||||||
@r.put(
|
@r.put(
|
||||||
|
|||||||
@@ -125,11 +125,12 @@ def get_actions(db: Session):
|
|||||||
return actions
|
return actions
|
||||||
|
|
||||||
|
|
||||||
def create_flow(db: Session, flow: schemas.FlowBase):
|
def create_flow(db: Session, domainid: int, flow: schemas.FlowBase):
|
||||||
db_flow = models.Flow(
|
db_flow = models.Flow(
|
||||||
flowid=flow.flowid,
|
flowid=flow.flowid,
|
||||||
appid=flow.appid,
|
appid=flow.appid,
|
||||||
eventid=flow.eventid,
|
eventid=flow.eventid,
|
||||||
|
domainid=domainid,
|
||||||
name=flow.name,
|
name=flow.name,
|
||||||
content=flow.content
|
content=flow.content
|
||||||
)
|
)
|
||||||
@@ -176,8 +177,8 @@ def get_flow(db: Session, flowid: str):
|
|||||||
raise HTTPException(status_code=404, detail="Data not found")
|
raise HTTPException(status_code=404, detail="Data not found")
|
||||||
return flow
|
return flow
|
||||||
|
|
||||||
def get_flows_by_app(db: Session, appid: str):
|
def get_flows_by_app(db: Session, domainid: int, appid: str):
|
||||||
flows = db.query(models.Flow).filter(models.Flow.appid == appid).all()
|
flows = db.query(models.Flow).filter(and_(models.Flow.domainid == domainid,models.Flow.appid == appid)).all()
|
||||||
if not flows:
|
if not flows:
|
||||||
raise HTTPException(status_code=404, detail="Data not found")
|
raise HTTPException(status_code=404, detail="Data not found")
|
||||||
return flows
|
return flows
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Flow(Base):
|
|||||||
flowid = Column(String(100), index=True, nullable=False)
|
flowid = Column(String(100), index=True, nullable=False)
|
||||||
appid = Column(String(100), index=True, nullable=False)
|
appid = Column(String(100), index=True, nullable=False)
|
||||||
eventid = Column(String(100), index=True, nullable=False)
|
eventid = Column(String(100), index=True, nullable=False)
|
||||||
|
domainid = Column(Integer,ForeignKey("domain.id"))
|
||||||
name = Column(String(200))
|
name = Column(String(200))
|
||||||
content = Column(String)
|
content = Column(String)
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ class Flow(Base):
|
|||||||
flowid: str
|
flowid: str
|
||||||
appid: str
|
appid: str
|
||||||
eventid: str
|
eventid: str
|
||||||
|
domainid: int
|
||||||
name: str = None
|
name: str = None
|
||||||
content: str = None
|
content: str = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user