Refactor year management in the database layer, enhance Year model with budget field, and update UI components for year selection and dashboard display

This commit is contained in:
Norbert Maciaszek
2025-11-25 00:16:21 +01:00
parent 1030991d92
commit f31eb3dc0d
15 changed files with 498 additions and 14 deletions

View File

@@ -11,11 +11,16 @@ const db = new PrismaClient({ adapter });
const GET = {
year: async (where: Prisma.YearWhereUniqueInput) => {
return await db.year.findUnique({
where
where,
include: {
people: true
}
});
},
years: async () => {
return await db.year.findMany();
years: async (where: Prisma.YearWhereInput) => {
return await db.year.findMany({
where
});
},
person: async (where: Prisma.PersonWhereUniqueInput) => {
@@ -23,9 +28,12 @@ const GET = {
where
});
},
people: async (where: Prisma.PersonWhereUniqueInput) => {
people: async (where: Prisma.PersonWhereInput) => {
return await db.person.findMany({
where
where,
include: {
gifts: true
}
});
},