Merge pull request '025' (#6) from ayushman into main

Reviewed-on: #6
This commit is contained in:
cereci5049 2024-08-04 21:29:04 +02:00
commit fa5d288c8e
2 changed files with 3 additions and 2 deletions

Binary file not shown.

View file

@ -11,7 +11,8 @@ proc setupUsers*(conn: Turso) =
id INTEGER PRIMARY KEY AUTOINCREMENT,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL,
phone VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL,
@ -20,7 +21,7 @@ proc setupUsers*(conn: Turso) =
""")
proc createPost*(conn: Turso, user: User)=
conn.execute(fmt"""INSERT INTO users (first_name, last_name, email, password, access_level) VALUES ("{user.firstName}", "{user.lastName}", "{user.email}", "{user.password}", {user.accessLevel});""")
conn.execute(fmt"""INSERT INTO users (first_name, last_name, email, phone, password, access_level) VALUES ("{user.firstName}", "{user.lastName}", "{user.email}", "{user.phone}", "{user.password}", {user.accessLevel});""")
proc getUser*(conn: Turso, email: string, password: string): (bool, User)=
var