first commit

This commit is contained in:
Stefan Hacker
2026-01-29 01:16:54 +01:00
commit e209e9bbca
12105 changed files with 2480672 additions and 0 deletions
@@ -0,0 +1,53 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export async function getEmailsByCustomerId(customerId: number, includeInactive = false) {
const where: Record<string, unknown> = { customerId };
if (!includeInactive) {
where.isActive = true;
}
return prisma.stressfreiEmail.findMany({
where,
orderBy: { createdAt: 'desc' },
});
}
export async function getEmailById(id: number) {
return prisma.stressfreiEmail.findUnique({
where: { id },
});
}
export async function createEmail(data: {
customerId: number;
email: string;
platform?: string;
notes?: string;
}) {
return prisma.stressfreiEmail.create({
data: {
...data,
isActive: true,
},
});
}
export async function updateEmail(
id: number,
data: {
email?: string;
platform?: string;
notes?: string;
isActive?: boolean;
}
) {
return prisma.stressfreiEmail.update({
where: { id },
data,
});
}
export async function deleteEmail(id: number) {
return prisma.stressfreiEmail.delete({ where: { id } });
}