删除恢复功能
This commit is contained in:
@@ -69,12 +69,19 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
"""
|
||||
创建思维导图
|
||||
"""
|
||||
coop_mind_name = request.data.get('mind_name')
|
||||
user = request.user
|
||||
data_format = 'node_tree'
|
||||
mind = CooperationMind(coop_mind_name=coop_mind_name, client_uuid='', mind_log_id=-1, creator_user_id=user.id, snapshot_data=SNAPSHOT_JSON_DATA, data_format=data_format)
|
||||
mind.save()
|
||||
return build_response(data=mind.id)
|
||||
coop_mind_name = request.data.get('mind_name')
|
||||
coop_mind_id = request.data.get('coop_mind_id')
|
||||
op_type = request.data.get('op_type')
|
||||
if op_type == "delete_cancel":
|
||||
CooperationMind.objects.filter(id=coop_mind_id, creator_user_id=user.id).update(deleted=False)
|
||||
return build_response()
|
||||
else:
|
||||
user = request.user
|
||||
data_format = 'node_tree'
|
||||
mind = CooperationMind(coop_mind_name=coop_mind_name, client_uuid='', mind_log_id=-1, creator_user_id=user.id, snapshot_data=SNAPSHOT_JSON_DATA, data_format=data_format)
|
||||
mind.save()
|
||||
return build_response(data=mind.id)
|
||||
|
||||
def delete(self, request):
|
||||
# 删除
|
||||
@@ -219,8 +226,6 @@ class JsMindStarView(LoginRequiredJSONMixin, ListAPIView):
|
||||
post_body = request.POST
|
||||
# 思维导图id
|
||||
coop_mind_id = post_body.get('coop_mind_id')
|
||||
# 操作类型
|
||||
op_type = post_body.get('op_type')
|
||||
if coop_mind_id is None:
|
||||
return build_response(CODE_FAILED, msg="参数错误")
|
||||
|
||||
@@ -233,3 +238,14 @@ class JsMindStarView(LoginRequiredJSONMixin, ListAPIView):
|
||||
star = CooperationMindStar(operator_user_id=user.id, coop_mind_id=coop_mind_id, coop_mind_name=mind.coop_mind_name)
|
||||
star.save()
|
||||
return build_response()
|
||||
|
||||
def delete(self, request):
|
||||
"""
|
||||
取消收藏
|
||||
"""
|
||||
print('dlete')
|
||||
post_body = request.POST
|
||||
user = request.user
|
||||
coop_mind_id = post_body.get('coop_mind_id')
|
||||
CooperationMindStar.objects.filter(operator_user_id=user.id, coop_mind_id=coop_mind_id).delete()
|
||||
return build_response()
|
||||
|
||||
Reference in New Issue
Block a user