mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
move queries
This commit is contained in:
parent
910f165103
commit
8aec6d7406
53 changed files with 920 additions and 485 deletions
25
queries/admin/website/getAllWebsites.js
Normal file
25
queries/admin/website/getAllWebsites.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { runQuery } from 'queries';
|
||||
import prisma from 'lib/db';
|
||||
|
||||
export async function getAllWebsites() {
|
||||
let data = await runQuery(
|
||||
prisma.website.findMany({
|
||||
orderBy: [
|
||||
{
|
||||
user_id: 'asc',
|
||||
},
|
||||
{
|
||||
name: 'asc',
|
||||
},
|
||||
],
|
||||
include: {
|
||||
account: {
|
||||
select: {
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
return data.map(i => ({ ...i, account: i.account.username }));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue