mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
OH14 — remove orphaned transitionDemandFormAction after outbox-only path
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
9b56b641a6
commit
36f85e96d9
1 changed files with 0 additions and 34 deletions
|
|
@ -5,21 +5,14 @@ import { revalidatePath } from 'next/cache'
|
|||
import {
|
||||
attachCampaignDemandReceiptRecord,
|
||||
setCampaignDemandCost,
|
||||
transitionCampaignDemand,
|
||||
} from '@/app/(campaign)/campanha/actions/demand'
|
||||
import {
|
||||
FormDataBoundaryError,
|
||||
nullableFormText,
|
||||
requiredFormText,
|
||||
requiredRelationshipFormValue,
|
||||
} from '@/lib/formData'
|
||||
import {
|
||||
CAMPAIGN_DEMAND_COST_STAFF_MESSAGE,
|
||||
CAMPAIGN_DEMAND_INVALID_STATUS_MESSAGE,
|
||||
CAMPAIGN_DEMAND_RECEIPT_SAFE_MESSAGES,
|
||||
CAMPAIGN_DEMAND_TRANSITION_SAFE_MESSAGES,
|
||||
campaignDemandStatuses,
|
||||
type CampaignDemandStatus,
|
||||
} from '@/lib/schemas/campaignDemand'
|
||||
import { getCampaignActionContext } from '@/utilities/campaignActionContext'
|
||||
import {
|
||||
|
|
@ -27,33 +20,6 @@ import {
|
|||
type CampaignFormActionState,
|
||||
} from '@/utilities/campaignFormActionError'
|
||||
|
||||
const INVALID_STATUS_MESSAGE = CAMPAIGN_DEMAND_INVALID_STATUS_MESSAGE
|
||||
|
||||
const transitionSafeMessages = CAMPAIGN_DEMAND_TRANSITION_SAFE_MESSAGES
|
||||
|
||||
export const transitionDemandFormAction = async (
|
||||
_state: CampaignFormActionState,
|
||||
formData: FormData,
|
||||
): Promise<CampaignFormActionState> =>
|
||||
runCampaignFormAction({
|
||||
execute: async () => {
|
||||
const rawStatus = requiredFormText(formData, 'status')
|
||||
if (!campaignDemandStatuses.includes(rawStatus as CampaignDemandStatus)) {
|
||||
throw new Error(INVALID_STATUS_MESSAGE)
|
||||
}
|
||||
|
||||
await transitionCampaignDemand({
|
||||
id: requiredRelationshipFormValue(formData, 'demandId'),
|
||||
status: rawStatus as CampaignDemandStatus,
|
||||
decisionNote: nullableFormText(formData, 'decisionNote'),
|
||||
})
|
||||
revalidatePath('/campanha/demandas/[slug]', 'page')
|
||||
return { message: 'Demanda atualizada.' }
|
||||
},
|
||||
safeMessages: transitionSafeMessages,
|
||||
genericMessage: 'Não foi possível mover a demanda. Verifique seu acesso e tente novamente.',
|
||||
})
|
||||
|
||||
export const setDemandCostFormAction = async (
|
||||
_state: CampaignFormActionState,
|
||||
formData: FormData,
|
||||
|
|
|
|||
Loading…
Reference in a new issue