Rename the operational unit "Praça"/"Núcleo" to "Município" (code identifier `municipality`) and land the 2026-07-23 course changes: - New `candidate` role with unrestricted visibility (`isCampaignStaff` now includes it) alongside coordinator/advisor; leader is locked down to the supporter contact tool only. - Demandas become staff-only; dobradinhas modeled via a `stateDeputy` entity. - Camaçari consolidated to a single município (ZE 170/171 aggregated); Salvador keeps its 19 zone municípios. - Map moves to the staff dashboard; `/campanha/municipios` is list/overview. - Vote pledges keep the declared vs estimated (scenario) asymmetry; leaders never see estimates. Destructive migration for the campaign vertical (drops nucleus/plaza-era tables, wipes campaign rows, seeds 435 municípios). Public-site data untouched. Includes the post-delivery /simplify cleanups: shared reloadStaffActor / reloadCoordinatorActor helpers, req.context cache for getFreshCampaignUser, parallelized dashboard loads, candidate dashboard-copy fix, and dead leader-dashboard / roleKind code removal.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
import { campaignDemandKinds, campaignDemandStatuses } from '@/lib/schemas/campaignDemand'
|
|
import {
|
|
positiveRelationshipId,
|
|
trimmedNullableText,
|
|
trimmedOptionalText,
|
|
} from '@/lib/schemas/primitives'
|
|
|
|
export const campaignDemandCreateSchema = z.object({
|
|
title: z.string().trim().min(2).max(160),
|
|
kind: z.enum(campaignDemandKinds),
|
|
description: trimmedOptionalText(4000),
|
|
municipality: positiveRelationshipId,
|
|
actionPlan: positiveRelationshipId.optional(),
|
|
/** Staff may record on behalf of a leadership; leaders get their own. */
|
|
leadership: positiveRelationshipId.optional(),
|
|
})
|
|
|
|
export const campaignDemandDetailsUpdateSchema = z.object({
|
|
id: positiveRelationshipId,
|
|
kind: z.enum(campaignDemandKinds).optional(),
|
|
description: trimmedNullableText(4000),
|
|
actionPlan: positiveRelationshipId.nullable().optional(),
|
|
})
|
|
|
|
export const campaignDemandTransitionSchema = z.object({
|
|
id: positiveRelationshipId,
|
|
status: z.enum(campaignDemandStatuses),
|
|
decisionNote: trimmedNullableText(2000),
|
|
})
|
|
|
|
export const campaignDemandCostSchema = z.object({
|
|
id: positiveRelationshipId,
|
|
cost: z.number().min(0).max(100_000_000).nullable(),
|
|
})
|
|
|
|
export type CampaignDemandCreateInput = z.input<typeof campaignDemandCreateSchema>
|
|
export type CampaignDemandDetailsUpdateInput = z.input<typeof campaignDemandDetailsUpdateSchema>
|
|
export type CampaignDemandTransitionInput = z.input<typeof campaignDemandTransitionSchema>
|
|
export type CampaignDemandCostInput = z.input<typeof campaignDemandCostSchema>
|