Ejemplo n.º 1
0
class House(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)

    beds = db.Column(db.Integer, default=0)
    baths = db.Column(db.Float, default=0)
    area = db.Column(db.Integer, default=0)

    price = db.Column(db.DECIMAL(10, 2))

    position = db.Column(db.String, default="")
    img = db.Column(db.String(15), default="")

    latitude = db.Column(db.DECIMAL(20, 10))
    longitude = db.Column(db.DECIMAL(20, 10))

    status = db.Column(db.Enum(
        'Auction', 'Condo for sale', 'Lot / Land for sale', 'Foreclosure',
        'Home for sale', 'Townhouse for sale', 'House for sale', 'Active',
        'Coming soon', 'Multi-family home for sale', 'New construction',
        'Under Contract', 'For sale by owner'),
                       default='Home for sale')

    broker_name = db.Column(db.String(128), default="")

    pub_time = db.Column(db.DateTime)
    owner = db.Column(db.Integer, default=0)

    def __repr__(self):
        return f"{self.beds} BDS,{self.baths} BA,{self.area} Sqft,{self.status}"

    def __str__(self):
        return f"{self.beds} BDS,{self.baths} BA,{self.area} Sqft,{self.status}"
Ejemplo n.º 2
0
class User(db.Model):
    id=db.Column(db.Integer,primary_key=True,autoincrement=True)
    username=db.Column(db.String(64))
    passwordHash=db.Column(db.String(64))
    user_level=db.Column(db.Integer)
    email=db.Column(db.String,default="no email")
    dateOfBirth=db.Column(db.String,default="unknown birthday")
    isMale=db.Column(db.Boolean,default=True)

    pet=db.relationship('Pets',backref="pet_owner",lazy="dynamic")
    doctorInfo=db.relationship("Doctors",backref="doctor_user",lazy="dynamic")

    def __repr__(self):
        return "id : "+str(self.id)+" name : "+self.username+" email : "+self.email+" birthday : "+self.dateOfBirth+" male : "+str(self.isMale) +" level : "+str(self.user_level)+"\n"
Ejemplo n.º 3
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(64))
    passwordHash = db.Column(db.String(64))
    user_level = db.Column(db.Integer, default=0)
    email = db.Column(db.String, default="no email")
    dateOfBirth = db.Column(db.String, default="unknown birthday")
    isMale = db.Column(db.Boolean, default=True)

    def __repr__(self):
        return "id : " + str(
            self.id
        ) + " name : " + self.username + " email : " + self.email + " birthday : " + self.dateOfBirth + " male : " + str(
            self.isMale) + " level : " + str(self.user_level) + "\n"
Ejemplo n.º 4
0
class Pets(db.Model):
    id=db.Column(db.Integer,primary_key=True,autoincrement=True)
    petsname=db.Column(db.String(64))
    owner=db.Column(db.Integer,db.ForeignKey('user.id'))
    health=db.Column(db.Integer,default=-1)
    birthDay=db.Column(db.String,default="unknown birthday")
    appoinment=db.relationship('Appoinments',backref="appoint_pet",lazy="dynamic")
    def __repr__(self):
        return "id : "+str(self.id)+" pet name : "+self.petsname+" owner : "+str(self.owner)+" health : "+str(self.health)+" birthday : "+self.birthDay +"\n"
Ejemplo n.º 5
0
class Doctors(db.Model):
    id=db.Column(db.Integer,primary_key=True,autoincrement=True)
    userId=db.Column(db.Integer,db.ForeignKey("user.id"))
    doctorname=db.Column(db.String(64))
    age=db.Column(db.Integer)
    telphone=db.Column(db.String)
    introduction=db.Column(db.String)
    appoinment=db.relationship('Appoinments',backref="appoint_doctor",lazy="dynamic")
    def formatCode(self,format):
        return str(self.id)+format+self.doctorname+format+str(self.age)+format+self.telphone+format+self.introduction

    def __repr__(self):
        return "id : "+str(self.id)+" doctor name : "+self.doctorname+" age : "+str(self.age)+" telphone : "+self.telphone+" introduction : "+self.introduction +"\n"
Ejemplo n.º 6
0
class Pets(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    petsname = db.Column(db.String(64))
    owner = db.Column(db.Integer, db.ForeignKey('user.id'))
    #这个health属性改为描述目前宠物的处理! 只能员工操作!
    #['Surgery date confirmed', 'Surgery Completed', 'Ready for Release', 'Wait for Surgery'] 0 1 2 3
    health = db.Column(db.Integer, default=-1)
    birthDay = db.Column(db.String, default="unknown birthday")
    appoinment = db.relationship('Appointments',
                                 backref="appoint_pet",
                                 lazy="dynamic")

    def __repr__(self):
        return "id : " + str(
            self.id) + " pet name : " + self.petsname + " owner : " + str(
                self.owner) + " health : " + str(
                    self.health) + " birthday : " + self.birthDay + "\n"
Ejemplo n.º 7
0
class Doctors(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    userId = db.Column(db.Integer)
    doctorname = db.Column(db.String(64))
    age = db.Column(db.Integer)
    telphone = db.Column(db.String)
    introduction = db.Column(db.String)

    def formatCode(self, format):
        return str(self.id) + format + self.doctorname + format + str(
            self.age) + format + self.telphone + format + self.introduction

    def __repr__(self):
        return "id : " + str(
            self.id
        ) + " doctor name : " + self.doctorname + " age : " + str(
            self.age
        ) + " telphone : " + self.telphone + " introduction : " + self.introduction + "\n"
Ejemplo n.º 8
0
class Pets(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    petsname = db.Column(db.String(64))
    owner = db.Column(db.Integer)
    health = db.Column(db.Integer, default=-1)
    birthDay = db.Column(db.String, default="unknown birthday")

    def formatCode(self, format):
        return str(
            self.id
        ) + format + self.petsname + format + self.birthDay + format + str(
            self.health)

    def __repr__(self):
        return "id : " + str(
            self.id) + " pet name : " + self.petsname + " owner : " + str(
                self.owner) + " health : " + str(
                    self.health) + " birthday : " + self.birthDay + "\n"