def delete(self, uid): social_auth_record = db_session.query(UserSocialAuth).filter( UserSocialAuth.user_id == uid.id).first() db_session.delete(social_auth_record) db_session.delete(uid) return jsonify(success=True)
def delete_donation(): req_data = MultiDict(request.get_json()) cancel_id = req_data.get('cancel_id') record = None if req_data.get('cancel_type') == 'lecture': record = db_session.query(Lecture).filter(Lecture.id == cancel_id).first() elif req_data.get('cancel_type') == 'host': record = db_session.query(SessionHost).filter(SessionHost.id == cancel_id).first() if not record: return jsonify(success=False, message='무엇을 삭제하려 했습니까?') if req_data.get('cancel_type') == 'lecture': vote_books = db_session.query(VoteBooks).filter( VoteBooks.roundtable_id == record.roundtable_id, VoteBooks.lecture_user_id == record.lecture_user_id).first() if vote_books: db_session.delete(vote_books) db_session.delete(record) # 현재 운영중인 회차 정보를 가져와서 참석 여부 레코드를 삭제한다. main_roundtable = db_session.query(Roundtable).filter(Roundtable.is_active == True).first() db_session.query(OTandParty).filter( OTandParty.party_user_id == current_user.id, OTandParty.roundtable_id == main_roundtable.id).delete() return jsonify(success=True)
def post(self, round): req_json = request.get_json() round.roundtable_num = req_json.get('roundtableNum') round.roundtable_year = req_json.get('roundtableYear') round.roundtable_date = req_json.get('roundtableDate') round.staff = req_json.get('staff') worked_lib = [] for entry in round.library: put_library = tuple( filter( lambda sub_entry: entry.library_id == sub_entry.get( 'library').get('id'), req_json.get('library_list'))) if len(put_library) > 0: worked_lib.append(entry.library_id) entry.round_num = put_library[0]['session_time'] entry.library_type = put_library[0]['library_type'] else: # 사용자가 보낸 도서관을 목록에서 찾지 못하면 삭제 대상으로 결정한다. db_session.delete(entry) for item in req_json.get('library_list'): if item.get('library').get('id') in worked_lib: continue lib_info = RoundtableAndLibrary( round_num=item.get('session_time'), library_type=item.get('library_type')) lib_info.library = db_session.query(Library).filter( Library.id == item.get('library').get('id')).first() round.library.append(lib_info) return jsonify(success=True)
def delete(self, host): db_session.query(OTandParty).filter( OTandParty.party_user_id == host.host_user_id, OTandParty.roundtable_id == host.roundtable_id).delete() db_session.delete(host) return jsonify(success=True)
def delete_donation_goods(): req_json = request.get_json() cancel_id = req_json.get('cancel_id') record = DonationGoods.query.filter(DonationGoods.id == cancel_id).first() if record: db_session.delete(record) return jsonify(success=True, msg='삭제되었습니다')
def delete(self, round): # 참여 도서관 정보 삭제 for entry in round.library: db_session.delete(entry) db_session.query(Lecture).filter( Lecture.roundtable_id == round.id).delete() db_session.query(SessionHost).filter( SessionHost.roundtable_id == round.id).delete() db_session.delete(round) return jsonify(success=True)
def delete(self, lecturer): vote_books = db_session.query(VoteBooks).filter( VoteBooks.roundtable_id == lecturer.roundtable_id, VoteBooks.lecture_user_id == lecturer.lecture_user_id).first() if vote_books: db_session.delete(vote_books) db_session.query(OTandParty).filter( OTandParty.party_user_id == lecturer.lecture_user_id, OTandParty.roundtable_id == lecturer.roundtable_id).delete() db_session.delete(lecturer) return jsonify(success=True)
def delete(self, photo): db_session.delete(photo) return jsonify(success=True)
def delete(self, faq): db_session.delete(faq) return jsonify(success=True)
def delete(self, donation): db_session.delete(donation) return jsonify(success=True)
def delete(self, news): db_session.delete(news) return jsonify(success=True)
def delete(self, design): delete_blob(tuple(design.design_files.values())[0]) db_session.delete(design) return jsonify(success=True)
def delete(self, book): db_session.delete(book) return jsonify(success=True)