2024-04-22 17:00:59 -05:00
|
|
|
import { prisma } from "@/lib/api/db";
|
|
|
|
|
|
|
|
export default async function getUsers() {
|
|
|
|
// Get all users
|
|
|
|
const users = await prisma.user.findMany({
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
username: true,
|
|
|
|
email: true,
|
|
|
|
emailVerified: true,
|
|
|
|
subscriptions: {
|
|
|
|
select: {
|
|
|
|
active: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
createdAt: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2024-10-06 00:59:31 -05:00
|
|
|
return { response: users.sort((a: any, b: any) => a.id - b.id), status: 200 };
|
2024-04-22 17:00:59 -05:00
|
|
|
}
|