Esempio n. 1
0
class Message(Node):
    title = String()
    body = String()
    sender = GQField(
        'Person',
        GraphQuery(
            'personGraph',
            direction='INBOUND'
        ).f('e._id').like('created/%')
    )
    attachments = GQList(
        'Media',
        query=GraphQuery(
            'personGraph',
            direction='INBOUND'
        )
    )

    class Config:
        indexes = (Index('title'), Index('body', type='fulltext'))

    @classmethod
    async def create(cls, _, info, **data):
        print('create message')
        pprint(data)
        return cls(**data)
Esempio n. 2
0
class ToDo(Node):
    title = String()
    creator = GQField(
        'Person',
        GraphQuery(
            'personGraph',
            direction='INBOUND',
        ).f('e._id').like('created/%')
    )
Esempio n. 3
0
class Department(Node):
    title = String()
    description = String()
    infos = GQList(
        'Info',
        query=GraphQuery(
            'personGraph',
            direction='INBOUND'
        )
    )
    employees = GQList(
        'Person',
        query=GraphQuery(
            'personGraph',
            direction='INBOUND'
        )
    )

    class Config:
        indexes = (Index('title'),)
Esempio n. 4
0
class Person(Node):
    name = String()
    email = Email()
    birthday = Date()
    employer = GQField(
        'Department',
        GraphQuery(
            'personGraph',
            direction='OUTBOUND',
            ret='{"node": v, "status":e.status}'
        ),
        extra={'status': String()}
    )
    friends = GQList(
        'Person',
        GraphQuery(
            'personGraph',
            ret=('{"node": v,'
                 ' "id": e._id, '
                 ' "status": e.status, '
                 ' "since": e._created, '
                 ' "pId": startVertexId'
                 '}')
        ),
        extra={
            'id': ID(),
            'status': String(),
            'since': String(),
            'pId': String()
        }
    )
    messages = GQList(
        'Message',
        GraphQuery(
            'personGraph',
            direction='INBOUND'
        ).f('e._id').like('received/%')
    )

    class Config:
        indexes = (Index('email'),)
Esempio n. 5
0
class Group(Node):
    title = String()
    description = String()
    members = GQList(
        'Person',
        query=GraphQuery(
            'personGraph',
            direction='INBOUND'
        )
    )
    class Config:
        indexes = (Index('title'),)
Esempio n. 6
0
class Info(Node):
    title = String()
    body = String()
    infos = GQList(
        'Info',
        GraphQuery(
            'personGraph',
            direction='INBOUND'
        ).f('e._id').like('belongs_to/%')
    )

    class Config:
        indexes = (Index('title'),)
Esempio n. 7
0
class Concert(Node):
    date = Date()
    status = Field(ConcertStatus, default_value=ConcertStatus.NULL)
    venue = GQField(
        'Venue',
        GraphQuery(
            'personGraph',
            direction='INBOUND'
        )
    )

    class Config:
        indexes = (Index('date', unique=False),)
Esempio n. 8
0
class Venue(Node):
    name = String()
    city = String()
    zip_code = String()
    street = String()
    concerts = GQList(
        'Concert',
    query=GraphQuery(
        'personGraph',
        direction='INBOUND'
    ))

    class Config:
        indexes = (Index('name', unique=False), Index('city', unique=False))