Created login functinality

This commit is contained in:
2024-01-02 22:22:14 +00:00
parent b26bd1a228
commit e0b04d13f6
9 changed files with 89 additions and 79 deletions

View File

@ -2,24 +2,12 @@ from .user import User
class Admin(User):
'''
Class constructor to instatiate an Admin object
Class constructor to instatiate an admin object
No additional properties are assigned to the admin
'''
def __init__(self):
super().__init__()
self.store = ""
def login(self):
print("Logging in as Admin")
def signup(self):
print("Signing up as Admin")
def createProduct():
pass
def deleteProduct():
pass
def updateProduct():
pass
def __init__(self, id: int, username: str, password: str, firstname: str,
lastname: str, email: str, phone: str, role: str):
super().__init__(
id, username, password, firstname, lastname, email, phone, role
)

View File

@ -6,15 +6,9 @@ class Customer(User):
No additional properties are assigned to the customer
'''
def __init__(self, id: int, username: str, email: str, firstname: str,
lastname: str, phone: str, password: str, role: str):
def __init__(self, id: int, username: str, password: str, firstname: str,
lastname: str, email: str, phone: str, role: str):
super().__init__(
id, username, email, firstname, lastname, phone, password, role
id, username, password, firstname, lastname, email, phone, role
)
def login(self):
print("Logging in as Customer")
def signup(self):
print("Signing up as Customer")

View File

@ -2,24 +2,13 @@ from .user import User
class Seller(User):
'''
Class constructor to instatiate a Seller object
Class constructor to instatiate a customer object
No additional properties are assigned to the customer
'''
def __init__(self):
super().__init__()
def __init__(self, id: int, username: str, password: str, firstname: str,
lastname: str, email: str, phone: str, role: str):
super().__init__(
id, username, password, firstname, lastname, email, phone, role
)
self.store = ""
def login(self):
print("Logging in as Seller")
def signup(self):
print("Signing up as Seller")
def createProduct():
pass
def deleteProduct():
pass
def updateProduct():
pass

View File

@ -1,25 +1,15 @@
from abc import ABC, abstractmethod
from abc import ABC
class User(ABC):
""" Functional Class constructor to initialise all properties in the base object
with a value """
def __init__(self, id: int, username: str, email: str, firstname: str,
lastname: str, phone: str, password: str, role: str):
def __init__(self, id: int, username: str, password: str, firstname: str,
lastname: str, email: str, phone: str, role: str):
self.id = id
self.username = username
self.email = email
self.password = password
self.firstName = firstname
self.lastName = lastname
self.email = email
self.phone = phone
self.password = password
self.role= role
@abstractmethod
def login(self):
pass
@abstractmethod
def signup(self):
pass