Skip to content

Commit

Permalink
feat(app): add new service tags and update other service tags (#1464)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->

# Pull Request type

<!-- Please try to limit your pull request to one type; submit multiple
pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build-related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or
link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->

-
-
-

## Does this introduce a breaking change?

- [ ] Yes
- [ ] No

<!-- If this does introduce a breaking change, please describe the
impact and migration path for existing applications below. -->

## Other information

<!-- Any other information that is important to this PR, such as
screenshots of how the component looks before and after the change. -->
  • Loading branch information
trigal2012 authored Feb 19, 2025
2 parents 072a83a + 44be8f9 commit 6979157
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/app/public/locales/en/services.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"immigration-detention": "Immigration detention",
"legal-advice": "Legal advice",
"legal-hotlines": "Legal hotlines",
"legal-info-referrals": "Legal information and referrals",
"name-and-gender-change": "Name and gender marker change",
"refugee-claim": "Refugee claim",
"residency": "Residency",
Expand Down Expand Up @@ -128,6 +129,7 @@
"bipoc-support-groups": "BIPOC support groups",
"family-support-groups": "Family support groups",
"hotlines": "Hotlines",
"mental-health-info-referrals": "Mental health information and referrals",
"private-therapy-and-counseling": "Private therapy and counseling",
"psychological-evaluations-for-asylum-claim": "Psychological evaluations for asylum claim",
"psychological-evaluations-for-refugee-claim": "Psychological evaluations for refugee claim",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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-legal-service-tag',
title: 'new legal service tag',
createdBy: 'Diana Garbarino',
/** Optional: Longer description for the job */
description: undefined,
}
/**
* Job export - this variable MUST be UNIQUE
*/
export const job20250217_new_legal_service_tag = {
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

const legalServiceTag = await prisma.serviceTag.create({
data: {
id: 'svtg_01J4044WXYZS9V6F5R7M3L8XCY',
name: 'Legal information and referrals',
active: true,
categories: {
create: { active: true, category: { connect: { id: 'svct_01GW2HHEVH75KPRYKD49EJHYXX' } } },
},
primaryCategory: { connect: { id: 'svct_01GW2HHEVH75KPRYKD49EJHYXX' } },
key: {
create: {
key: 'legal-info-referrals',
text: 'Legal information and referrals',
namespace: { connect: { name: 'services' } },
},
},
},
})
log(`Created service tag: ${legalServiceTag.name} (${legalServiceTag.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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-mental-health-service-tag',
title: 'new mental health service tag',
createdBy: 'Diana Garbarino',
/** Optional: Longer description for the job */
description: undefined,
}
/**
* Job export - this variable MUST be UNIQUE
*/
export const job20250217_new_mental_health_service_tag = {
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

const mentalHealthTag = await prisma.serviceTag.create({
data: {
id: 'svtg_01J4044WXYZRWK3Q9JH2Y4F8B0',
name: 'Mental health information and referrals',
active: true,
categories: {
create: { active: true, category: { connect: { id: 'svct_01GW2HHEVMEF7DMG9WHP0JM2ZZ' } } },
},
primaryCategory: { connect: { id: 'svct_01GW2HHEVMEF7DMG9WHP0JM2ZZ' } },
key: {
create: {
key: 'mental-health-info-referrals',
text: 'Mental health information and referrals',
namespace: { connect: { name: 'services' } },
},
},
},
})
log(`Created service tag: ${mentalHealthTag.name} (${mentalHealthTag.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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_update-medical-tags-to-active',
title: 'update medical tags to active',
createdBy: 'Diana Garbarino',
/** Optional: Longer description for the job */
description: undefined,
}
/**
* Job export - this variable MUST be UNIQUE
*/
export const job20250217_update_medical_tags_to_active = {
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

const update = await prisma.$transaction([
prisma.serviceTag.update({
where: {
tsKey_tsNs: {
tsKey: 'medical.fertility-and-family-planning-services',
tsNs: 'services',
},
},
data: {
active: true,
},
}),
prisma.serviceTag.update({
where: {
tsKey_tsNs: {
tsKey: 'medical.medical-info-and-referrals',
tsNs: 'services',
},
},
data: {
active: true,
},
}),
])
log(`service tag records updated: ${update.length}`)

/**
* 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
3 changes: 3 additions & 0 deletions packages/db/prisma/data-migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ export * from './2025-01-29_update-parent-category-for-trans-you-health'
export * from './2025-01-29_update-translation-key-for-trans-health-youth'
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 6979157

Please sign in to comment.