chore: germantax customer project
This commit is contained in:
49
packages/functions/src/templates/index.ts
Normal file
49
packages/functions/src/templates/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { z } from 'zod'
|
||||
import { annualBudgetApproval } from './annual-budget-approval.js'
|
||||
import { mdAppointment } from './md-appointment.js'
|
||||
import { annualFinancialsApproval } from './annual-financials-approval.js'
|
||||
import { profitDistribution } from './profit-distribution.js'
|
||||
import { mdDismissal } from './md-dismissal.js'
|
||||
import { capitalIncrease } from './capital-increase.js'
|
||||
import { shareTransferApproval } from './share-transfer-approval.js'
|
||||
|
||||
export interface ResolutionTemplate {
|
||||
key: string
|
||||
titleDe: string
|
||||
titleEn: string
|
||||
descriptionDe: string
|
||||
schema: z.ZodTypeAny
|
||||
fields: TemplateField[]
|
||||
render: (ctx: TemplateRenderContext) => string
|
||||
}
|
||||
|
||||
export interface TemplateField {
|
||||
key: string
|
||||
labelDe: string
|
||||
labelEn: string
|
||||
type: 'text' | 'textarea' | 'number' | 'date' | 'currency'
|
||||
required?: boolean
|
||||
}
|
||||
|
||||
export interface TemplateRenderContext {
|
||||
values: Record<string, unknown>
|
||||
company: { name: string; registryNo?: string | null; address?: string | null }
|
||||
members: Array<{ displayName: string; role: string; shares: number | null }>
|
||||
createdBy: { displayName: string; email: string }
|
||||
date: string
|
||||
}
|
||||
|
||||
const registry: Record<string, ResolutionTemplate> = {
|
||||
[annualBudgetApproval.key]: annualBudgetApproval,
|
||||
[annualFinancialsApproval.key]: annualFinancialsApproval,
|
||||
[profitDistribution.key]: profitDistribution,
|
||||
[mdAppointment.key]: mdAppointment,
|
||||
[mdDismissal.key]: mdDismissal,
|
||||
[capitalIncrease.key]: capitalIncrease,
|
||||
[shareTransferApproval.key]: shareTransferApproval,
|
||||
}
|
||||
|
||||
export const listTemplates = (): ResolutionTemplate[] => Object.values(registry)
|
||||
|
||||
export const getTemplate = (key: string): ResolutionTemplate | undefined =>
|
||||
registry[key]
|
||||
Reference in New Issue
Block a user