added sorvor admin page
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { JobCategory } from "./action";
|
||||
|
||||
type Props = {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default function Page() {
|
||||
return <h1>Hello, Next.js!</h1>;
|
||||
return <h1>Hello!</h1>;
|
||||
}
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user