Database refactoring.

This commit is contained in:
Mike Cao 2022-08-27 21:38:35 -07:00
parent bb184dc2cc
commit 467c7f289f
37 changed files with 566 additions and 591 deletions

View file

@ -1,21 +1,19 @@
import { prisma, runQuery } from 'lib/relational';
import prisma from 'lib/prisma';
export async function getAccounts() {
return runQuery(
prisma.account.findMany({
orderBy: [
{ is_admin: 'desc' },
{
username: 'asc',
},
],
select: {
user_id: true,
username: true,
is_admin: true,
created_at: true,
updated_at: true,
return prisma.client.account.findMany({
orderBy: [
{ is_admin: 'desc' },
{
username: 'asc',
},
}),
);
],
select: {
user_id: true,
username: true,
is_admin: true,
created_at: true,
updated_at: true,
},
});
}