chore(format): Prettier auf lead.ts anwenden

Alt-Bestand nie formatiert — isolierter Format-Lauf vor der dueFollowUps-Query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Raffael SheikhandClaude Opus 4.8 committed 2026-06-07 12:18:25 +02:00
1 parent 7dd1f2fb20
commit 3d9b739d25
1 file changed
+17 -11
+17 -11
View File
@@ -61,11 +61,13 @@ export const leadRouter = router({
.where(eq(leadTouchpoint.leadId, l.id))
.orderBy(desc(leadTouchpoint.datum), desc(leadTouchpoint.createdAt));
const linkedProject = l.projectId
? (await ctx.db
? ((
await ctx.db
.select({ id: project.id, name: project.name })
.from(project)
.where(eq(project.id, l.projectId))
.limit(1))[0] ?? null
.limit(1)
)[0] ?? null)
: null;
return {
lead: l,
@@ -75,9 +77,7 @@ export const leadRouter = router({
};
}),
create: protectedProcedure
.input(LeadSchemas.createLeadInput)
.mutation(async ({ ctx, input }) => {
create: protectedProcedure.input(LeadSchemas.createLeadInput).mutation(async ({ ctx, input }) => {
const areaId = await getSalesAreaId(ctx.db);
const [created] = await ctx.db
.insert(lead)
@@ -99,9 +99,7 @@ export const leadRouter = router({
return created;
}),
update: protectedProcedure
.input(LeadSchemas.updateLeadInput)
.mutation(async ({ ctx, input }) => {
update: protectedProcedure.input(LeadSchemas.updateLeadInput).mutation(async ({ ctx, input }) => {
const { id, ...patch } = input;
if (Object.keys(patch).length === 0) {
const existing = (await ctx.db.select().from(lead).where(eq(lead.id, id)).limit(1))[0];
@@ -121,7 +119,8 @@ export const leadRouter = router({
addContact: protectedProcedure
.input(LeadSchemas.addContactInput)
.mutation(async ({ ctx, input }) => {
const count = (
const count =
(
await ctx.db
.select({ c: sql<number>`count(*)::int` })
.from(leadContact)
@@ -222,7 +221,13 @@ export const leadRouter = router({
.mutation(async ({ ctx, input }) => {
const areaId = await getSalesAreaId(ctx.db);
const rows = parseCsv(input.csv);
const summary = { created: 0, skippedEmpty: 0, skippedDuplicate: 0, contacts: 0, touchpoints: 0 };
const summary = {
created: 0,
skippedEmpty: 0,
skippedDuplicate: 0,
contacts: 0,
touchpoints: 0,
};
if (rows.length < 2 || !rows[0]) return summary;
const header = rows[0].map(normalizeHeader);
@@ -243,7 +248,8 @@ export const leadRouter = router({
branche: col('branche'),
notizen: col('notizen'),
};
const get = (row: string[], i: number) => (i >= 0 && i < row.length ? (row[i] ?? '').trim() : '');
const get = (row: string[], i: number) =>
i >= 0 && i < row.length ? (row[i] ?? '').trim() : '';
const existing = await ctx.db.select({ firma: lead.firma }).from(lead);
const seen = new Set(existing.map((e) => e.firma.trim().toLowerCase()));