add: idk
This commit is contained in:
parent
d21aaa1757
commit
4e7dede837
|
@ -8,7 +8,9 @@ interface GetAccountsParameters {
|
||||||
skip?: number;
|
skip?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAccounts(args?: GetAccountsParameters): Promise<Pick<Users, "id" | "firstName" | "lastName" | "isAdmin" | "isTeacher">[]> {
|
export type Account = Pick<Users, "id" | "firstName" | "lastName" | "isAdmin" | "isTeacher">;
|
||||||
|
|
||||||
|
export async function getAccounts(args?: GetAccountsParameters): Promise<Account[]> {
|
||||||
return await prisma.users.findMany({
|
return await prisma.users.findMany({
|
||||||
take: args?.take,
|
take: args?.take,
|
||||||
skip: args?.skip,
|
skip: args?.skip,
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { Account } from '@/actions/accounts';
|
||||||
|
import { ColumnDef, flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table"
|
||||||
|
|
||||||
|
export const columns: ColumnDef<Account>[] = [
|
||||||
|
{
|
||||||
|
accessorKey: 'lastName',
|
||||||
|
header: 'Last Name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'firstName',
|
||||||
|
header: 'First Name',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
interface DataTableProps<TData, TValue> {
|
||||||
|
columns: ColumnDef<TData, TValue>[]
|
||||||
|
data: TData[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DataTable<TData, TValue>({
|
||||||
|
columns,
|
||||||
|
data,
|
||||||
|
}: DataTableProps<TData, TValue>) {
|
||||||
|
const table = useReactTable({
|
||||||
|
data,
|
||||||
|
columns,
|
||||||
|
getCoreRowModel: getCoreRowModel(),
|
||||||
|
})
|
Loading…
Reference in New Issue