move queries
This commit is contained in:
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 }));
|
||||
}
|
||||
Reference in New Issue
Block a user