This commit is contained in:
2026-03-12 12:50:30 +00:00
parent a34fd3aa20
commit ee62ac8f54
18 changed files with 258 additions and 93 deletions
+17 -6
View File
@@ -73,7 +73,7 @@ export default async function handler(
email,
password: new_user_password,
is_super_admin: user?.id ? 0 : 1,
username: slugify(username),
username: username ? slugify(username) : undefined,
},
],
table: "users",
@@ -90,20 +90,31 @@ export default async function handler(
(typeof NSQLiteTables)[number]
>({
table: "users",
query: {
query: {
is_super_admin: { value: "1" },
},
},
targetId: new_user_id,
});
const newly_inserted_user = newly_inserted_user_res.singleRes;
if (!newly_inserted_user?.id) {
console.log("newly_inserted_user_res", newly_inserted_user_res);
throw new Error(`Couldn't Find Newly inserted user.`);
}
if (user?.id && !newly_inserted_user.username) {
const newly_inserted_user_res = await NSQLite.delete<
NSQLITE_TURBOCI_ADMIN_USERS,
(typeof NSQLiteTables)[number]
>({
table: "users",
targetId: newly_inserted_user?.id,
});
throw new Error(`Couldn't set Newly inserted user username.`);
}
if (user?.id) {
console.log("newly_inserted_user", newly_inserted_user);
await setupDeploymentUser({ user_id: newly_inserted_user.id });
return res.json({