Ejemplo n.º 1
0
class Role(db.Model):
    IdRole = db.Column(db.Integer, primary_key=True)
    Role = db.Column(db.String(250), nullable=False)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f"Role('{self.IdRole}','{self.Role},'{self.CreatedAt}')"
Ejemplo n.º 2
0
class OrderStatus(db.Model):
    IdOrderStatus = db.Column(db.Integer, primary_key=True)
    OrderStatus = db.Column(db.String(250), nullable=False)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f"OrderStatus('{self.IdOrderStatus}','{self.OrderStatus}','{self.CreatedAt}')"
Ejemplo n.º 3
0
class Time(db.Model):
    IdTime = db.Column(db.Integer, primary_key=True)
    TimeDec = db.Column(db.String(250), nullable=False)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f"Time('{self.IdTime}','{self.TimeDec }','{self.CreatedAt}')"
Ejemplo n.º 4
0
class Situation(db.Model):
    IdSituation = db.Column(db.Integer, primary_key=True)
    Situation = db.Column(db.String(250), nullable=False)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f"Situation('{self.IdSituation}','{self.Situation}','{self.CreatedAt}')"
Ejemplo n.º 5
0
class Priority(db.Model):
    IdPriority = db.Column(db.Integer, primary_key=True)
    PriorityName = db.Column(db.String(250), nullable=False)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f"Priority('{self.IdPriority}','{self.PriorityName}','{self.CreatedAt}')"
Ejemplo n.º 6
0
class Images(db.Model):
    __tablename__ = "images"
    id = db.Column(db.Integer, primary_key = True)
    image = db.Column(db.String, nullable = False, default = 'default.jpg')
    uploader_id = db.Column(db.Integer, db.ForeignKey('uploader.id'), nullable = False)

    def __repr__(self):
        return '<Images %r>' %(self.id)
Ejemplo n.º 7
0
class ExtraService(db.Model):
    IdService = db.Column(db.Integer, primary_key=True)
    Name = db.Column(db.String(250), nullable=False)
    Price = db.Column(db.String(250), nullable=False)
    Enabled = db.Column(db.Integer, db.ForeignKey('situation.IdSituation'))
    CreatedAt = db.Column(db.DateTime, nullable=False)
    situation = db.relationship('Situation', backref='ExtraService')

    def __repr__(self):
        return f"ExtraService('{self.IdService}','{self.Name},'{self.Price}','{self.Enabled}','{self.CreatedAt}')"
Ejemplo n.º 8
0
class users(db.Model, UserMixin):
    __tablename__ = "users"
    id = db.Column(db.Integer, primary_key = True)
    firstName = db.Column(db.String(20), nullable = False)
    lastName = db.Column(db.String(20), nullable = False)
    email = db.Column(db.String(50), unique = True, nullable = False)
    phoneNumber = db.Column(db.String(15), unique = True, nullable = False)
    image_file = db.Column(db.String(20), nullable = False, default = 'default.jpg')
    password = db.Column(db.String(60), nullable = False)
    is_staff = db.Column(db.Boolean, default = False)
    profile = db.relationship('Profile',backref='users', lazy=True)

    def __repr__(self):
        return '<uploader %r>' %(self.id)

    def get_reset_token(self, expires_sec = 1800):
        s = Serializer(app.config['SECRET_KEY'], expires_sec)
        return s.dumps({'user_id': self.id}).decode('utf-8')

    def verify_reset_token(token):
        s = Serializer(app.config['SECRET_KEY'])
        try:
            user_id = s.loads(token)['user_id']
        except:
            return None
        return users.query.get(user_id)
Ejemplo n.º 9
0
class Staff(db.Model, UserMixin):
    __tablename__ = "staff"
    id = db.Column(db.Integer, primary_key = True)
    firstName = db.Column(db.String(20), unique = True, nullable = False)
    lastName = db.Column(db.String(20), unique = True, nullable = False)
    email = db.Column(db.String(50), unique = True, nullable = False)
    phoneNumber = db.Column(db.String(15), unique = True, nullable = False)
    _password = db.Column(db.Binary)
    _salt = db.Column(db.Binary, default=os.urandom(512))
