mirror of
https://github.com/Fayorg/calendrier-avant.git
synced 2026-05-27 17:18:38 +02:00
add: idk
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
30
app/dashboard/AccountsTable.tsx
Normal file
30
app/dashboard/AccountsTable.tsx
Normal file
@@ -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(),
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user