Skip to content

Commit

Permalink
Merge branch 'dev' into ECB-94
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Feb 19, 2025
2 parents f5c8e9c + 6979157 commit 6c6d151
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/app/public/locales/en/attribute.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"cost-accepts-insurance_withUrl": "This service accepts insurance. <Link href=\"{{url}}\">Click here to visit the organization's page</Link> for more information on cost, financial assistance options and insurance coverage details.",
"cost-fees": "Incurs a cost",
"cost-free": "Free of cost",
"cost-financial-assistance-available": "Financial assistance available",
"cost-sliding-scale": "Costs determined on a sliding scale",
"cost-sliding-scale_default": "This service has sliding scale fees. The amount you pay for services is adjusted according to your income level. Contact the organization directly for more information.",
"cost-sliding-scale_withUrl": "This service has sliding scale fees. The amount you pay for services is adjusted according to your income level. <Link href=\"{{url}}\">Click here to visit the organization's page for more information.</Link>"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { type MigrationJob } from '~db/prisma/dataMigrationRunner'
import { type JobDef } from '~db/prisma/jobPreRun'

/** Define the job metadata here. */
const jobDef: JobDef = {
jobId: '2025-02-17_new-cost-attribute',
title: 'new cost attribute',
createdBy: 'Diana Garbarino',
/** Optional: Longer description for the job */
description: undefined,
}
/**
* Job export - this variable MUST be UNIQUE
*/
export const job20250217_new_cost_attribute = {
title: `[${jobDef.jobId}] ${jobDef.title}`,
task: async (ctx, task) => {
const { createLogger, downloadFromDatastore, generateId, formatMessage, jobPostRunner, prisma } = ctx
/** Create logging instance */
createLogger(task, jobDef.jobId)
const log = (...args: Parameters<typeof formatMessage>) => (task.output = formatMessage(...args))
/**
* Start defining your data migration from here.
*
* To log output, use `task.output = 'Message to log'`
*
* This will be written to `stdout` and to a log file in `/prisma/migration-logs/`
*/

// Do stuff

await prisma.$transaction(async (tx) => {
const financialAsst = await tx.attribute.create({
data: {
id: 'attr_01J4044WXYZV6X8B3N2J7M5T9P',
tag: 'cost-financial-assistance-available',
name: 'Financial assistance available',
active: true,
canAttachTo: ['SERVICE'],
categories: { create: { categoryId: 'attc_01GW2HHFVFKNMYPN8F86M0H576' } },
icon: 'carbon:piggy-bank',
key: {
create: {
key: 'cost.cost-financial-assistance-available',
text: 'Financial assistance available',
ns: 'attribute',
active: true,
},
},
},
})
log(`Created "${financialAsst.name}" (${financialAsst.id})`)
})

/**
* 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 @@ -23,5 +23,6 @@ export * from './2025-01-31_remove-twitter-from-orgWebsite-and-OrgSocialMedia'
export * from './2025-01-31_remove-twitter-from-SocialMediaServices'
export * from './2025-02-17_new_legal-service-tag'
export * from './2025-02-17_new_mental-health-service-tag'
export * from './2025-02-17_new-cost-attribute'
export * from './2025-02-17_update-medical-tags'
// codegen:end

0 comments on commit 6c6d151

Please sign in to comment.