added sorvor admin page
Some checks failed
backend-admin-action / build-image (push) Failing after 8s
backend-action / build-image (push) Failing after 1m40s

This commit is contained in:
2024-05-20 16:48:06 +07:00
parent 98a65043c9
commit 23f37df217
14 changed files with 137 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useState } from "react";
import { JobCategory } from "./action";
type Props = {

View File

@@ -10,7 +10,7 @@ export default async function Page() {
.findMany({ with: { zones: true } })
.execute();
const jobList = await db.query.group.findMany().execute();
let r = await db.query.user
const r = await db.query.user
.findMany({ columns: { id: true }, where: eq(user.verified, true) })
.execute()
.then((v) => v.length);

View File

@@ -4,7 +4,7 @@ import { user } from "@/src/schema";
import { inArray } from "drizzle-orm";
export async function saveUser(cids: string[]) {
let rs = await db
const rs = await db
.update(user)
.set({ verified: true })
.where(inArray(user.cid, cids))

View File

@@ -6,7 +6,7 @@ import IdComponent from "./IdComponent";
export default function Page() {
const [idList, setIdList] = useState<string[]>([]);
async function submit() {
let rs = await saveUser(idList);
const rs = await saveUser(idList);
alert(`อัพเดทสำเร็จ ${rs.changes} คน`);
}
return (

View File

@@ -1,3 +1,3 @@
export default function Page() {
return <h1>Hello, Next.js!</h1>;
return <h1>Hello!</h1>;
}

View File

@@ -2,19 +2,11 @@ import { db } from "@/src/db";
import LocationSelector from "../../components/LocationSelector";
import LocationContextProvider from "@/components/locationContext";
import TotalSetter from "./TotalSetter";
import { eq } from "drizzle-orm";
import { user } from "@/src/schema";
export default async function Page() {
const provinces = await db.query.province
.findMany({ with: { zones: true } })
.execute();
const jobList = await db.query.group.findMany().execute();
let r = await db.query.user
.findMany({ columns: { id: true }, where: eq(user.verified, true) })
.execute()
.then((v) => v.length);
console.log(r);
return (
<LocationContextProvider>
<LocationSelector provinces={provinces} />