def create_or_update_interests(self, interests_ids): self.interests = [] objs = [Interest.get_by_id(i) for i in interests_ids] self.interests.extend(objs) db.session.commit()
def get_all_interests() -> InterestsListDTO: return Interest.get_all_interests()
def get_by_name(name): interest = Interest.get_by_name(name) return interest
def create(interest_name): interest_model = Interest(name=interest_name) interest_model.create() return interest_model.as_dto()
def get_by_id(interest_id): interest = Interest.get_by_id(interest_id) return interest