correcting factory objects

This commit is contained in:
2022-02-03 13:53:43 -06:00
parent 15554e6ef3
commit d17834ecd0
3 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import sqlite3
import json
from models import Animal
from models.animal import Animal
def get_all_animals():
# Open a connection to the database
+3 -3
View File
@@ -33,9 +33,9 @@ def get_all_customers():
# Note that the database fields are specified in
# exact order of the parameters defined in the
# Animal class above.
customer = Customer(row['id'], row['name'], row['breed'],
row['status'], row['location_id'],
row['customer_id'])
customer = Customer(row['id'], row['name'], row['address'],
row['email'], row['password'],
)
customers.append(customer.__dict__)
+3 -5
View File
@@ -1,5 +1,6 @@
import sqlite3
import json
from models.employee import Employee
def get_all_employees():
# Open a connection to the database
@@ -15,8 +16,7 @@ def get_all_employees():
e.id,
e.name,
e.address,
e.email,
e.password,
e.location_id
FROM employee e
""")
@@ -33,9 +33,7 @@ def get_all_employees():
# Note that the database fields are specified in
# exact order of the parameters defined in the
# Animal class above.
employee = Employee(row['id'], row['name'], row['breed'],
row['status'], row['location_id'],
row['employee_id'])
employee = Employee(row['id'], row['name'], row['address'],row['location_id'])
employees.append(employee.__dict__)