umami/queries/admin/website/getAllWebsites.js

24 lines
405 B
JavaScript
Raw Normal View History

2022-08-28 06:38:35 +02:00
import prisma from 'lib/prisma';
2022-07-12 23:14:36 +02:00
export async function getAllWebsites() {
2022-08-28 06:38:35 +02:00
let data = await prisma.client.website.findMany({
orderBy: [
{
user_id: 'asc',
},
{
name: 'asc',
},
],
include: {
account: {
select: {
username: true,
2022-07-12 23:14:36 +02:00
},
},
2022-08-28 06:38:35 +02:00
},
});
2022-07-12 23:14:36 +02:00
return data.map(i => ({ ...i, account: i.account.username }));
}