diff --git a/db5.sqlite3 b/db5.sqlite3
index bc8d43d..0e0555c 100644
Binary files a/db5.sqlite3 and b/db5.sqlite3 differ
diff --git a/src/a3 b/src/a3
index b0c84a6..84d50d3 100755
Binary files a/src/a3 and b/src/a3 differ
diff --git a/src/a3.nim b/src/a3.nim
index b57838a..f75a598 100644
--- a/src/a3.nim
+++ b/src/a3.nim
@@ -26,7 +26,6 @@ import
echo "No cookie found."
else:
products = micsGetProducts(email, password)
- echo "Cookie found."
compileTemplateFile(getScriptDir() / "a3a" / "index.nimja")
@@ -336,13 +335,11 @@ import
loginError = ""
emailError = ""
passwordError = ""
- echo user
if user == true:
ctx &= initCookie("email", email)
ctx &= initCookie("password", password)
- echo ctx.cookies
ctx.redirect("/")
diff --git a/src/a3a/checkout.nimja b/src/a3a/checkout.nimja
index 2bc1103..ce6c003 100644
--- a/src/a3a/checkout.nimja
+++ b/src/a3a/checkout.nimja
@@ -30,7 +30,12 @@
diff --git a/src/a3c/db_down b/src/a3c/db_down
index 990d934..84e841f 100755
Binary files a/src/a3c/db_down and b/src/a3c/db_down differ
diff --git a/src/a3c/db_down.nim b/src/a3c/db_down.nim
index 5b4d304..cf5a3de 100644
--- a/src/a3c/db_down.nim
+++ b/src/a3c/db_down.nim
@@ -1,13 +1,14 @@
import
- ./[products, users, cart, orders]
+ ./orders,
+ ../a3pkg/mics
var
- db1 = newDatabase1()
- db2 = newDatabase2()
- db3 = newDatabase3()
- db4 = newDatabase4()
+ db = newDatabase()
+ # db2 = newDatabase2()
+ # db3 = newDatabase3()
+ # db4 = newDatabase4()
-db1.drop()
-db2.drop()
-db3.drop()
-db4.drop()
\ No newline at end of file
+db.drop()
+# db2.drop()
+# db3.drop()
+# db4.drop()
\ No newline at end of file
diff --git a/src/a3c/db_up b/src/a3c/db_up
index 40ad1c0..dce31df 100755
Binary files a/src/a3c/db_up and b/src/a3c/db_up differ
diff --git a/src/a3c/db_up.nim b/src/a3c/db_up.nim
index 47b4d72..58f8c1c 100644
--- a/src/a3c/db_up.nim
+++ b/src/a3c/db_up.nim
@@ -1,16 +1,17 @@
import
- ./[products, users, cart, orders]
+ ./[products, users, cart, orders],
+ ../a3pkg/mics
var
- db1 = newDatabase1()
- db2 = newDatabase2()
- db3 = newDatabase3()
- db4 = newDatabase4()
+ db = newDatabase()
+ # db2 = newDatabase2()
+ # db3 = newDatabase3()
+ # db4 = newDatabase4()
-db1.setupProducts()
+db.setupProducts()
# db1.availableProducts()
-db2.setupUsers()
-db3.setupCart()
-db4.setupOrders()
+db.setupUsers()
+db.setupCart()
+db.setupOrders()
-db1.setupProductsIndex()
\ No newline at end of file
+db.setupProductsIndex()
\ No newline at end of file
diff --git a/src/a3c/orders.nim b/src/a3c/orders.nim
index 92b24ac..82168c2 100644
--- a/src/a3c/orders.nim
+++ b/src/a3c/orders.nim
@@ -10,6 +10,11 @@ proc setupOrders*(db: DbConn) =
CREATE TABLE IF NOT EXISTS orders (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE,
+ country VARCHAR(255) NOT NULL,
+ address VARCHAR(255) NOT NULL,
+ state VARCHAR(255) NOT NULL,
+ postal_code VARCHAR(255) NOT NULL,
+ phone_number VARCHAR(255) NOT NULL,
product_id INTEGER NOT NULL REFERENCES products(id) ON DELETE CASCADE ON UPDATE CASCADE,
quantity INTEGER NOT NULL,
created_at TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL,
@@ -19,10 +24,13 @@ proc setupOrders*(db: DbConn) =
);
""")
+# proc createPost*(db: DbConn, order:Orders): int64 =
+# var newID = db.insertID(sql"INSERT INTO orders (user_id, product_id, quantity, order_status, order_date) VALUES (?, ?, ?, ?, ?);",
+# order.userId, order.productId, order.quantity, order.orderStatus, order.orderDate)
+# return newID
+
proc createPost*(db: DbConn, order:Orders): int64 =
- var newID = db.insertID(sql"INSERT INTO orders (user_id, product_id, quantity, order_status, order_date) VALUES (?, ?, ?, ?, ?);",
- order.userId, order.productId, order.quantity, order.orderStatus, order.orderDate)
- return newID
+ result = db.insertID(sql"INSERT INTO orders (user_id, country, address, state, postal_code, phone_number, product_id, quantity, order_status, order_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", order.userId, order.country, order.address, order.state, order.postalCode, order.phoneNumber, order.productId, order.quantity, order.orderStatus, order.orderDate)
proc drop*(db: DbConn) =
db.exec(sql"DROP TABLE IF EXISTS orders")
\ No newline at end of file
diff --git a/src/a3pkg/models.nim b/src/a3pkg/models.nim
index ccccb0a..febd1ea 100644
--- a/src/a3pkg/models.nim
+++ b/src/a3pkg/models.nim
@@ -38,6 +38,11 @@ type
## Orders is the orders model
id*: int
userId*: int
+ country*: string
+ address*: string
+ state*: string
+ postalCode*: string
+ phoneNumber*: string
productId*: int
quantity*: int
createdAt*: DateTime