This commit is contained in:
2026-03-11 04:44:11 +00:00
parent 2e0009e3ca
commit 78adca7091
14 changed files with 94 additions and 36 deletions
+11 -1
View File
@@ -1,6 +1,8 @@
import Main from "@/src/components/pages/admin/users";
import { NSQLITE_TURBOCI_ADMIN_USERS } from "@/src/db/types";
import defaultAdminProps from "@/src/functions/pages/admin/default-admin-props";
import Layout from "@/src/layouts/admin";
import NSQLite from "@moduletrace/nsqlite";
import { GetServerSideProps } from "next";
export default function AdminDashboard() {
@@ -19,7 +21,15 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
return `/admin`;
}
return {};
const users_res = await NSQLite.select<NSQLITE_TURBOCI_ADMIN_USERS>(
{
table: "users",
},
);
return {
deployment_users: users_res.payload,
};
},
});
};
+4 -4
View File
@@ -1,4 +1,4 @@
import { NSQLITE_TEST_DB_USERS, NSQLiteTables } from "@/src/db/types";
import { NSQLITE_TURBOCI_ADMIN_USERS, NSQLiteTables } from "@/src/db/types";
import { APIReqObject } from "@/src/types";
import loginUser from "@/src/functions/auth/login-user";
import hashPassword from "@moduletrace/datasquirel/dist/package-shared/functions/dsql/hashPassword";
@@ -29,7 +29,7 @@ export default async function handler(
}
const existing_users_res = await NSQLite.select<
NSQLITE_TEST_DB_USERS,
NSQLITE_TURBOCI_ADMIN_USERS,
(typeof NSQLiteTables)[number]
>({
table: "users",
@@ -47,7 +47,7 @@ export default async function handler(
const new_user_password = hashPassword({ password });
const new_user_insert_res = await NSQLite.insert<
NSQLITE_TEST_DB_USERS,
NSQLITE_TURBOCI_ADMIN_USERS,
(typeof NSQLiteTables)[number]
>({
data: [
@@ -71,7 +71,7 @@ export default async function handler(
}
const newly_inserted_user_res = await NSQLite.select<
NSQLITE_TEST_DB_USERS,
NSQLITE_TURBOCI_ADMIN_USERS,
(typeof NSQLiteTables)[number]
>({
table: "users",
+1 -1
View File
@@ -16,7 +16,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
return {
redirect: {
destination: `/login`,
destination: `/auth/login`,
statusCode: 307,
},
};