mirror of
https://github.com/Fayorg/calendrier-avant.git
synced 2026-05-28 01:28:37 +02:00
add: dashboard tabs
This commit is contained in:
26
actions/accounts.ts
Normal file
26
actions/accounts.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Users } from "@prisma/client";
|
||||
|
||||
interface GetAccountsParameters {
|
||||
take?: number;
|
||||
skip?: number;
|
||||
}
|
||||
|
||||
export async function getAccounts(args?: GetAccountsParameters): Promise<Pick<Users, "id" | "firstName" | "lastName" | "isAdmin" | "isTeacher">[]> {
|
||||
return await prisma.users.findMany({
|
||||
take: args?.take,
|
||||
skip: args?.skip,
|
||||
orderBy: {
|
||||
id: "asc",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
isAdmin: true,
|
||||
isTeacher: true,
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user