def read_intents(): """ find list of intents for the agent :return: """ intents = Intent.objects return build_response.sent_json(intents.to_json())
def read_entities(): """ find list of entities :return: """ intents = Entity.objects.only('name','id') return build_response.sent_json(intents.to_json())
def read_entities(): """ find list of entities :return: """ intents = Entity.objects.only('name', 'id') return build_response.sent_json(intents.to_json())
def read_intents(): """ find list of intents for the agent :return: """ data = request.get_json(silent=True) print(data) botId = data.get("botId") intents = Intent.objects(botId=botId) # intents = Intent.objects() return build_response.sent_json(intents.to_json())
def get_vouchers(): ''' For inserting the categories ''' '''plans = [['Free','Free Membership. No Amount Charged', 0], ['Monthly','Monthly Amount will be charges',200], ['Annually','Annully Amount will be charges',1000]] for plan in plans: membershipP = MembershipPlan() membershipP.name = plan[0] membershipP.description = plan[1] membershipP.amount = plan[2] membershipP.save() return build_response.sent_ok() #Get Single Membership MembershipP = MembershipPlan.objects(name='Free').get() print(MembershipP.name) return build_response.sent_ok() ''' membershipPlans = MembershipPlan.objects().order_by('name') ''' if not membershipPlans: return build_response.build_json([]) #return build_response.sent_json(vouchers.to_json()) ''' response_membershipPlans = [] for membershipP in membershipPlans: obj_membershipP = { '_id': str(membershipP.id), 'name': membershipP.name, #'description': membershipP.description, #'amount': membershipP.amount, 'date_created': membershipP.date_created.isoformat(), 'date_modified': membershipP.date_modified.isoformat() } response_membershipPlans.append(obj_membershipP) #return build_response.build_json(response_membershipPlans) return build_response.sent_json(membershipPlans.to_json())
def update_map(): content = request.get_json(silent=True) print(type(content)) print(content) print("--Seats update post hit") #seat_map_new = Seats() #seat_map_new.all_seats = content seat_map_new = Seats() seat_map_new.all_seats = content seat_map_new._id = str(ObjectId()) try: #ret_id = objects.delete() ret_id = seat_map_new.save() except Exception as e: return build_response.build_json("error " + str(e)) print("--Success", seat_map_new._id) return build_response.sent_json((seat_map_new._id))
def get_map(id): print("-----Seat get_map hit for id ", str(id)) full_map = Seats.objects(_id=str(id)) print("full map is", full_map) return build_response.sent_json(full_map.to_json())