Ejemplo n.º 10
0
class Uploader(db.Model):
    __tablename__ = "uploader"
    id = db.Column(db.Integer, primary_key = True)
    category = db.Column(db.String(20), nullable = False)
    plotname = db.Column(db.String(20), nullable = False)
    estate = db.Column(db.String(20), nullable = False)
    roomNumber = db.Column(db.String(10), nullable = False)
    price = db.Column(db.DECIMAL(5,2), nullable = False)
    description = db.Column(db.String(300), nullable = False)
    is_booked = db.Column(db.Boolean, default = False)
    images = db.relationship('Images',backref='uploader', lazy=True)

    def __repr__(self):
        return '<Uploader %r>' %(self.id)
Ejemplo n.º 11
0
class Farmer(db.Model):
    Idfarmer = db.Column(db.Integer, primary_key=True)
    FirstName = db.Column(db.String(250), nullable=True)
    LastName = db.Column(db.String(250), nullable=True)
    PhoneNumber = db.Column(db.String(250), nullable=True)
    Address = db.Column(db.String(250), nullable=True)
    Harvestime = db.Column(db.String(250), nullable=True)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    def __repr__(self):
        return f"Farmer('{self.Idfarmer}',{self.FirstName}','{self.LastName}','{self.PhoneNumber}','{self.Address}','{self.Harvestime}','{self.CreatedAt}')"
Ejemplo n.º 12
0
class Profile(db.Model):
    __tablename__ = "profile"
    id = db.Column(db.Integer, primary_key = True)
    category = db.Column(db.String(20), nullable = False)
    plotname = db.Column(db.String(20), nullable = False)
    estate = db.Column(db.String(20), nullable = False)
    roomNumber = db.Column(db.String(10), nullable = False)
    price = db.Column(db.DECIMAL(5,2), nullable = False)
    description = db.Column(db.String(300), nullable = False)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable = False)
    
    profile_images = db.relationship('Profile_images',backref='profile', lazy=True)

    def __repr__(self):
        return '<Profile %r>' %(self.id)
Ejemplo n.º 13
0
class Users(db.Model, UserMixin):
    IdUser = db.Column(db.Integer, primary_key=True)
    IdRole = db.Column(db.Integer, db.ForeignKey('role.IdRole'))
    FirstName = db.Column(db.String(250), nullable=True)
    LastName = db.Column(db.String(250), nullable=True)
    Email = db.Column(db.String(250), nullable=True)
    PhoneNumber = db.Column(db.String(250), nullable=True)
    Address = db.Column(db.String(250), nullable=True)
    Pasword = db.Column(db.String(250), nullable=True)
    CreatedAt = db.Column(db.DateTime, nullable=False)
    Enabled = db.Column(db.Integer, db.ForeignKey('situation.IdSituation'))
    role = db.relationship('Role', backref="Users")
    situation = db.relationship('Situation', backref='Users')

    def get_reset_token(self, expires_sec=1800):
        s = Serializer(app.config['SECRET_KEY'], expires_sec)
        return s.dumps({'user_id': self.IdUser}).decode('utf-8')

    @staticmethod
    def verify_reset_token(token):
        s = Serializer(app.config['SECRET_KEY'])
        try:
            user_id = s.loads(token)['user_id']
        except TypeError:
            print('Type error in verify reset token')
        except Exception as e:
            print("Error '{0}' occurred. Arguments {1}.".format(
                e.message, e.args))
        finally:
            if user_id is None:
                user_id = None
        return Users.query.get(user_id)

    def __repr__(self):
        return f"Users('{self.IdUser}','{self.IdRole},'{self.FirstName}','{self.LastName}','{self.Email}','{self.PhoneNumber}','{self.Address}','{self.Pasword}','{self.CreatedAt}','{self.Enabled}')"

    def get_id(self):
        return (self.IdUser)
