Example #1
0
class BleauMassif(Schema):

    __table_name__ = 'massif'

    __order__ = (
        'id',
        'coordinate',
        'name',
        'access',
        'alternative_name',
        'chaos_type',
        'note',
        'parcelles',
        'rdv',
        'secteur',
        'velo',
    )

    id = Field(Integer, primary_key=True, on_json=False)
    coordinate = Field(JsonGeoCoordinate)
    name = Field(String)  # unique=True
    access = Field(String)
    alternative_name = Field(String)
    chaos_type = Field(String)  # BleauChaosType
    note = Field(String)
    parcelles = Field(String)
    rdv = Field(String)
    secteur = Field(String)
    velo = Field(String)

    circuits = RelationShip('BleauCircuit', back_populates='massif')
Example #2
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')
Example #3
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')
Example #4
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')
Example #5
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
Example #6
0
class Author(Schema):

    __table_name__ = 'authors'

    __order__ = (  # Fixme: without => rowid is not @0
        'id',
        'name',
        'birthdate',
        # 'sex',
    )

    id = Field(Integer, primary_key=True)
    # id = Field(String, primary_key=True)
    name = Field(String)
    birthdate = Field(DateTime)
    # sex = Field(Enum(Sex))

    blogs = RelationShip('Blog', order_by='Blog.id',
                         back_populates='author')  # one-to-many RelationShip
Example #7
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')