feat(portal): configure customer portal accent color in company settings

This commit is contained in:
2026-10-13 19:06:33 +02:00
parent 5463106938
commit 6eea3c0687
5 changed files with 114 additions and 5 deletions

View File

@@ -58,6 +58,7 @@ export default async function meRoutes(server: FastifyInstance) {
features: tenants.features,
extraModules: tenants.extraModules,
businessInfo: tenants.businessInfo,
portalConfig: tenants.portalConfig,
numberRanges: tenants.numberRanges,
accountChart: tenants.accountChart,
taxEvaluationPeriod: tenants.taxEvaluationPeriod,

View File

@@ -271,6 +271,16 @@ export default async function tenantRoutes(server: FastifyInstance) {
if (!data) return reply.code(400).send({ error: "data required" })
if (Object.prototype.hasOwnProperty.call(data, "portalConfig")) {
const config = data.portalConfig
if (!config || typeof config !== "object" || Array.isArray(config)
|| typeof config.primaryColor !== "string" || !/^#[0-9a-f]{6}$/i.test(config.primaryColor.trim())) {
return reply.code(400).send({ error: "Die Portal-Akzentfarbe muss ein Hex-Farbwert wie #69c350 sein." })
}
data.portalConfig = { ...config, primaryColor: config.primaryColor.trim().toLowerCase() }
delete data.portalConfig.primayColor
}
const updated = await server.db
.update(tenants)
.set(data)