Ejemplo n.º 14
0
class OrdersCleaning(db.Model):
    IdOrder = db.Column(db.Integer, primary_key=True)
    OrderNumber = db.Column(db.String(250), nullable=True)
    FirstName = db.Column(db.String(250), nullable=True)
    LastName = db.Column(db.String(250), nullable=True)
    PhoneNumber = db.Column(db.String(250), nullable=True)
    Email = db.Column(db.String(250), nullable=True)
    Address = db.Column(db.String(250), nullable=True)
    Service = db.Column(db.String(250), nullable=True)
    Price = db.Column(db.String(250), nullable=True)
    BookingType = db.Column(db.Integer, nullable=True)
    IdOrderStatus = db.Column(db.Integer,
                              db.ForeignKey('order_status.IdOrderStatus'))
    Time = db.Column(db.String(250), nullable=True)
    Maid = db.Column(db.String(250), nullable=True)
    OrderDate = db.Column(db.String(250), nullable=True)
    Comment = db.Column(db.String(250), nullable=True)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    status = db.relationship("OrderStatus", backref="OrdersCleaning")

    def __repr__(self):
        return f"OrdersCleaning('{self.IdOrder}',{self.OrderNumber}','{self.FirstName}','{self.LastName}','{self.PhoneNumber}','{self.Email}','{self.Service}','{self.Price}','{self.Maid}','{self.OnceDate}','{self.BookingType}','{self.IdOrderStatus}','{self.Ordertime}','{self.Time}','{self.Comment}','{self.StartDate}','{self.EndDate}')"
Ejemplo n.º 15
0
class OrdersMaintenance(db.Model):
    IdOrder = db.Column(db.Integer, primary_key=True)
    OrderNumber = db.Column(db.String(250), nullable=True)
    FirstName = db.Column(db.String(250), nullable=True)
    LastName = db.Column(db.String(250), nullable=True)
    PhoneNumber = db.Column(db.String(250), nullable=True)
    Email = db.Column(db.String(250), nullable=True)
    Address = db.Column(db.String(250), nullable=True)
    IdService = db.Column(db.Integer, db.ForeignKey('service.IdService'))
    IdAgent = db.Column(db.Integer, db.ForeignKey('agent.IdAgent'))
    Price = db.Column(db.String(250), nullable=True)
    IdPriority = db.Column(db.Integer, db.ForeignKey('priority.IdPriority'))
    IdOrderStatus = db.Column(db.Integer,
                              db.ForeignKey('order_status.IdOrderStatus'))
    Ordertime = db.Column(db.String(250), nullable=True)
    Time = db.Column(db.Integer, db.ForeignKey('time.IdTime'))
    latit = db.Column(db.String(250), nullable=True)
    lon = db.Column(db.String(250), nullable=True)
    Comment = db.Column(db.String(250), nullable=True)
    CreatedAt = db.Column(db.DateTime, nullable=False)

    service = db.relationship("Service", backref="OrdersMaintenance")
    priority = db.relationship("Priority", backref="OrdersMaintenance")
    status = db.relationship("OrderStatus", backref="OrdersMaintenance")
    time = db.relationship("Time", backref="OrdersMaintenance")
    agent = db.relationship("Agent", backref="OrdersMaintenance")

    def __repr__(self):
        return f"OrdersMaintenance('{self.IdOrder}',{self.OrderNumber}','{self.FirstName}','{self.LastName}','{self.PhoneNumber}','{self.Email}','{self.IdService}','{self.Price}','{self.IdPriority}','{self.IdAgent}','{self.IdOrderStatus}','{self.Ordertime}','{self.Time}','{self.latit}','{self.lon}','{self.Comment}')"