add create block

This commit is contained in:
Ren Amamiya
2023-05-24 21:09:52 +07:00
parent 221ff52a3f
commit 7aeff18a27
3 changed files with 126 additions and 7 deletions

View File

@@ -328,3 +328,17 @@ export async function getBlocks(account_id: number) {
`SELECT * FROM blocks WHERE account_id <= "${account_id}";`,
);
}
// create block
export async function createBlock(
account_id: number,
kind: number,
title: string,
content: any,
) {
const db = await connect();
return await db.execute(
"INSERT OR IGNORE INTO blocks (account_id, kind, title, content) VALUES (?, ?, ?, ?);",
[account_id, kind, title, content],
);
}