mirror of
https://codeberg.org/MarkusThielker/finances.git
synced 2025-04-16 15:49:23 +00:00
33 lines
892 B
TypeScript
33 lines
892 B
TypeScript
import { prismaClient } from '@/prisma';
|
|
import { getUser } from '@/auth';
|
|
import React from 'react';
|
|
import EntityPageClientContent from '@/components/EntityPageClientComponents';
|
|
import entityCreateUpdate from '@/lib/actions/entityCreateUpdate';
|
|
import entityDelete from '@/lib/actions/entityDelete';
|
|
|
|
export default async function EntitiesPage() {
|
|
|
|
const user = await getUser();
|
|
|
|
const entities = await prismaClient.entity.findMany({
|
|
where: {
|
|
userId: user?.id,
|
|
},
|
|
orderBy: [
|
|
{
|
|
type: 'desc',
|
|
},
|
|
{
|
|
id: 'asc',
|
|
},
|
|
],
|
|
});
|
|
|
|
return (
|
|
<EntityPageClientContent
|
|
entities={entities}
|
|
onSubmit={entityCreateUpdate}
|
|
onDelete={entityDelete}
|
|
className="flex flex-col justify-center space-y-4 p-10"/>
|
|
);
|
|
}
|