class Truck_Driver(r.Base): # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY id = r.Column(r.Integer, primary_key=True) def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) #--------------------------------------------------------- ###################################################################################################### # EDITABLE ZONE ###################################################################################################### # TODO: CHANGE TABLENAME __tablename__ = "Truck_Driver" # TODO: DEFINE LIST OF COLUMNS name = r.Column(r.String(r.lim.MAX_USERNAME_SIZE), nullable=False, unique=False) contact_no = r.Column(r.String(r.lim.MAX_CONTACT_SIZE), nullable=False, unique=True) #longitude password = r.Column(r.String(r.lim.MAX_PASSWORD_SIZE), unique=False, nullable=False) # TODO: DEFINE THE RLIST #The following is for r-listing (resource listing) # the values in the rlist must be the same as the column var name rlist = { "Driver ID": "id", "Driver Name": "name", "Contact Number": "contact_no" } #header:row data # TODO: DEFINE THE priKey and display text #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Truck_Driver" #display for r routes # TODO: NOT IMPLEMENT YET, PLEASE IGNORE #The following is for r-listing on foreign tables rlist_flist = {} # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS # the key in the insert_list must be the same as the column var name def __init__(self, insert_list): self.name = insert_list["name"] self.contact_no = insert_list["contact_no"] self.password = insert_list["password"]
class Truck_Loc_Log(r.Base): # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY id = r.Column(r.Integer, primary_key=True) def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) #--------------------------------------------------------- ###################################################################################################### # EDITABLE ZONE ###################################################################################################### # TODO: CHANGE TABLENAME __tablename__ = "Truck_Loc_Log" # TODO: DEFINE LIST OF COLUMNS loc = r.Column(r.String(r.lim.MAX_LOCATION_SIZE), nullable=False, unique=False) time_stamp = r.Column(r.DateTime, nullable=False) tracking_num = r.Column(r.String(r.lim.MAX_LOCATION_SIZE), nullable=False, unique=False) # TODO: DEFINE THE RLIST #The following is for r-listing (resource listing) # the values in the rlist must be the same as the column var name rlist = { "Log Number": "id", "Location": "loc", "Time stamp": "time_stamp", "Tracking Number": "tracking_num", } #header:row data # TODO: DEFINE THE priKey and display text #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Truck_Loc_Log" #display for r routes # TODO: NOT IMPLEMENT YET, PLEASE IGNORE #The following is for r-listing on foreign tables rlist_flist = {} def __init__(self, insert_list): self.id = insert_list["id"] self.loc = insert_list["loc"] self.time_stamp = insert_list["time_stamp"] self.tracking_num = insert_list["tracking_num"]
class Active_Bus(r.Base): # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY id = r.Column(r.Integer, primary_key=True) def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) __tablename__ = "Active_Bus" # TODO: DEFINE LIST OF COLUMNS bus_id = r.Column(r.String(r.lim.MAX_USERNAME_SIZE), nullable=False, unique=False) #bus_id = r.Column(r.Integer,nullable=False) driver_id = r.Column(r.Integer, nullable=False) route_num = r.Column(r.Integer, nullable=False) time_stamp = r.Column(r.DateTime, nullable=False) long = r.Column(r.Float, nullable=False) lati = r.Column(r.Float, nullable=False) #latitude current_seqno = r.Column(r.Integer, nullable=False) # TODO: DEFINE THE RLIST #The following is for r-listing (resource listing) # the values in the rlist must be the same as the column var name rlist = { "Log": "id", "Bus plate": "bus_id", "Driver ID": "driver_id", "Route": "route_num", "Time Stamp": "time_stamp", "Longitude": "long", "Latitude": "lati", "Current Seq Number": "current_seqno" } #header:row data # TODO: DEFINE THE priKey and display text #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Active_Bus" #display for r routes # TODO: NOT IMPLEMENT YET, PLEASE IGNORE #The following is for r-listing on foreign tables rlist_flist = {} # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS # the key in the insert_list must be the same as the column var name def __init__(self, insert_list): #self.bus_plate = insert_list["bus_plate"] self.bus_id = insert_list["bus_id"] self.driver_id = insert_list["driver_id"] self.route_num = insert_list["route_num"] self.time_stamp = insert_list["time_stamp"] self.long = insert_list["long"] self.lati = insert_list["lati"] self.current_seqno = insert_list["current_seqno"]
class Truck_Log(r.Base): # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY id = r.Column(r.Integer, primary_key=True) def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) #--------------------------------------------------------- ###################################################################################################### # EDITABLE ZONE ###################################################################################################### # TODO: CHANGE TABLENAME __tablename__ = "Truck_Log" # TODO: DEFINE LIST OF COLUMNS tracking_number = r.Column(r.String(r.lim.MAX_LOCATION_SIZE), nullable=False, unique=True) start_ts = r.Column(r.DateTime, nullable=False) end_ts = r.Column(r.DateTime, nullable=False) #latitude truck_id = r.Column(r.Integer, nullable=False) driver_id = r.Column(r.Integer, nullable=False) route_num = r.Column(r.Integer, nullable=False) # TODO: DEFINE THE RLIST #The following is for r-listing (resource listing) # the values in the rlist must be the same as the column var name rlist = { "Tracking number": "tracking_number", "Start Timestamp": "start_ts", "End Timestamp": "end_ts", "Truck ID": "truck_id", "Driver ID": "driver_id", "Route Number": "route_num" } #header:row data # TODO: DEFINE THE priKey and display text #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Truck_Log" #display for r routes # TODO: NOT IMPLEMENT YET, PLEASE IGNORE #The following is for r-listing on foreign tables rlist_flist = {} def __init__(self, insert_list): self.tracking_number = insert_list["tracking_number"] self.truck_id = insert_list["truck_id"] self.driver_id = insert_list["driver_id"] self.route_num = insert_list["route_num"] self.start_ts = insert_list["start_ts"] self.end_ts = insert_list["end_ts"]
class Active_Truck(r.Base): # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY id = r.Column(r.Integer, primary_key=True) def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) #--------------------------------------------------------- ###################################################################################################### # EDITABLE ZONE ###################################################################################################### # TODO: CHANGE TABLENAME __tablename__ = "Active_Truck" # TODO: DEFINE LIST OF COLUMNS tracking_number = r.Column(r.String(r.lim.MAX_LOCATION_SIZE), nullable=False, unique=True) location1 = r.Column(r.Boolean(), unique=False, nullable=False) location2 = r.Column(r.Boolean(), unique=False, nullable=False) location3 = r.Column(r.Boolean(), unique=False, nullable=False) location4 = r.Column(r.Boolean(), unique=False, nullable=False) # TODO: DEFINE THE RLIST #The following is for r-listing (resource listing) # the values in the rlist must be the same as the column var name rlist = { "Tracking number": "tracking_number", "Location 1": "location1", "Location 2": "location2", "Location 3": "location3", "Location 4": "location4", } #header:row data # TODO: DEFINE THE priKey and display text #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Active_Truck" #display for r routes # TODO: NOT IMPLEMENT YET, PLEASE IGNORE #The following is for r-listing on foreign tables rlist_flist = {} # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS # the key in the insert_list must be the same as the column var name def __init__(self, insert_list): self.tracking_number = insert_list["tracking_number"] self.location1 = insert_list["location1"] self.location2 = insert_list["location2"] self.location3 = insert_list["location3"] self.location4 = insert_list["location4"]
class Truck(r.Base): # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY id = r.Column(r.Integer, primary_key=True) def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) #--------------------------------------------------------- ###################################################################################################### # EDITABLE ZONE ###################################################################################################### # TODO: CHANGE TABLENAME __tablename__ = "Truck" # TODO: DEFINE LIST OF COLUMNS long = r.Column(r.Float, nullable=False) lati = r.Column(r.Float, nullable=False) #latitude reg_no = r.Column(r.String(r.lim.MAX_PASSWORD_SIZE), nullable=False, unique=True) # TODO: DEFINE THE RLIST #The following is for r-listing (resource listing) # the values in the rlist must be the same as the column var name rlist = { "Truck ID": "id", "Longitude": "long", "Latitude": "lati", "Registered Number": "reg_no" } #header:row data # TODO: DEFINE THE priKey and display text #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Truck" #display for r routes # TODO: NOT IMPLEMENT YET, PLEASE IGNORE #The following is for r-listing on foreign tables rlist_flist = {} # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS # the key in the insert_list must be the same as the column var name def __init__(self, insert_list): self.long = insert_list["long"] self.lati = insert_list["lati"] self.reg_no = insert_list["reg_no"]
class Georoute(r.Base): __tablename__ = "Georoute" id = r.Column(r.Integer, primary_key=True) name = r.Column(r.String(r.lim.MAX_USERNAME_SIZE), nullable=False, unique=True) #The following is for r-listing (resource listing) rlist = {"Georoute ID": "id", "Georoute Name": "name"} #header:row data #this primary key is used for rlisting/adding and mod. rlist_priKey = "id" rlist_dis = "Georoutes" #display for r routes def __init__(self, insert_list): self.name = insert_list["name"] def __repr__(self): return '<%r %r>' % (self.__tablename__, self.id) def getselfname(self): return self.__class__.__name__