修复create_local_app里面team的问题
This commit is contained in:
parent
9c23d4bbfe
commit
37a045cdf3
@ -149,30 +149,27 @@ def create_local_app(app_data):
|
|||||||
import json
|
import json
|
||||||
app_data = json.loads(app_data)
|
app_data = json.loads(app_data)
|
||||||
|
|
||||||
# 检查应用是否已存在
|
# 检查应用名称是否已存在
|
||||||
if jingrow.db.exists("Local App", app_data["name"]):
|
existing_app = jingrow.db.exists("Local App", {"app_name": app_data["app_name"]})
|
||||||
jingrow.throw("Local App already exists")
|
if existing_app:
|
||||||
|
return {"error": "应用名称已存在,请使用其他名称"}
|
||||||
|
|
||||||
# 创建应用
|
# 创建应用
|
||||||
app = jingrow.get_pg({
|
app = jingrow.get_pg({
|
||||||
"pagetype": "Local App",
|
"pagetype": "Local App",
|
||||||
"name": app_data["name"],
|
|
||||||
"app_name": app_data["app_name"],
|
"app_name": app_data["app_name"],
|
||||||
"title": app_data["title"],
|
"title": app_data["title"],
|
||||||
"subtitle": app_data.get("subtitle", ""),
|
"subtitle": app_data.get("subtitle", ""),
|
||||||
"description": app_data.get("description", ""),
|
"description": app_data.get("description", ""),
|
||||||
"category": app_data.get("category"),
|
"category": app_data.get("category"),
|
||||||
"team": team.name,
|
"team": team,
|
||||||
"enabled": app_data.get("enabled", 1),
|
|
||||||
"public": app_data.get("public", 1),
|
|
||||||
"status": app_data.get("status", "Draft"),
|
|
||||||
"repository_url": app_data.get("repository_url"),
|
"repository_url": app_data.get("repository_url"),
|
||||||
"file_url": app_data.get("file_url"),
|
"file_url": app_data.get("file_url"),
|
||||||
"app_image": app_data.get("app_image")
|
"app_image": app_data.get("app_image")
|
||||||
})
|
})
|
||||||
|
|
||||||
app.insert()
|
app.insert()
|
||||||
return app.name
|
return {"success": True, "name": app.name, "message": "应用创建成功"}
|
||||||
|
|
||||||
|
|
||||||
@dashboard_whitelist()
|
@dashboard_whitelist()
|
||||||
@ -210,6 +207,14 @@ def delete_local_app(name):
|
|||||||
return "Local App deleted successfully"
|
return "Local App deleted successfully"
|
||||||
|
|
||||||
|
|
||||||
|
@jingrow.whitelist(allow_guest=True)
|
||||||
|
def get_local_app_meta():
|
||||||
|
"""获取 Local App 元数据信息"""
|
||||||
|
|
||||||
|
meta = jingrow.get_meta("Local App")
|
||||||
|
return meta.as_dict()
|
||||||
|
|
||||||
|
|
||||||
@jingrow.whitelist(allow_guest=True)
|
@jingrow.whitelist(allow_guest=True)
|
||||||
def get_local_app_categories():
|
def get_local_app_categories():
|
||||||
"""获取本地应用分类列表"""
|
"""获取本地应用分类列表"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user