Пример #1
0
def DeleteInvite(current_user, user_type, invite_id):

    invite_check_dao = InviteDao()

    if invite_check_dao.CanEditOrDelete(current_user, invite_id):

        invite_dao = InviteDao()

        if invite_dao.DeclineInvite(invite_id):
            return ResponseHelper.ReturnOkResponse("Invite Declined")

        else:
            return ResponseHelper.ReturnConflictResponse(
                "Unable to Decline Invite!")

    else:

        return ResponseHelper.ReturnBadRequestResponse()
Пример #2
0
def UpdateSingleInvite(current_user, user_type, invite_id):
    invite_check_dao = InviteDao()

    if invite_check_dao.CanEditOrDelete(current_user, invite_id):

        if not request.data:
            return ResponseHelper.ReturnBadRequestResponse()

        else:
            request_data = json.loads(request.data)

            update_data = UpdateData(
                request_data[RequestConstants.UPDATE_REQUEST_MEMBER_KEYS],
                request_data[RequestConstants.UPDATE_REQUEST_MEMBER_VALUES],
                [InvitesTable.ID], [invite_id])

            if InvitesTable.ID in update_data.memberKeys:

                return ResponseHelper.ReturnBadRequestResponse()

            if InvitesTable.SENT_BY in update_data.memberKeys:
                return ResponseHelper.ReturnBadRequestResponse()

            if InvitesTable.SENT_TO in update_data.memberKeys:
                return ResponseHelper.ReturnBadRequestResponse()

            invite_dao = InviteDao()

            if invite_dao.UpdateSingleInvite(update_data):
                return ResponseHelper.ReturnOkResponse("Invite Updated")

            else:
                return ResponseHelper.ReturnConflictResponse(
                    "Unable to Update Invite!")

    else:

        return ResponseHelper.ReturnBadRequestResponse()