mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13:06 +00:00
OH10: prettier format for gate:push
This commit is contained in:
parent
13793e3092
commit
0908f8d4d6
13 changed files with 30 additions and 31 deletions
|
|
@ -86,7 +86,8 @@ export const setMunicipalityPoliticalTrendRecord = async (
|
||||||
input: MunicipalityPoliticalTrendInput,
|
input: MunicipalityPoliticalTrendInput,
|
||||||
options?: { cas?: boolean },
|
options?: { cas?: boolean },
|
||||||
) => {
|
) => {
|
||||||
const { municipality, status, note, baseUpdatedAt } = municipalityPoliticalTrendSchema.parse(input)
|
const { municipality, status, note, baseUpdatedAt } =
|
||||||
|
municipalityPoliticalTrendSchema.parse(input)
|
||||||
const enforceCas = options?.cas === true
|
const enforceCas = options?.cas === true
|
||||||
const currentActor = await getFreshStaffActor(payload, actor)
|
const currentActor = await getFreshStaffActor(payload, actor)
|
||||||
|
|
||||||
|
|
@ -263,7 +264,9 @@ export const setMunicipalityEngagementLevel = async (input: MunicipalityEngageme
|
||||||
return setMunicipalityEngagementLevelRecord(payload, actor, input)
|
return setMunicipalityEngagementLevelRecord(payload, actor, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setMunicipalityEngagementLevelCas = async (input: MunicipalityEngagementLevelInput) => {
|
export const setMunicipalityEngagementLevelCas = async (
|
||||||
|
input: MunicipalityEngagementLevelInput,
|
||||||
|
) => {
|
||||||
const { payload, actor } = await getCampaignActionContext()
|
const { payload, actor } = await getCampaignActionContext()
|
||||||
return setMunicipalityEngagementLevelRecord(payload, actor, input, { cas: true })
|
return setMunicipalityEngagementLevelRecord(payload, actor, input, { cas: true })
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +284,8 @@ export const assignMunicipalityAdvisorsRecord = async (
|
||||||
input: MunicipalityAdvisorsAssignmentInput,
|
input: MunicipalityAdvisorsAssignmentInput,
|
||||||
options?: { cas?: boolean },
|
options?: { cas?: boolean },
|
||||||
) => {
|
) => {
|
||||||
const { municipality, advisors, baseUpdatedAt } = municipalityAdvisorsAssignmentSchema.parse(input)
|
const { municipality, advisors, baseUpdatedAt } =
|
||||||
|
municipalityAdvisorsAssignmentSchema.parse(input)
|
||||||
const enforceCas = options?.cas === true
|
const enforceCas = options?.cas === true
|
||||||
|
|
||||||
return withPayloadTransaction(
|
return withPayloadTransaction(
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
import type { Payload } from 'payload'
|
import type { Payload } from 'payload'
|
||||||
|
|
||||||
import { assertOpsUpdatedAtCas } from '@/lib/schemas/opsCas'
|
|
||||||
import {
|
import {
|
||||||
municipalityUpdateCreateSchema,
|
municipalityUpdateCreateSchema,
|
||||||
type MunicipalityUpdateCreateInput,
|
type MunicipalityUpdateCreateInput,
|
||||||
} from '@/lib/schemas/municipalityUpdate'
|
} from '@/lib/schemas/municipalityUpdate'
|
||||||
|
import { assertOpsUpdatedAtCas } from '@/lib/schemas/opsCas'
|
||||||
import type { CampaignUser } from '@/payload-types'
|
import type { CampaignUser } from '@/payload-types'
|
||||||
import { getCampaignActionContext, reloadCampaignActor } from '@/utilities/campaignActionContext'
|
import { getCampaignActionContext, reloadCampaignActor } from '@/utilities/campaignActionContext'
|
||||||
import { hookFilledCreateData } from '@/utilities/hookFilledData'
|
import { hookFilledCreateData } from '@/utilities/hookFilledData'
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,6 @@ import {
|
||||||
formatAdvisorNamesTooltip,
|
formatAdvisorNamesTooltip,
|
||||||
MunicipalityAdvisorAvatarStack,
|
MunicipalityAdvisorAvatarStack,
|
||||||
} from '@/components/campaign/municipality/MunicipalityAdvisorAvatarStack'
|
} from '@/components/campaign/municipality/MunicipalityAdvisorAvatarStack'
|
||||||
import {
|
|
||||||
CampaignCellEditOverlay,
|
|
||||||
type CampaignCellEditOverlayVariant,
|
|
||||||
} from '@/components/campaign/shared/CampaignCellEditOverlay'
|
|
||||||
import { useCampaignCellFailureChannel } from '@/components/campaign/shared/useCampaignCellFailureChannel'
|
|
||||||
import { municipalitiesCollection } from '@/components/campaign/opsSync/opsMirrorClient'
|
import { municipalitiesCollection } from '@/components/campaign/opsSync/opsMirrorClient'
|
||||||
import {
|
import {
|
||||||
discardOpsAdvisorsOutboxRow,
|
discardOpsAdvisorsOutboxRow,
|
||||||
|
|
@ -24,14 +19,19 @@ import {
|
||||||
subscribeOpsAdvisorsOutboxRow,
|
subscribeOpsAdvisorsOutboxRow,
|
||||||
} from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
} from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
||||||
import type { OpsMunicipalityWriteSyncStatus } from '@/components/campaign/opsSync/opsMunicipalityOutboxModel'
|
import type { OpsMunicipalityWriteSyncStatus } from '@/components/campaign/opsSync/opsMunicipalityOutboxModel'
|
||||||
|
import {
|
||||||
|
CampaignCellEditOverlay,
|
||||||
|
type CampaignCellEditOverlayVariant,
|
||||||
|
} from '@/components/campaign/shared/CampaignCellEditOverlay'
|
||||||
|
import { useCampaignCellFailureChannel } from '@/components/campaign/shared/useCampaignCellFailureChannel'
|
||||||
import { Alert, AlertDescription } from '@/components/ui/Alert'
|
import { Alert, AlertDescription } from '@/components/ui/Alert'
|
||||||
import { Badge } from '@/components/ui/Badge'
|
import { Badge } from '@/components/ui/Badge'
|
||||||
import { Command, CommandInput, CommandItem, CommandList } from '@/components/ui/Command'
|
import { Command, CommandInput, CommandItem, CommandList } from '@/components/ui/Command'
|
||||||
import { Spinner } from '@/components/ui/Spinner'
|
import { Spinner } from '@/components/ui/Spinner'
|
||||||
import { postCampaignJson } from '@/lib/campaignJsonRequest'
|
import { postCampaignJson } from '@/lib/campaignJsonRequest'
|
||||||
import { resolveOpsHybridEnabled } from '@/lib/campaignOps/opsHybridFlag'
|
import { resolveOpsHybridEnabled } from '@/lib/campaignOps/opsHybridFlag'
|
||||||
import { OPS_UPDATED_AT_CONFLICT_MESSAGE } from '@/lib/schemas/opsCas'
|
|
||||||
import { sameIdSet } from '@/lib/sameIdSet'
|
import { sameIdSet } from '@/lib/sameIdSet'
|
||||||
|
import { OPS_UPDATED_AT_CONFLICT_MESSAGE } from '@/lib/schemas/opsCas'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { matchesAtWordStart } from '@/lib/wordStartFilter'
|
import { matchesAtWordStart } from '@/lib/wordStartFilter'
|
||||||
import type {
|
import type {
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ import { useEffect, useRef, useState } from 'react'
|
||||||
|
|
||||||
import type { MunicipalityListEngagementLevelResponse } from '@/app/(campaign)/campanha/(app)/municipios/engagement-level/types'
|
import type { MunicipalityListEngagementLevelResponse } from '@/app/(campaign)/campanha/(app)/municipios/engagement-level/types'
|
||||||
import { MunicipalityLevelBadge } from '@/components/campaign/municipality/MunicipalityLevelBadge'
|
import { MunicipalityLevelBadge } from '@/components/campaign/municipality/MunicipalityLevelBadge'
|
||||||
|
import { municipalitiesCollection } from '@/components/campaign/opsSync/opsMirrorClient'
|
||||||
|
import { enqueueEngagementLevel } from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
||||||
import {
|
import {
|
||||||
CampaignCellEditOverlay,
|
CampaignCellEditOverlay,
|
||||||
type CampaignCellEditOverlayVariant,
|
type CampaignCellEditOverlayVariant,
|
||||||
} from '@/components/campaign/shared/CampaignCellEditOverlay'
|
} from '@/components/campaign/shared/CampaignCellEditOverlay'
|
||||||
import { useCampaignCellFailureChannel } from '@/components/campaign/shared/useCampaignCellFailureChannel'
|
import { useCampaignCellFailureChannel } from '@/components/campaign/shared/useCampaignCellFailureChannel'
|
||||||
import { municipalitiesCollection } from '@/components/campaign/opsSync/opsMirrorClient'
|
|
||||||
import { enqueueEngagementLevel } from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
|
||||||
import { Alert, AlertDescription } from '@/components/ui/Alert'
|
import { Alert, AlertDescription } from '@/components/ui/Alert'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Checkbox } from '@/components/ui/Checkbox'
|
import { Checkbox } from '@/components/ui/Checkbox'
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ import type {
|
||||||
MunicipalityListPoliticalTrendResponse,
|
MunicipalityListPoliticalTrendResponse,
|
||||||
MunicipalityListSavedPoliticalTrend,
|
MunicipalityListSavedPoliticalTrend,
|
||||||
} from '@/app/(campaign)/campanha/(app)/municipios/political-trend/types'
|
} from '@/app/(campaign)/campanha/(app)/municipios/political-trend/types'
|
||||||
|
import { municipalitiesCollection } from '@/components/campaign/opsSync/opsMirrorClient'
|
||||||
|
import { enqueuePoliticalTrend } from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
||||||
import {
|
import {
|
||||||
CampaignCellEditOverlay,
|
CampaignCellEditOverlay,
|
||||||
type CampaignCellEditOverlayVariant,
|
type CampaignCellEditOverlayVariant,
|
||||||
} from '@/components/campaign/shared/CampaignCellEditOverlay'
|
} from '@/components/campaign/shared/CampaignCellEditOverlay'
|
||||||
import { useCampaignCellAutosave } from '@/components/campaign/shared/useCampaignCellAutosave'
|
import { useCampaignCellAutosave } from '@/components/campaign/shared/useCampaignCellAutosave'
|
||||||
import { municipalitiesCollection } from '@/components/campaign/opsSync/opsMirrorClient'
|
|
||||||
import { enqueuePoliticalTrend } from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
|
||||||
import { Alert, AlertDescription } from '@/components/ui/Alert'
|
import { Alert, AlertDescription } from '@/components/ui/Alert'
|
||||||
import { Badge } from '@/components/ui/Badge'
|
import { Badge } from '@/components/ui/Badge'
|
||||||
import { Field, FieldLabel } from '@/components/ui/field'
|
import { Field, FieldLabel } from '@/components/ui/field'
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
import { createCollection, localOnlyCollectionOptions } from '@tanstack/db'
|
import { createCollection, localOnlyCollectionOptions } from '@tanstack/db'
|
||||||
|
|
||||||
import { collectOpsEstimateOutboxKeys } from '@/components/campaign/opsSync/opsEstimateOutbox'
|
import { collectOpsEstimateOutboxKeys } from '@/components/campaign/opsSync/opsEstimateOutbox'
|
||||||
import { collectOpsMunicipalityOutboxKeys } from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
|
||||||
import {
|
import {
|
||||||
openOpsMirrorStore,
|
openOpsMirrorStore,
|
||||||
type OpsMirrorPersistenceMode,
|
type OpsMirrorPersistenceMode,
|
||||||
type OpsMirrorStore,
|
type OpsMirrorStore,
|
||||||
} from '@/components/campaign/opsSync/opsMirrorPersistence'
|
} from '@/components/campaign/opsSync/opsMirrorPersistence'
|
||||||
|
import { collectOpsMunicipalityOutboxKeys } from '@/components/campaign/opsSync/opsMunicipalityOutbox'
|
||||||
import { votePledgesCollection } from '@/components/campaign/opsSync/opsVotePledgeMirror'
|
import { votePledgesCollection } from '@/components/campaign/opsSync/opsVotePledgeMirror'
|
||||||
import {
|
import {
|
||||||
createEmptyOpsSnapshot,
|
createEmptyOpsSnapshot,
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ import {
|
||||||
applyOpsVotePledgeEstimateWrite,
|
applyOpsVotePledgeEstimateWrite,
|
||||||
votePledgesCollection,
|
votePledgesCollection,
|
||||||
} from '@/components/campaign/opsSync/opsVotePledgeMirror'
|
} from '@/components/campaign/opsSync/opsVotePledgeMirror'
|
||||||
import type { EngagementLevel } from '@/lib/engagementLevel'
|
|
||||||
import { opsOutboxKey, type OpsOutboxKey } from '@/lib/campaignOps/opsContract'
|
import { opsOutboxKey, type OpsOutboxKey } from '@/lib/campaignOps/opsContract'
|
||||||
|
import type { EngagementLevel } from '@/lib/engagementLevel'
|
||||||
import type { PoliticalTrendStatusValue } from '@/lib/schemas/municipality'
|
import type { PoliticalTrendStatusValue } from '@/lib/schemas/municipality'
|
||||||
import type {
|
import type {
|
||||||
MunicipalitySignalType,
|
MunicipalitySignalType,
|
||||||
|
|
@ -378,7 +378,8 @@ export const enqueueDeclareVotes = async (input: {
|
||||||
input.pledgeId !== undefined
|
input.pledgeId !== undefined
|
||||||
? votePledgesCollection.get(input.pledgeId)
|
? votePledgesCollection.get(input.pledgeId)
|
||||||
: votePledgesCollection.toArray.find(
|
: votePledgesCollection.toArray.find(
|
||||||
(row) => row.leadership === input.leadershipId && row.municipality === input.municipalityId,
|
(row) =>
|
||||||
|
row.leadership === input.leadershipId && row.municipality === input.municipalityId,
|
||||||
)
|
)
|
||||||
const pledgeId = input.pledgeId ?? mirrorPledge?.id
|
const pledgeId = input.pledgeId ?? mirrorPledge?.id
|
||||||
const baseUpdatedAt =
|
const baseUpdatedAt =
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,8 @@ export const collapseEngagementLevelOutbox = (
|
||||||
transactions: OfflineTransaction[],
|
transactions: OfflineTransaction[],
|
||||||
): OfflineTransaction[] => collapseByMetadataKey(transactions, 'municipalityId')
|
): OfflineTransaction[] => collapseByMetadataKey(transactions, 'municipalityId')
|
||||||
|
|
||||||
export const collapseAdvisorsOutbox = (
|
export const collapseAdvisorsOutbox = (transactions: OfflineTransaction[]): OfflineTransaction[] =>
|
||||||
transactions: OfflineTransaction[],
|
collapseByMetadataKey(transactions, 'municipalityId')
|
||||||
): OfflineTransaction[] => collapseByMetadataKey(transactions, 'municipalityId')
|
|
||||||
|
|
||||||
const collapseByMetadataKey = (
|
const collapseByMetadataKey = (
|
||||||
transactions: OfflineTransaction[],
|
transactions: OfflineTransaction[],
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,7 @@ type UseCampaignCellAutosaveOptions<TValue, TResponse extends CampaignCellAutosa
|
||||||
* OH10 — optional persist path (outbox). When set, replaces the JSON POST.
|
* OH10 — optional persist path (outbox). When set, replaces the JSON POST.
|
||||||
* Must resolve a success-shaped payload so `readSaved` can adopt the value.
|
* Must resolve a success-shaped payload so `readSaved` can adopt the value.
|
||||||
*/
|
*/
|
||||||
persist?: (
|
persist?: (value: TValue, signal: AbortSignal) => Promise<{ ok: boolean; payload: TResponse }>
|
||||||
value: TValue,
|
|
||||||
signal: AbortSignal,
|
|
||||||
) => Promise<{ ok: boolean; payload: TResponse }>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -321,4 +321,4 @@ const HybridDeclareVotesForm = ({
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { ENGAGEMENT_LEVEL_TEXT_MAX_LENGTH, engagementLevels } from '@/lib/engagementLevel'
|
import { ENGAGEMENT_LEVEL_TEXT_MAX_LENGTH, engagementLevels } from '@/lib/engagementLevel'
|
||||||
import { optionalBaseUpdatedAtSchema, OPS_UPDATED_AT_CONFLICT_MESSAGE } from '@/lib/schemas/opsCas'
|
import { OPS_UPDATED_AT_CONFLICT_MESSAGE, optionalBaseUpdatedAtSchema } from '@/lib/schemas/opsCas'
|
||||||
import { positiveRelationshipId, trimmedNullableText } from '@/lib/schemas/primitives'
|
import { positiveRelationshipId, trimmedNullableText } from '@/lib/schemas/primitives'
|
||||||
import { voteEstimateScenarioFieldsSchema } from '@/lib/schemas/votePledge'
|
import { voteEstimateScenarioFieldsSchema } from '@/lib/schemas/votePledge'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { optionalBaseUpdatedAtSchema, OPS_UPDATED_AT_CONFLICT_MESSAGE } from '@/lib/schemas/opsCas'
|
import { OPS_UPDATED_AT_CONFLICT_MESSAGE, optionalBaseUpdatedAtSchema } from '@/lib/schemas/opsCas'
|
||||||
import {
|
import {
|
||||||
MAX_VOTE_COUNT,
|
MAX_VOTE_COUNT,
|
||||||
positiveRelationshipId,
|
positiveRelationshipId,
|
||||||
|
|
@ -107,8 +107,6 @@ export const municipalityUpdateCreateSchema = z
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export const MUNICIPALITY_UPDATE_CREATE_SAFE_MESSAGES = [
|
export const MUNICIPALITY_UPDATE_CREATE_SAFE_MESSAGES = [OPS_UPDATED_AT_CONFLICT_MESSAGE] as const
|
||||||
OPS_UPDATED_AT_CONFLICT_MESSAGE,
|
|
||||||
] as const
|
|
||||||
|
|
||||||
export type MunicipalityUpdateCreateInput = z.input<typeof municipalityUpdateCreateSchema>
|
export type MunicipalityUpdateCreateInput = z.input<typeof municipalityUpdateCreateSchema>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { optionalBaseUpdatedAtSchema, OPS_UPDATED_AT_CONFLICT_MESSAGE } from '@/lib/schemas/opsCas'
|
import { OPS_UPDATED_AT_CONFLICT_MESSAGE, optionalBaseUpdatedAtSchema } from '@/lib/schemas/opsCas'
|
||||||
import {
|
import {
|
||||||
MAX_VOTE_COUNT,
|
MAX_VOTE_COUNT,
|
||||||
positiveRelationshipId,
|
positiveRelationshipId,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue