24th Commit
This commit is contained in:
parent
c4354da63e
commit
741b61e17f
BIN
db5.sqlite3
BIN
db5.sqlite3
Binary file not shown.
@ -26,7 +26,6 @@ import
|
|||||||
echo "No cookie found."
|
echo "No cookie found."
|
||||||
else:
|
else:
|
||||||
products = micsGetProducts(email, password)
|
products = micsGetProducts(email, password)
|
||||||
echo "Cookie found."
|
|
||||||
|
|
||||||
compileTemplateFile(getScriptDir() / "a3a" / "index.nimja")
|
compileTemplateFile(getScriptDir() / "a3a" / "index.nimja")
|
||||||
|
|
||||||
@ -336,13 +335,11 @@ import
|
|||||||
loginError = ""
|
loginError = ""
|
||||||
emailError = ""
|
emailError = ""
|
||||||
passwordError = ""
|
passwordError = ""
|
||||||
echo user
|
|
||||||
|
|
||||||
if user == true:
|
if user == true:
|
||||||
|
|
||||||
ctx &= initCookie("email", email)
|
ctx &= initCookie("email", email)
|
||||||
ctx &= initCookie("password", password)
|
ctx &= initCookie("password", password)
|
||||||
echo ctx.cookies
|
|
||||||
|
|
||||||
ctx.redirect("/")
|
ctx.redirect("/")
|
||||||
|
|
||||||
|
@ -30,7 +30,12 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="/cart" class="site-cart">
|
<a href="/cart" class="site-cart">
|
||||||
<span class="icon icon-shopping_cart"></span>
|
<span class="icon icon-shopping_cart"></span>
|
||||||
<span class="count">2</span>
|
{# <span class="count">2</span> #}
|
||||||
|
{% if email != "" %}
|
||||||
|
{% if products.len > 0 %}
|
||||||
|
<span class="count">{{products.len}}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><span class="icon-menu"></span></a></li>
|
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><span class="icon-menu"></span></a></li>
|
||||||
@ -102,12 +107,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
{# <div class="form-group row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<label for="c_companyname" class="text-black">Company Name </label>
|
<label for="c_companyname" class="text-black">Company Name </label>
|
||||||
<input type="text" class="form-control" id="c_companyname" name="c_companyname">
|
<input type="text" class="form-control" id="c_companyname" name="c_companyname">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> #}
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -189,12 +194,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
{# <div class="form-group row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<label for="c_diff_companyname" class="text-black">Company Name </label>
|
<label for="c_diff_companyname" class="text-black">Company Name </label>
|
||||||
<input type="text" class="form-control" id="c_diff_companyname" name="c_diff_companyname">
|
<input type="text" class="form-control" id="c_diff_companyname" name="c_diff_companyname">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> #}
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
BIN
src/a3c/db_down
BIN
src/a3c/db_down
Binary file not shown.
@ -1,13 +1,14 @@
|
|||||||
import
|
import
|
||||||
./[products, users, cart, orders]
|
./orders,
|
||||||
|
../a3pkg/mics
|
||||||
|
|
||||||
var
|
var
|
||||||
db1 = newDatabase1()
|
db = newDatabase()
|
||||||
db2 = newDatabase2()
|
# db2 = newDatabase2()
|
||||||
db3 = newDatabase3()
|
# db3 = newDatabase3()
|
||||||
db4 = newDatabase4()
|
# db4 = newDatabase4()
|
||||||
|
|
||||||
db1.drop()
|
db.drop()
|
||||||
db2.drop()
|
# db2.drop()
|
||||||
db3.drop()
|
# db3.drop()
|
||||||
db4.drop()
|
# db4.drop()
|
BIN
src/a3c/db_up
BIN
src/a3c/db_up
Binary file not shown.
@ -1,16 +1,17 @@
|
|||||||
import
|
import
|
||||||
./[products, users, cart, orders]
|
./[products, users, cart, orders],
|
||||||
|
../a3pkg/mics
|
||||||
|
|
||||||
var
|
var
|
||||||
db1 = newDatabase1()
|
db = newDatabase()
|
||||||
db2 = newDatabase2()
|
# db2 = newDatabase2()
|
||||||
db3 = newDatabase3()
|
# db3 = newDatabase3()
|
||||||
db4 = newDatabase4()
|
# db4 = newDatabase4()
|
||||||
|
|
||||||
db1.setupProducts()
|
db.setupProducts()
|
||||||
# db1.availableProducts()
|
# db1.availableProducts()
|
||||||
db2.setupUsers()
|
db.setupUsers()
|
||||||
db3.setupCart()
|
db.setupCart()
|
||||||
db4.setupOrders()
|
db.setupOrders()
|
||||||
|
|
||||||
db1.setupProductsIndex()
|
db.setupProductsIndex()
|
@ -10,6 +10,11 @@ proc setupOrders*(db: DbConn) =
|
|||||||
CREATE TABLE IF NOT EXISTS orders (
|
CREATE TABLE IF NOT EXISTS orders (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
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,
|
product_id INTEGER NOT NULL REFERENCES products(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
quantity INTEGER NOT NULL,
|
quantity INTEGER NOT NULL,
|
||||||
created_at TEXT DEFAULT CURRENT_TIMESTAMP 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 =
|
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 (?, ?, ?, ?, ?);",
|
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)
|
||||||
order.userId, order.productId, order.quantity, order.orderStatus, order.orderDate)
|
|
||||||
return newID
|
|
||||||
|
|
||||||
proc drop*(db: DbConn) =
|
proc drop*(db: DbConn) =
|
||||||
db.exec(sql"DROP TABLE IF EXISTS orders")
|
db.exec(sql"DROP TABLE IF EXISTS orders")
|
@ -38,6 +38,11 @@ type
|
|||||||
## Orders is the orders model
|
## Orders is the orders model
|
||||||
id*: int
|
id*: int
|
||||||
userId*: int
|
userId*: int
|
||||||
|
country*: string
|
||||||
|
address*: string
|
||||||
|
state*: string
|
||||||
|
postalCode*: string
|
||||||
|
phoneNumber*: string
|
||||||
productId*: int
|
productId*: int
|
||||||
quantity*: int
|
quantity*: int
|
||||||
createdAt*: DateTime
|
createdAt*: DateTime
|
||||||
|
Loading…
Reference in New Issue
Block a user