Create user , user login register routes and pages
This commit is contained in:
@@ -75,76 +75,5 @@ class TrenchExcavation(db.Model):
|
||||
def __repr__(self):
|
||||
return f"<TrenchExcavation {self.Location}>"
|
||||
|
||||
# def serialize(self):
|
||||
# return {
|
||||
# "id": self.id,
|
||||
# "subcontractor_id": self.subcontractor_id,
|
||||
# "subcontractor_name": self.subcontractor.subcontractor_name if self.subcontractor else None,
|
||||
|
||||
# "Location": self.Location,
|
||||
# "MH_NO": self.MH_NO,
|
||||
# "CC_length": self.CC_length,
|
||||
# "Invert_Level": self.Invert_Level,
|
||||
# "MH_Top_Level": self.MH_Top_Level,
|
||||
# "Ground_Level": self.Ground_Level,
|
||||
# "ID_of_MH_m": self.ID_of_MH_m,
|
||||
# "Actual_Trench_Length": self.Actual_Trench_Length,
|
||||
# "Pipe_Dia_mm": self.Pipe_Dia_mm,
|
||||
|
||||
# # Width
|
||||
# "Width_0_to_2_5": self.Width_0_to_2_5,
|
||||
# "Width_2_5_to_3_0": self.Width_2_5_to_3_0,
|
||||
# "Width_3_0_to_4_5": self.Width_3_0_to_4_5,
|
||||
# "Width_4_5_to_6_0": self.Width_4_5_to_6_0,
|
||||
|
||||
# # Depth
|
||||
# "Upto_IL_Depth": self.Upto_IL_Depth,
|
||||
# "Cutting_Depth": self.Cutting_Depth,
|
||||
# "Avg_Depth": self.Avg_Depth,
|
||||
|
||||
# # Soft Murum
|
||||
# "Soft_Murum_0_to_1_5": self.Soft_Murum_0_to_1_5,
|
||||
# "Soft_Murum_1_5_to_3_0": self.Soft_Murum_1_5_to_3_0,
|
||||
# "Soft_Murum_3_0_to_4_5": self.Soft_Murum_3_0_to_4_5,
|
||||
|
||||
# # Hard Murum
|
||||
# "Hard_Murum_0_to_1_5": self.Hard_Murum_0_to_1_5,
|
||||
# "Hard_Murum_1_5_to_3_0": self.Hard_Murum_1_5_to_3_0,
|
||||
|
||||
# # Soft Rock
|
||||
# "Soft_Rock_0_to_1_5": self.Soft_Rock_0_to_1_5,
|
||||
# "Soft_Rock_1_5_to_3_0": self.Soft_Rock_1_5_to_3_0,
|
||||
|
||||
# # Hard Rock
|
||||
# "Hard_Rock_0_to_1_5": self.Hard_Rock_0_to_1_5,
|
||||
# "Hard_Rock_1_5_to_3_0": self.Hard_Rock_1_5_to_3_0,
|
||||
# "Hard_Rock_3_0_to_4_5": self.Hard_Rock_3_0_to_4_5,
|
||||
# "Hard_Rock_4_5_to_6_0": self.Hard_Rock_4_5_to_6_0,
|
||||
# "Hard_Rock_6_0_to_7_5": self.Hard_Rock_6_0_to_7_5,
|
||||
|
||||
# # Totals
|
||||
# "Soft_Murum_0_to_1_5_total": self.Soft_Murum_0_to_1_5_total,
|
||||
# "Soft_Murum_1_5_to_3_0_total": self.Soft_Murum_1_5_to_3_0_total,
|
||||
# "Soft_Murum_3_0_to_4_5_total": self.Soft_Murum_3_0_to_4_5_total,
|
||||
|
||||
# "Hard_Murum_0_to_1_5_total": self.Hard_Murum_0_to_1_5_total,
|
||||
# "Hard_Murum_1_5_and_above_total": self.Hard_Murum_1_5_and_above_total,
|
||||
|
||||
# "Soft_Rock_0_to_1_5_total": self.Soft_Rock_0_to_1_5_total,
|
||||
# "Soft_Rock_1_5_and_above_total": self.Soft_Rock_1_5_and_above_total,
|
||||
|
||||
# "Hard_Rock_0_to_1_5_total": self.Hard_Rock_0_to_1_5_total,
|
||||
# "Hard_Rock_1_5_to_3_0_total": self.Hard_Rock_1_5_to_3_0_total,
|
||||
# "Hard_Rock_3_0_to_4_5_total": self.Hard_Rock_3_0_to_4_5_total,
|
||||
# "Hard_Rock_4_5_to_6_0_total": self.Hard_Rock_4_5_to_6_0_total,
|
||||
# "Hard_Rock_6_0_to_7_5_total": self.Hard_Rock_6_0_to_7_5_total,
|
||||
|
||||
# "Total": self.Total,
|
||||
# "Remarks": self.Remarks,
|
||||
# "RA_Bill_No": self.RA_Bill_No,
|
||||
|
||||
# "created_at": self.created_at.strftime("%d-%m-%Y") if self.created_at else None
|
||||
# }
|
||||
|
||||
def serialize(self):
|
||||
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
# from app.services.db_service import db
|
||||
# from werkzeug.security import generate_password_hash, check_password_hash
|
||||
from app.services.db_service import db
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
|
||||
# class User(db.Model):
|
||||
# id = db.Column(db.Integer, primary_key=True)
|
||||
# name = db.Column(db.String(120))
|
||||
# email = db.Column(db.String(120), unique=True)
|
||||
# password_hash = db.Column(db.String(255))
|
||||
class User(db.Model):
|
||||
__tablename__ = "users"
|
||||
|
||||
# def set_password(self, password):
|
||||
# self.password_hash = generate_password_hash(password)
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(120), nullable=False)
|
||||
email = db.Column(db.String(120), unique=True, nullable=False)
|
||||
password_hash = db.Column(db.String(255), nullable=False)
|
||||
|
||||
# def check_password(self, password):
|
||||
# return check_password_hash(self.password_hash, password)
|
||||
def set_password(self, password):
|
||||
self.password_hash = generate_password_hash(password)
|
||||
|
||||
|
||||
class User:
|
||||
def __init__(self, id, name, email):
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.email = email
|
||||
def check_password(self, password):
|
||||
return check_password_hash(self.password_hash, password)
|
||||
|
||||
Reference in New Issue
Block a user