mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
Initial Typescript models.
This commit is contained in:
parent
04e9f06e93
commit
0aaba8cbd1
74 changed files with 1144 additions and 768 deletions
24
queries/admin/website/getAllWebsites.ts
Normal file
24
queries/admin/website/getAllWebsites.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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 })));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue