예제 #1
0
    def task(self, id=None):
        query = cherrypy.request.db.query(Task, Point).join(Point)
        if id is not None:
            query = query.filter(Task.id == id)

        columns = ["id", "point_id", "status","center_lat",
                   "center_lng", "radius", "img_uri"]

        ret = [as_dict(x, columns) for x in query.all()]
        return ret
예제 #2
0
파일: service.py 프로젝트: o0neup/hackaym
    def list_transactions(self, username=None, chat_id=None, limit=10):
        if username is None and chat_id is None:
            raise ValueError("At least one of the following should not be null: username, chat_id")

        query = self.session.query(Transaction, Chat).filter(Transaction.chat_id == Chat.id).order_by(Transaction.date.desc())

        if username is not None:
            query = query.filter(or_(Transaction.from_acc_id == username, Transaction.to_acc_id == username))

        if chat_id is not None:
            query = query.filter(Transaction.chat_id == chat_id)

        result = query.limit(limit).all()
        return [as_dict(x, columns=["name", "description", "date", "from_acc_id", "to_acc_id"]) for x in result]
예제 #3
0
 def get_exposed_pos(self):
     positions = cherrypy.request.db.query(MrXPos).filter(MrXPos.exposed == True).all()
     return [as_dict(x) for x in positions]