Add owner column to admin website settings table

This commit is contained in:
Chris Walsh 2021-12-01 16:03:18 -08:00
parent b756fcddf1
commit 9cff025784
No known key found for this signature in database
GPG key ID: 28EE0CCA6032019E
3 changed files with 80 additions and 14 deletions

View file

@ -115,6 +115,29 @@ export async function getUserWebsites(user_id) {
);
}
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 }));
}
export async function createWebsite(user_id, data) {
return runQuery(
prisma.website.create({