def get(self, mongoid=None): getRequestArgs = getArgs().parse_args() if mongoid: return Photo.objects(id=mongoid).first().to_json(), 201 else: request_parser = GetAllRequestParser(Photo, getRequestArgs, None, None) # parse arguments and return result return request_parser.run()
def get_all(self, get_args): """ :param get_args: list :return: dict """ self.logger.debug('*** {}.get_all method fired with args: {}'.format( self.__class__.__name__, str(get_args))) # Instantiate GetAllRequestParsef for Company class with get_args request_parser = GetAllRequestParser(Location, get_args, None, None) # parse arguments and return result return request_parser.run() pass
def get_one(self, mongoid, get_args=None): """ :param mongoid: string :param get_args: dict | optional. Default = None :return: dict """ # add mongo id as get_args params for querying get_args.update({"fname": "id", "fval": mongoid}) # Instantiate GetAllRequestParsef for Company class with get_args request_parser = GetAllRequestParser(Location, get_args, None, None) # parse arguments and return result return request_parser.run()
def get(self, mongoid=None): get_args = getArgs() get_args.add_argument( 'advanced_message_query', type=str, help= 'Şirketin sadece ilişkili dosyalara erişim sağlama kontrollerini hazırlar' ) getRequestArgs = get_args.parse_args() if mongoid: return Message.objects(id=mongoid).first().to_json(), 201 else: request_parser = GetAllRequestParser(Message, getRequestArgs, None, None) # parse arguments and return result return request_parser.run()
def get(self, mongoId: object = None) -> object: app.logger.debug("***message fired as GET request") if mongoId is None: getMessageArgs = getArgs().parse_args() if getMessageArgs.get('nin', None) is not None and getMessageArgs.get( 'ninfname', None) is None: app.logger.debug("***getMessages nin param : " + str(getMessageArgs['nin'])) ninArray = getMessageArgs['nin'].split(",") tempArray = [] for arrayel in ninArray: if arrayel != "": tempArray.append(int(arrayel)) if len(ninArray) > 0: app.logger.debug("***nin" + str(ninArray)) result = Notification.objects( (Q(reads_by__not=re.compile(current_user.id)) & Q(message_no__nin=tempArray))).only( "message", "message_no")[:10].order_by("-created_date") #result = mongo.db.message.find( {"$and":[{"reads_by":{"$not": re.compile(current_user.id)}},{"message_no":{"$nin":tempArray}}]}, #{"message": 1, "message_no": 1}).limit(10).sort([("created_at",-1)]) else: app.logger.debug("***not nin") result = Notification.objects( reads_by__not=re.compile(current_user.id)).only( "message", "id")[:10].order_by("-created_date") resultDumps = dumps(result) app.logger.debug("***resultDump: " + resultDumps) return resultDumps else: request_parser = GetAllRequestParser(Notification, getMessageArgs, None, None) # parse arguments and return result return request_parser.run() else: return Notification.objects( id=helper.stringIdToObjectId(mongoId)).first()
def get(self, mongoid=None): get_args = getArgs() get_args.add_argument( "loadPreSurvey", default=1, type=int, help="Ön ekspertiz verileri yüklensin mi? 0 ve 1 değerlerini alır") get_args.add_argument( "loadPreSurveyDetails", default=1, type=int, help= "Ön ekspertiz işçilik ve yedek parça verileri yüklensin mi? 0 ve 1 değerlerini alır" ) getRequestArgs = get_args.parse_args() if mongoid: return Location.objects(id=mongoid).first().to_json(), 200 else: request_parser = GetAllRequestParser(Location, getRequestArgs, None, None) # parse arguments and return result result = request_parser.run() return result