diff --git a/src/a3 b/src/a3 index 02bab4e..b9604f1 100755 Binary files a/src/a3 and b/src/a3 differ diff --git a/src/about.nim b/src/a3d/about.nim similarity index 100% rename from src/about.nim rename to src/a3d/about.nim diff --git a/src/admin.nim b/src/a3d/admin.nim similarity index 100% rename from src/admin.nim rename to src/a3d/admin.nim diff --git a/src/cart.nim b/src/a3d/cart.nim similarity index 100% rename from src/cart.nim rename to src/a3d/cart.nim diff --git a/src/checkout.nim b/src/a3d/checkout.nim similarity index 100% rename from src/checkout.nim rename to src/a3d/checkout.nim diff --git a/src/contact.nim b/src/a3d/contact.nim similarity index 100% rename from src/contact.nim rename to src/a3d/contact.nim diff --git a/src/index.nim b/src/a3d/index.nim similarity index 100% rename from src/index.nim rename to src/a3d/index.nim diff --git a/src/shop.nim b/src/a3d/shop.nim similarity index 100% rename from src/shop.nim rename to src/a3d/shop.nim diff --git a/src/signup.nim b/src/a3d/signup.nim similarity index 100% rename from src/signup.nim rename to src/a3d/signup.nim diff --git a/src/a3d/tro.nim b/src/a3d/tro.nim new file mode 100644 index 0000000..f8860d2 --- /dev/null +++ b/src/a3d/tro.nim @@ -0,0 +1,48 @@ +import + mike, + segfaults, + os, + httpclient, + json, + nimja/parser, + dotenv + # ./a3pkg/[models, mics], + # ./a3c/[users] + +proc tro*(ctx: Context): JsonNode = + dotenv.load() + var + url = getEnv("DATABASE_URL") + auth_token = getEnv("AUTH_TOKEN") + + client = newHttpClient() + + ss = """DROP TABLE users;""" + + body = %*{ + "requests": [ + { "type": "execute", "stmt": { "sql": ss } }, + { "type": "close" } + ] + } + + # user: User + # db = newDatabase() + # user.firstName = "Kalpak" + # user.lastName = "Lahiri" + # user.email = "kalpak@lahiri.kl" + # user.password = "kalpak" + # user.accessLevel = 1 + # db.createPost(user) + + echo body + client.headers = newHttpHeaders({ "Authorization": "Bearer " & auth_token, "Content-Type": "application/json" }) + echo client.headers + + var + res = client.request(url, httpMethod = HttpPost, body = $body, headers = client.headers) + bb = parseJson(res.body) + g = bb["results"][0]["result"]["data"] + + echo g + return g \ No newline at end of file diff --git a/src/validation.nim b/src/a3pkg/validation.nim similarity index 100% rename from src/validation.nim rename to src/a3pkg/validation.nim