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: [
|
|
|
|
{
|
2022-10-10 22:42:18 +02:00
|
|
|
userId: 'asc',
|
2022-08-28 06:38:35 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'asc',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
include: {
|
2022-11-01 07:42:37 +01:00
|
|
|
user: {
|
2022-08-28 06:38:35 +02:00
|
|
|
select: {
|
|
|
|
username: true,
|
2022-07-12 23:14:36 +02:00
|
|
|
},
|
|
|
|
},
|
2022-08-28 06:38:35 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-11-01 07:42:37 +01:00
|
|
|
return data.map(i => ({ ...i, user: i.user.username }));
|
2022-07-12 23:14:36 +02:00
|
|
|
}
|