예제 #1
0
class Comment(Schema):

    __table_name__ = 'comments'

    __order__ = (
        'id',
        'text',
        'date',
        'blog_id',
    )

    id = Field(Integer, primary_key=True)
    text = Field(String)
    date = Field(DateTime)
    blog_id = Field(Integer, ForeignKey('blogs.id'))
예제 #2
0
class Directory(Schema):

    __table_name__ = 'directory'

    __order__ = (
        'id',
        'name',
        'parent',
    )

    id = Field(Integer, primary_key=True)
    name = Field(String)
    parent = Field(Integer, ForeignKey('directory.id'))

    keys = RelationShip('Key', order_by='Key.name', back_populates='directory')
예제 #3
0
class Key(Schema):

    __table_name__ = 'key'

    __order__ = (
        'id',
        'name',
        'directory_id',
        'value',
    )

    id = Field(Integer, primary_key=True)
    name = Field(String)  # pk ???
    directory_id = Field(Integer, ForeignKey('directory.id'))
    value = Field(Variant)

    directory = RelationShip('Directory', back_populates='keys')
예제 #4
0
class Blog(Schema):

    __table_name__ = 'blogs'

    __order__ = (
        'id',
        'text',
        'date',
        'author_id',
    )

    id = Field(Integer, primary_key=True)
    text = Field(String)
    date = Field(DateTime)
    author_id = Field(Integer, ForeignKey('authors.id'))

    author = RelationShip('Author',
                          back_populates='blogs')  # many-to-one RelationShip
예제 #5
0
class BleauCircuit(Schema):

    __table_name__ = 'circuit'

    __order__ = (
        'id',
        'coordinate',
        'colour',
        'creation_date',
        'gestion',
        'grade',
        'massif_id',
        'note',
        'number',
        'opener',
        'refection_date',
        'refection_note',
        'status',
        'topos',
    )

    id = Field(Integer, primary_key=True, on_json=False)
    coordinate = Field(JsonGeoCoordinate)
    colour = Field(String)
    creation_date = Field(Integer)  # UnsignedInteger
    gestion = Field(String)
    grade = Field(String)  # BleauAlpineGrade
    massif_id = Field(
        Integer, ForeignKey('massif.id'),
        on_json=False)  # Fixme: JSON massif/string vs massif_id/int
    note = Field(String)
    number = Field(Integer)  # UnsignedInteger
    opener = Field(String)  # BleauOpeners
    refection_date = Field(Integer)  # UnsignedInteger
    refection_note = Field(String)  # BleauRefectionNote
    status = Field(String)
    topos = Field(StringList)

    massif = RelationShip(BleauMassif, back_populates='circuits')
    boulders = RelationShip(BleauBoulder, back_populates='circuit')
예제 #6
0
class BleauBoulder(Schema):

    __table_name__ = 'boulder'

    __order__ = (
        'id',
        'coordinate',
        'name',
        'comment',
        'grade',
        'number',
        'circuit_id',
    )

    id = Field(Integer, primary_key=True, on_json=False)
    coordinate = Field(JsonGeoCoordinate)
    name = Field(String)
    comment = Field(String)
    grade = Field(String)  # BleauGrade
    number = Field(String)  # BleauWayNumber

    circuit_id = Field(Integer, ForeignKey('circuit.id'), on_json=False)
    circuit = RelationShip('BleauCircuit', back_populates='boulders')