You've already forked obsidian-visualiser
Add insertion and deletion of tables for db sync, and user view
This commit is contained in:
@@ -62,13 +62,13 @@ export default defineEventHandler(async (e): Promise<Return> => {
|
||||
{
|
||||
const hash = await Bun.password.hash(body.data.password);
|
||||
const registration = db.query(`INSERT INTO users(username, email, hash, state) VALUES(?1, ?2, ?3, 0)`);
|
||||
registration.get(body.data.username, body.data.email, hash) as any;
|
||||
registration.run(body.data.username, body.data.email, hash);
|
||||
|
||||
const userIdQuery = db.query(`SELECT id FROM users WHERE username = ?1`);
|
||||
const id = (userIdQuery.get(body.data.username) as any).id;
|
||||
|
||||
const registeringData = db.query(`INSERT INTO users_data(user_id) VALUES(?1)`);
|
||||
registeringData.get(id);
|
||||
const registeringData = db.query(`INSERT INTO users_data(user_id, signin_timestamp) VALUES(?1, ?2)`);
|
||||
registeringData.run(id, Date.now());
|
||||
|
||||
logSession(e, await setUserSession(e, { user: { id: id, username: body.data.username, email: body.data.email, state: 0 } }) as UserSessionRequired);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user