/** * Representante legal da revenda — mirrors `client_registrations.pj_rep_*` * (packages/database/migrations/1788447739229_client-registrations.cjs). * Motivation (user, 2026-09-18): reseller registration data will later * feed reseller contract creation inside the ERP, same as * client_registrations already does for client contracts — a contract * needs a named, authorized signer for the legal entity, not just the * general Sócios list (`reseller_partners`, added in * 1789700000000_resellers-expansion.cjs). * * Deliberate deviation from `client_registrations.pj_rep_cpf`: there it's * structurally excluded from the generic admin PATCH (`UpdateClientRegistrationDto`) * because in the legacy it's only ever set during the public self-service * submission flow, which EDEN hasn't built yet — so it stays permanently * unset there today, a known pre-existing gap, not something to replicate. * Resellers have no such public submission flow (always backoffice-created) * and no "original submission" moment to lock behind, so `rep_cpf` here is * a plain, freely-PATCH-able column like every other reseller field — see * `resellers.service.ts`, no new DTO exclusion added for it. */ exports.shorthands = undefined; exports.up = (pgm) => { pgm.sql(` ALTER TABLE resellers ADD COLUMN rep_full_name TEXT, ADD COLUMN rep_cpf TEXT, ADD COLUMN rep_role TEXT, ADD COLUMN rep_email TEXT, ADD COLUMN rep_mobile_phone TEXT, ADD COLUMN rep_authorization_ack BOOLEAN NOT NULL DEFAULT false; COMMENT ON COLUMN resellers.rep_authorization_ack IS 'Confirmação de que o representante está autorizado a agir pela revenda — mesmo campo de intenção que client_registrations.pj_rep_authorization_ack, sem o mesmo bloqueio estrutural de edição (ver cabeçalho da migration).'; `); }; exports.down = (pgm) => { pgm.sql(` ALTER TABLE resellers DROP COLUMN IF EXISTS rep_full_name, DROP COLUMN IF EXISTS rep_cpf, DROP COLUMN IF EXISTS rep_role, DROP COLUMN IF EXISTS rep_email, DROP COLUMN IF EXISTS rep_mobile_phone, DROP COLUMN IF EXISTS rep_authorization_ack; `); };