def get_user_body_entries(self, user_id): bw_query = self.__query_builder.build_select_query( [self.BODY_WEIGHT_TABLE], [], {"user_id": ["user_id", "=", user_id]}) bf_query = self.__query_builder.build_select_query( [self.BODY_FAT_TABLE], [], {"user_id": ["user_id", "=", user_id]}) bw_data = util.to_jsons(self.BODY_WEIGHT_SCHEMA, self.__db.get_data(bw_query)) bf_data = util.to_jsons(self.BODY_FAT_SCHEMA, self.__db.get_data(bf_query)) return {"body_weight_entries": bw_data, "body_fat_entries": bf_data}
def get_user_exercise_entries(self, user_id): query = self.__query_builder.build_select_query( [self.EXERCISE_ENTRY_TABLE], [], {"user_id": ["user_id", "=", user_id]}) data = self.__db.get_data(query) return util.to_jsons(self.EXERCISE_ENTRY_SCHEMA, data)
def get_user_diet_entries(self, user_id): query = self.__query_builder.build_select_query( [self.DIET_TABLE], [], {"user_id": ["user_id", "=", user_id]}) data = self.__db.get_data(query) return util.to_jsons(self.DIET_SCHEMA, data)
def get_user_custom_entries_by_custom_id(self, custom_id): query = self.__query_builder.build_select_query([self.CUSTOM_ENTRY_TABLE], [], {"custom_id": ["custom_id", "=", custom_id]}) data = self.__db.get_data(query) return util.to_jsons(self.CUSTOM_ENTRY_SCHEMA, data)
def get_user_custom_types(self, user_id): query = self.__query_builder.build_select_query([self.CUSTOM_TYPE_TABLE], [], {"user_id": ["user_id", "=", user_id]}) data = self.__db.get_data(query) return util.to_jsons(self.CUSTOM_TYPE_SCHEMA, data)