Esempio n. 1
0
class Order(db.Model):
    __tablename__ = 'Order'
    id = db.Column(db.Integer(), primary_key=True)
    petId = db.Column(db.Integer, db.ForeignKey('Pet.id'), nullable=False)
    quantity = db.Column(db.Integer, nullable=False)
    shipDate = db.Column(db.String(120), nullable=False)
    status = db.Column(db.String(120), nullable=False)
    complete = db.Column(db.Boolean, nullable=False)
    pet = relationship("Pet", back_populates="order")
Esempio n. 2
0
class User(db.Model):
    __tablename__ = 'User'
    id = db.Column(db.Integer(), primary_key=True)
    username = db.Column(db.String(120), nullable=False)
    firstName = db.Column(db.String(120), nullable=False)
    lastName = db.Column(db.String(120), nullable=False)
    email = db.Column(db.String(120), nullable=False)
    password = db.Column(db.String(120), nullable=False)
    phone = db.Column(db.String(120), nullable=False)
    userStatus = db.Column(db.Integer, nullable=False)
Esempio n. 3
0
class Pet(db.Model):
    __tablename__ = 'Pet'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(120), nullable=False)
    category = relationship('Category',
                            backref="Pet",
                            secondary=Pet_Order,
                            lazy=True)
    photoUrls = db.Column(db.String(120), nullable=False)
    tags = relationship('Tag', backref='Pet', secondary=Pet_Tag, lazy=True)
    status = db.Column(db.String(120), nullable=False)
    #  Order = db.relationship('Order', back_populates='Pet', lazy=True)
    order = relationship("Order",
                         back_populates="pet",
                         lazy='dynamic',
                         primaryjoin="Pet.id == Order.petId")
Esempio n. 4
0
class Tag(db.Model):
    __tablename__ = 'Tag'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(120), nullable=False)