Database refactoring.
This commit is contained in:
@@ -1,24 +1,23 @@
|
||||
import { prisma, runQuery } from 'lib/relational';
|
||||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function getAllWebsites() {
|
||||
let data = await runQuery(
|
||||
prisma.website.findMany({
|
||||
orderBy: [
|
||||
{
|
||||
user_id: 'asc',
|
||||
},
|
||||
{
|
||||
name: 'asc',
|
||||
},
|
||||
],
|
||||
include: {
|
||||
account: {
|
||||
select: {
|
||||
username: true,
|
||||
},
|
||||
let data = await prisma.client.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