Rebuild as InnungsApp project: replace stadtwerke analysis with full documentation

- PRD: vollständige Produktspezifikation (5 Module, Scope, Akzeptanzkriterien)
- ARCHITECTURE: Tech Stack, Ordnerstruktur, Multi-Tenancy, Push, Kosten
- DATABASE_SCHEMA: Vollständiges SQL-Schema mit RLS Policies und Views
- USER_STORIES: 40+ Stories nach Rolle (Admin, Mitglied, Azubi, Obermeister)
- PERSONAS: 5 detaillierte Nutzerprofile mit Alltag, Zitaten und Erwartungen
- BUSINESS_MODEL: Preistabellen, Unit Economics, Revenue-Projektionen, Distribution
- ROADMAP: 6 Phasen, Sprint-Planung, Meilensteine und KPIs
- COMPETITIVE_ANALYSIS: Wettbewerbsmatrix, USPs, Preispositionierung
- API_DESIGN: Supabase Query Patterns, Edge Functions, Realtime Subscriptions
- ONBOARDING_FLOWS: 7 User Flows von Setup bis Fehlerfall
- GTM_STRATEGY: 3-Phasen-Vertrieb, Outreach-Sequenz, Einwandbehandlung
- AZUBI_MODULE: Video-Feed, 1-Click-Apply, Chat, Berichtsheft, Quiz
- DSGVO_KONZEPT: Rechtsgrundlagen, TOMs, AVV, Minderjährige, Incident Response
- FEATURES_BACKLOG: 72 Features nach MoSCoW + Technische Schulden

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Timo Knuth
2026-02-18 19:03:37 +01:00
parent fc68285cf1
commit fca42db4d2
116 changed files with 9329 additions and 6479 deletions

View File

@@ -0,0 +1,89 @@
import { z } from 'zod'
import { router, adminProcedure, publicProcedure } from '../trpc'
export const organizationsRouter = router({
/**
* Get own organization details
*/
me: adminProcedure.query(async ({ ctx }) => {
const org = await ctx.prisma.organization.findUniqueOrThrow({
where: { id: ctx.orgId },
})
return org
}),
/**
* Update org settings (admin only)
*/
update: adminProcedure
.input(
z.object({
name: z.string().min(3).optional(),
contactEmail: z.string().email().optional(),
primaryColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
})
)
.mutation(async ({ ctx, input }) => {
const org = await ctx.prisma.organization.update({
where: { id: ctx.orgId },
data: input,
})
return org
}),
/**
* Accept AVV (Auftragsverarbeitungsvertrag)
*/
acceptAvv: adminProcedure.mutation(async ({ ctx }) => {
const org = await ctx.prisma.organization.update({
where: { id: ctx.orgId },
data: {
avvAccepted: true,
avvAcceptedAt: new Date(),
},
})
return org
}),
/**
* Dashboard stats
*/
stats: adminProcedure.query(async ({ ctx }) => {
const now = new Date()
const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000)
const [activeMembers, newsThisWeek, upcomingTermine, activeStellen] =
await Promise.all([
ctx.prisma.member.count({
where: { orgId: ctx.orgId, status: 'aktiv' },
}),
ctx.prisma.news.count({
where: {
orgId: ctx.orgId,
publishedAt: { gte: weekAgo, not: null },
},
}),
ctx.prisma.termin.count({
where: { orgId: ctx.orgId, datum: { gte: now } },
}),
ctx.prisma.stelle.count({
where: { orgId: ctx.orgId, aktiv: true },
}),
])
return { activeMembers, newsThisWeek, upcomingTermine, activeStellen }
}),
/**
* Public org info by slug (for mobile onboarding)
*/
bySlug: publicProcedure
.input(z.object({ slug: z.string() }))
.query(async ({ ctx, input }) => {
const org = await ctx.prisma.organization.findUnique({
where: { slug: input.slug },
select: { id: true, name: true, slug: true, primaryColor: true, logoUrl: true },
})
return org
}),
})