|
|
|
|
@ -56,8 +56,7 @@ class InsertExploreAppListApi(Resource):
|
|
|
|
|
parser.add_argument("position", type=int, required=True, nullable=False, location="json")
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
with Session(db.engine) as session:
|
|
|
|
|
app = session.execute(select(App).filter(App.id == args["app_id"])).scalar_one_or_none()
|
|
|
|
|
app = db.session.execute(select(App).filter(App.id == args["app_id"])).scalar_one_or_none()
|
|
|
|
|
if not app:
|
|
|
|
|
raise NotFound(f"App '{args['app_id']}' is not found")
|
|
|
|
|
|
|
|
|
|
@ -78,38 +77,38 @@ class InsertExploreAppListApi(Resource):
|
|
|
|
|
select(RecommendedApp).filter(RecommendedApp.app_id == args["app_id"])
|
|
|
|
|
).scalar_one_or_none()
|
|
|
|
|
|
|
|
|
|
if not recommended_app:
|
|
|
|
|
recommended_app = RecommendedApp(
|
|
|
|
|
app_id=app.id,
|
|
|
|
|
description=desc,
|
|
|
|
|
copyright=copy_right,
|
|
|
|
|
privacy_policy=privacy_policy,
|
|
|
|
|
custom_disclaimer=custom_disclaimer,
|
|
|
|
|
language=args["language"],
|
|
|
|
|
category=args["category"],
|
|
|
|
|
position=args["position"],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
db.session.add(recommended_app)
|
|
|
|
|
|
|
|
|
|
app.is_public = True
|
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
|
|
return {"result": "success"}, 201
|
|
|
|
|
else:
|
|
|
|
|
recommended_app.description = desc
|
|
|
|
|
recommended_app.copyright = copy_right
|
|
|
|
|
recommended_app.privacy_policy = privacy_policy
|
|
|
|
|
recommended_app.custom_disclaimer = custom_disclaimer
|
|
|
|
|
recommended_app.language = args["language"]
|
|
|
|
|
recommended_app.category = args["category"]
|
|
|
|
|
recommended_app.position = args["position"]
|
|
|
|
|
if not recommended_app:
|
|
|
|
|
recommended_app = RecommendedApp(
|
|
|
|
|
app_id=app.id,
|
|
|
|
|
description=desc,
|
|
|
|
|
copyright=copy_right,
|
|
|
|
|
privacy_policy=privacy_policy,
|
|
|
|
|
custom_disclaimer=custom_disclaimer,
|
|
|
|
|
language=args["language"],
|
|
|
|
|
category=args["category"],
|
|
|
|
|
position=args["position"],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
db.session.add(recommended_app)
|
|
|
|
|
|
|
|
|
|
app.is_public = True
|
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
|
|
return {"result": "success"}, 201
|
|
|
|
|
else:
|
|
|
|
|
recommended_app.description = desc
|
|
|
|
|
recommended_app.copyright = copy_right
|
|
|
|
|
recommended_app.privacy_policy = privacy_policy
|
|
|
|
|
recommended_app.custom_disclaimer = custom_disclaimer
|
|
|
|
|
recommended_app.language = args["language"]
|
|
|
|
|
recommended_app.category = args["category"]
|
|
|
|
|
recommended_app.position = args["position"]
|
|
|
|
|
|
|
|
|
|
app.is_public = True
|
|
|
|
|
app.is_public = True
|
|
|
|
|
|
|
|
|
|
db.session.commit()
|
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
|
|
return {"result": "success"}, 200
|
|
|
|
|
return {"result": "success"}, 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InsertExploreAppApi(Resource):
|
|
|
|
|
|