def to_view(self,club_name ): result = self.db.view(club_name) if bool(result): return result else: try: raise RecordNotFoundException("error가 발생했습니다.") except RecordNotFoundException as error: return str(error)
def get_by_info(self, club_info): result = self.db.select_by_info(club_info) if bool(result): return result else: try: raise RecordNotFoundException(club_info) except RecordNotFoundException as removeError: return str(removeError)
def get_all_entity(self, club_name): result=self.is_exist(club_name) if bool(result): # not bool이 아닌 email이 있다면~ return result else: try: raise RecordNotFoundException(club_name) except RecordNotFoundException as updateError: return str(updateError)
def entity_remove(self,email): result = self.is_exist(email) if bool(result): self.db.delete_community(email) return email+" 삭제 되었습니다." else: try: raise RecordNotFoundException("error") except RecordNotFoundException as removeError: return str(removeError)
def entity_update(self,email, nickname, phonenumber): result=self.is_exist(email) if bool(result): # not bool이 아닌 email이 있다면~ self.db.update_community(email, nickname, phonenumber) return email+"님 수정되었습니다." else: try: raise RecordNotFoundException("error") except RecordNotFoundException as updateError: return str(updateError)
def board_view_all(self, club_name): result = BoardService.db.board_view_manager(club_name) # 클럽명 입력시 있는 클럽이라면 매니저 이메이 포함된 데이터들을 반환한다. if bool(result): return BoardService.db.board_view_all(club_name) else: try: raise RecordNotFoundException(club_name) except RecordNotFoundException as removeError: return str(removeError)
def register(self,board_entity): result = self.is_exist(board_entity.member_email) if bool(result): BoardService.db.insert_text(board_entity) return board_entity.member_email+"님 게시글이 등록되었습니다." else: try: raise RecordNotFoundException(board_entity.member_email) except RecordNotFoundException as removeError: return str(removeError)
def entity_remove(self,manager_email): result = self.is_exist(manager_email) if bool(result): self.db.delete_by_email(manager_email) return manager_email+"매니저님 해당 클럽이 삭제 되었습니다." else: try: raise RecordNotFoundException(manager_email) except RecordNotFoundException as removeError: return str(removeError)
def entity_update(self,club_entity): result=self.is_exist(club_entity.club_name) if bool(result): # not bool이 아닌 email이 있다면~ self.db.update_club(club_entity) return club_entity.club_name+"이 수정되었습니다." else: try: raise RecordNotFoundException(club_entity.club_name) except RecordNotFoundException as updateError: return str(updateError)
def club_list_by_email(self, email): result = self.is_exist(email) if bool(result): result = self.db.view_club_by_e(email) print(result) return result else: try: raise RecordNotFoundException("error") except RecordNotFoundException as error: return str(error)
def login(self,email,password): result = self.is_exist(email) if bool(result): tmp_message = self.db.select_pw(email) message = tmp_message[0] # print(message['password']) if message['password'] == password: return "로그인 성공" else: return "pw 오류" else: try: raise RecordNotFoundException("error") except RecordNotFoundException as error: return str(error)
def board_remove(self,id,email, club_name): # 가입하고 작성한 글이 여러개일 경우 다 날라간다. 해결점 생각해보기 # 속편하게 sql쿼리 날리기로 하였다. # uuid로 id값을 부여하고, 해당 클럽내 title로 uuid를 찾는다. # club테이블에서 club name으로 모든 정보를 가지고 온다. club = ClubService() result = club.is_exist(club_name) print(str(result)) if bool(result): return BoardService.db.delete_board(email,id, club_name) else: try: raise RecordNotFoundException(club_name) except RecordNotFoundException as removeError: return str(removeError)