chore: format seed and workflow files

This commit is contained in:
Francisco Ignácio Fontoura Solla 2026-07-30 04:45:44 -03:00
parent 777fde2eed
commit cc8492d831
4 changed files with 9 additions and 9 deletions

View file

@ -27,7 +27,7 @@ jobs:
NEXT_PUBLIC_SITE_URL: https://teqo-stage.vercel.app NEXT_PUBLIC_SITE_URL: https://teqo-stage.vercel.app
# The seed/migrate guards refuse non-local hosts without this flag. Stage # The seed/migrate guards refuse non-local hosts without this flag. Stage
# is the ONE documented remote target, and only this workflow may use it. # is the ONE documented remote target, and only this workflow may use it.
ALLOW_REMOTE_DB: "true" ALLOW_REMOTE_DB: 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -57,4 +57,4 @@ jobs:
# Documented escape hatch in tests/helpers/assertTestDatabase.ts — # Documented escape hatch in tests/helpers/assertTestDatabase.ts —
# only this workflow may set it (vitest.setup.ts loads .env.test # only this workflow may set it (vitest.setup.ts loads .env.test
# with override: true, written by the step above). # with override: true, written by the step above).
ALLOW_STAGE_TEST_DB: "true" ALLOW_STAGE_TEST_DB: 'true'

View file

@ -21,8 +21,8 @@
*/ */
import { getPayload } from 'payload' import { getPayload } from 'payload'
import { loadCliEnv } from './lib/cli.mjs'
import { assertLocalDatabase } from './assert-local-database.mjs' import { assertLocalDatabase } from './assert-local-database.mjs'
import { loadCliEnv } from './lib/cli.mjs'
import { import {
MINIMAL_CAMPAIGN_GOALS, MINIMAL_CAMPAIGN_GOALS,
MINIMAL_CAMPAIGN_USERS, MINIMAL_CAMPAIGN_USERS,
@ -87,7 +87,9 @@ const upsert = async (collection, where, data, label) => {
const municipalityIdBySlug = async (slug) => { const municipalityIdBySlug = async (slug) => {
const doc = await findOne('municipality', { slug: { equals: slug } }) const doc = await findOne('municipality', { slug: { equals: slug } })
if (!doc) { if (!doc) {
throw new Error(`Municipality "${slug}" missing — run pnpm migrate before pnpm db:seed:minimal.`) throw new Error(
`Municipality "${slug}" missing — run pnpm migrate before pnpm db:seed:minimal.`,
)
} }
return doc.id return doc.id
} }
@ -117,9 +119,7 @@ try {
for (const user of MINIMAL_CAMPAIGN_USERS) { for (const user of MINIMAL_CAMPAIGN_USERS) {
await upsert( await upsert(
'campaignUser', 'campaignUser',
user.email user.email ? { email: { equals: user.email } } : { username: { equals: user.username } },
? { email: { equals: user.email } }
: { username: { equals: user.username } },
{ ...user }, { ...user },
`campaignUser ${user.role} (${user.email ?? user.username})`, `campaignUser ${user.role} (${user.email ?? user.username})`,
) )