mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-03 15:47:30 +01:00
25 lines
519 B
TypeScript
25 lines
519 B
TypeScript
import { Website } from '@prisma/client';
|
|
import prisma from 'lib/prisma';
|
|
|
|
export async function getAllWebsites(): Promise<(Website & { user: string })[]> {
|
|
return await prisma.client.website
|
|
.findMany({
|
|
orderBy: [
|
|
{
|
|
userId: 'asc',
|
|
},
|
|
{
|
|
name: 'asc',
|
|
},
|
|
],
|
|
include: {
|
|
user: {
|
|
select: {
|
|
username: true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
.then(data => data.map(i => ({ ...i, user: i.user.username })));
|
|
}
|