Esempio n. 1
0
class Distances(db.Model):
    __tablename__ = 'distances'

    id = db.Column(db.Integer, primary_key=True)
    from_string = db.Column(db.String(500), nullable=False)
    to_string = db.Column(db.String(500), nullable=False)
    distance = db.Column(db.Integer, nullable=False)  # in metres
Esempio n. 2
0
class Item(db.Model):
    __tablename__ = 'item'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False)
    volume = db.Column(db.String(255), nullable=False)
    weight = db.Column(db.String(255), nullable=False)
    amount = db.Column(db.String(255), nullable=False)
    description = db.Column(db.String(1000), nullable=False)
    move_id = db.Column(db.Integer, ForeignKey('movedetails.id'), nullable=False)

    def to_dict(self):
        return {
            'id': self.id,
            'name': self.name,
            'volume': self.volume,
            'weight': self.weight,
            'amount': self.amount,
            'description': self.description,
            'move_id': self.move_id,
        }
Esempio n. 3
0
class Update(db.Model):
    __tablename__ = 'update'

    id = db.Column(db.Integer, primary_key=True)
    update_type = db.Column(db.String(255), nullable=False)
    updated_movee_id = db.Column(db.String(255), nullable=False)
    concerning_movee_id = db.Column(db.String(255), nullable=False)
    description = db.Column(db.String(1000), nullable=False)
    amount = db.Column(db.Integer)
    move_id = db.Column(db.Integer, ForeignKey('movedetails.id'), nullable=False)
    update_time = db.Column(db.DateTime, nullable=False)

    def to_dict(self):
        return {
            'id': self.id,
            'update_type': self.update_type,
            'updated': self.updated_movee_id,
            'concerning': self.concerning_movee_id,
            'description': self.description,
            'move_id': self.move_id,
            'update_time': self.update_time
        }
Esempio n. 4
0
class ToAddress(db.Model):
    __tablename__ = 'toaddress'

    id = db.Column(db.Integer, primary_key=True)
    line1 = db.Column(db.String(255), nullable=False)
    line2 = db.Column(db.String(255), nullable=False)
    city = db.Column(db.String(255), nullable=False)
    state = db.Column(db.String(10), nullable=False)
    postcode = db.Column(db.String(10), nullable=False)
    move_id = db.Column(db.Integer, ForeignKey('movedetails.id'))

    def to_dict(self):
        return {
            'id': self.id,
            'line1': self.line1,
            'line2': self.line2,
            'city': self.city,
            'state': self.state,
            'postcode': self.postcode
        }

    def __repr__(self):
        full_address = line1 + " " + line2 + " " + state + " " + postcode
        return "<ToAddress(address='%s')" % (full_address)
Esempio n. 5
0
class User(db.Model):
    __tablename__ = 'user'

    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(255), nullable=False)
    first_name = db.Column(db.String(255), nullable=False)
    last_name = db.Column(db.String(255), nullable=False)
    password = db.Column(db.String(255), nullable=False)
    creation_date = db.Column(db.DateTime, nullable=False)
    user_type = db.Column(db.String(255), nullable=False)
    deleted = db.Column(db.Boolean, nullable=False)
    description = db.Column(db.String(4000), nullable=False)
    phone_number = db.Column(db.String(50), nullable=False)
    avatar = db.Column(db.String(255), nullable=False)

    rating_overall = db.Column(db.Integer, default=0, nullable=False)
    rating_speed = db.Column(db.Integer, default=0, nullable=False)
    rating_reliability = db.Column(db.Integer, default=0, nullable=False)
    rating_service = db.Column(db.Integer, default=0, nullable=False)

    comments = relationship('Comment')
    reviews = relationship('Review')
    post_records = relationship('PostRecord')

    def to_dict(self):
        return {
            'id': self.id,
            'email': self.email,
            'first_name': self.first_name,
            'last_name': self.last_name,
            'password': self.password,
            'deleted': self.deleted,
            'user_type': self.user_type,
            'description': self.description,
            'phone_number': self.phone_number,
            'avatar': self.avatar,
            'creation_date': self.creation_date,
            'rating_overall': self.rating_overall,
            'rating_speed': self.rating_speed,
            'rating_reliability': self.rating_reliability,
            'rating_service': self.rating_service
        }
Esempio n. 6
0
class Review(db.Model):
    __tablename__ = 'review'

    id = db.Column(db.Integer, primary_key=True)
    poster = db.Column(db.Integer, nullable=False)
    reviewed_user = db.Column(db.Integer,
                              ForeignKey('user.id'),
                              nullable=False)
    move = db.Column(db.Integer, ForeignKey('movedetails.id'))
    creation_datetime = db.Column(db.DateTime, nullable=False)
    rating_general = db.Column(db.Integer)
    rating_reliability = db.Column(db.Integer)
    rating_service = db.Column(db.Integer)
    rating_speed = db.Column(db.Integer)
    review = db.Column(db.String(500), nullable=False)
    deleted = db.Column(db.Boolean, nullable=False)

    def to_dict(self):
        return {
            'id':
            self.id,
            'poster':
            self.poster,
            'reviewed_user':
            self.reviewed_user,
            'creation_datetime':
            self.creation_datetime,
            'rating_speed':
            self.rating_speed if self.rating_speed else 0,
            'rating_reliability':
            self.rating_reliability if self.rating_reliability else 0,
            'rating_service':
            self.rating_service if self.rating_service else 0,
            'rating_general':
            self.rating_general if self.rating_general else 0,
            'review':
            self.review,
            'deleted':
            self.deleted
        }
Esempio n. 7
0
class Postcode(db.Model):
    __tablename__ = 'postcode'

    id = db.Column(db.Integer, primary_key=True)
    postcode = db.Column(db.String(50), nullable=False)
    suburb = db.Column(db.String(100), nullable=False)