Skip to content

Commit

Permalink
chore: clean up functions and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
makelicious committed Jan 10, 2025
1 parent 284a2bb commit 03e241f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import {
/**
* Detailed view of single Action, showing the history of the event.
*
* @TODO: Add more details to the modal and ability to diff changes when more events are specified.s
* @TODO: Add more details to the modal and ability to diff changes when more events are specified.
*/
export function EventHistoryModal({
history,
close
}: {
history: ResolvedActionDocument
close: (result: boolean | null) => void
close: () => void
}) {
const intl = useIntl()

Expand All @@ -40,7 +40,7 @@ export function EventHistoryModal({
<ResponsiveModal
autoHeight
actions={[]}
handleClose={() => close(null)}
handleClose={close}
responsive={true}
show={true}
title={history.type}
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/v2-events/features/workqueues/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const INTERNAL_SEPARATOR = '___'

/**
* Replaces dots with triple underscores in the object keys.
* This is needed to support dot notation in the message.
* This is needed to support dot notation in the message variables.
*/
function convertDotToTripleUnderscore<T extends {}>(
obj: T
Expand All @@ -30,7 +30,7 @@ function convertDotToTripleUnderscore<T extends {}>(

/**
* Replace dots with triple underscores within the curly braces.
* This is needed to support dot notation in the message.
* This is needed to support dot notation in the message variables.
*/
function convertDotInCurlyBraces(str: string): string {
return str.replace(/{([^}]+)}/g, (match, content) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/data-seeder/src/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ export function updateLocationPartOf(partOf: string) {
return parent
}

/**
* NOTE: Seeding locations for v2 should be done after seeding the legacy locations.
* This is because the v2 locations are created based on the legacy location ids to ensure compatibility.
*/
export async function seedLocationsForV2Events(token: string) {
const result = await fetch(env.FHIR_URL + '/Location?_count=0', {
method: 'GET',
Expand Down
3 changes: 1 addition & 2 deletions packages/events/src/storage/mongodb/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ const client = new MongoClient(url)
export async function getClient() {
await client.connect()

const db = client.db('events')
return db
return client.db('events')
}
3 changes: 1 addition & 2 deletions packages/events/src/storage/mongodb/user-mgnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ const client = new MongoClient(url)
export async function getClient() {
await client.connect()

const db = client.db('user-mgnt')
return db
return client.db('user-mgnt')
}
4 changes: 4 additions & 0 deletions packages/events/src/tests/generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export function payloadGenerator() {
return { event, locations, user }
}

/**
* Helper utility to seed data into the database.
* Use with payloadGenerator for creating test data.
*/
export function seeder() {
const seedUser = async (db: Db, user: Omit<CreatedUser, 'id'>) => {
const createdUser = await db.collection('users').insertOne(user)
Expand Down

0 comments on commit 03e241f

Please sign in to comment.