Skip to content

Commit

Permalink
add alert for trans bans org changes
Browse files Browse the repository at this point in the history
  • Loading branch information
trigal2012 committed Jan 30, 2025
1 parent 07b78c2 commit 228c73a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { type MigrationJob } from '~db/prisma/dataMigrationRunner'
import { type JobDef } from '~db/prisma/jobPreRun'

/** Define the job metadata here. */
const jobDef: JobDef = {
jobId: '2025-01-29_update-nationwide-locationbased-alert',
title: 'change the location-based alert text string',
createdBy: 'Diana',
/** Optional: Longer description for the job */
description: 'change the location-based alert text string',
}
/**
* Job export - this variable MUST be UNIQUE
*/
export const job20250129_update_nationwide_locationbased_alert = {
title: `[${jobDef.jobId}] ${jobDef.title}`,
task: async (ctx, task) => {
const { createLogger, formatMessage, jobPostRunner, prisma } = ctx
/** Create logging instance */
createLogger(task, jobDef.jobId)
const log = (...args: Parameters<typeof formatMessage>) => (task.output = formatMessage(...args))

// Variables for the update
const key = 'locationBasedAlert.alrt_locationBasedAlert.alrt_01J5XNBQ5GREHSHK5D2QTCXRWE'
const ns = 'org-data'
const newTextValue =
'Some organizations are adjusting services due to recent funding cuts and policy changes. Contact providers directly for updates.'

// Perform the update
const update1 = await prisma.translationKey.update({
where: { ns_key: { key, ns } },
data: { text: newTextValue },
})

const update2 = await prisma.locationAlert.update({
where: { id: 'alrt_01J1D1GAT5G5S6QNMCND5PMDAX' },
data: { level: 'WARN_SECONDARY' }, // update this to the correct id
})

log(`Location-based alert text string updated: ${update1.key} with new text: "${update1.text}"`)
log(`Location-based alert level type for anti-trans map: ${update2.key} change to: "${update2.text}"`)

/**
* DO NOT REMOVE BELOW
*
* This writes a record to the DB to register that this migration has run successfully.
*/
await jobPostRunner(jobDef)
},
def: jobDef,
} satisfies MigrationJob
1 change: 1 addition & 0 deletions packages/db/prisma/data-migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from './2025-01-15_new_food-service-tag'
export * from './2025-01-15_new_medical-service-tag'
export * from './2025-01-15_update-cost-tags'
export * from './2025-01-15_update-food-tags'
export * from './2025-01-29_update-nationwide-locationbased-alert'
export * from './2025-01-29_update-parent-category-for-trans-you-health'
export * from './2025-01-29_update-translation-key-for-trans-health-youth'
// codegen:end

0 comments on commit 228c73a

Please sign in to comment.