feat: verschlüsselte Integrationseinstellungen, Haushaltsmitglieder mit Ersteller, Backup-Download
This commit is contained in:
1 parent
a1195223e0
commit
267f4fcf70
21 files changed
+724
-30
No files matched your search
@@ -9,7 +9,7 @@ export async function GET(_req: NextRequest, { params }: { params: Promise<{ id:
|
||||
const db = getDb();
|
||||
const v = await db.voucher.findUnique({ where: { id: numId }, include: { contacts: { include: { contact: true } } } });
|
||||
if (!v) return NextResponse.json({ error: "not found" }, { status: 404 });
|
||||
return NextResponse.json(withLogoUrl(v));
|
||||
return NextResponse.json(await withLogoUrl(v));
|
||||
}
|
||||
|
||||
export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function GET(req: NextRequest) {
|
||||
if (filter === "aktiv") return s === "aktiv";
|
||||
return true;
|
||||
});
|
||||
return NextResponse.json(filtered.map(withLogoUrl));
|
||||
return NextResponse.json(await Promise.all(filtered.map(withLogoUrl)));
|
||||
}
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
@@ -44,6 +44,14 @@ export async function POST(req: NextRequest) {
|
||||
return NextResponse.json({ errors: ["contactIds"] }, { status: 400 });
|
||||
}
|
||||
}
|
||||
let createdBy: string | null = null;
|
||||
if (body.memberId !== undefined && body.memberId !== null && String(body.memberId).trim() !== "") {
|
||||
const memberId = Number(body.memberId);
|
||||
if (!Number.isInteger(memberId)) return NextResponse.json({ errors: ["memberId"] }, { status: 400 });
|
||||
const member = await db.householdMember.findUnique({ where: { id: memberId } });
|
||||
if (!member) return NextResponse.json({ errors: ["memberId"] }, { status: 400 });
|
||||
createdBy = member.name;
|
||||
}
|
||||
const providerDomain = normalizeDomain(
|
||||
body.providerDomain === undefined || body.providerDomain === null ? null : String(body.providerDomain)
|
||||
);
|
||||
@@ -72,6 +80,7 @@ export async function POST(req: NextRequest) {
|
||||
kategorie: input.kategorie,
|
||||
notiz: input.notiz,
|
||||
providerDomain,
|
||||
createdBy,
|
||||
contacts: contactIds.length ? { create: contactIds.map((contactId) => ({ contactId })) } : undefined,
|
||||
rules: {
|
||||
create: reminderDays.map((tageVorher) => ({ tageVorher })),
|
||||
|
||||
Reference in new issue
Block a user