-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea48354
commit 7024312
Showing
14 changed files
with
388 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { Knex } from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
return Promise.resolve().then(() => | ||
knex.schema.alterTable('submission', function (table) { | ||
table.text('is_developed_by_company_or_org'); | ||
table.text('is_developed_in_bc'); | ||
table.text('multi_family_units'); | ||
table.text('other_units'); | ||
table.text('other_units_description'); | ||
table.text('rental_units'); | ||
table.text('project_location'); | ||
table.text('locality'); | ||
table.text('province'); | ||
table.text('has_applied_provincial_permits'); | ||
table.text('check_provincial_permits'); | ||
table.text('indigenous_description'); | ||
table.text('non_profit_description'); | ||
table.text('housing_coop_description'); | ||
}) | ||
); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
return Promise.resolve().then(() => | ||
knex.schema.alterTable('submission', function (table) { | ||
table.dropColumn('housing_coop_description'); | ||
table.dropColumn('non_profit_description'); | ||
table.dropColumn('indigenous_description'); | ||
table.dropColumn('check_provincial_permits'); | ||
table.dropColumn('has_applied_provincial_permits'); | ||
table.dropColumn('province'); | ||
table.dropColumn('locality'); | ||
table.dropColumn('project_location'); | ||
table.dropColumn('rental_units'); | ||
table.dropColumn('other_units_description'); | ||
table.dropColumn('other_units'); | ||
table.dropColumn('multi_family_units'); | ||
table.dropColumn('is_developed_in_bc'); | ||
table.dropColumn('is_developed_by_company_or_org'); | ||
}) | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { v4 as uuidv4 } from 'uuid'; | ||
|
||
import { activityService } from '../../services'; | ||
import { uuidToActivityId } from '../../components/utils'; | ||
/** | ||
* @function generateUniqueActivityId | ||
* Generate a new activityId, which are truncated UUIDs | ||
* If a collision is detected, generate new UUID and test again | ||
* @returns {Promise<string>} A string in title case | ||
*/ | ||
export async function generateUniqueActivityId() { | ||
let id, queryResult; | ||
|
||
do { | ||
id = uuidToActivityId(uuidv4()); | ||
queryResult = await activityService.getActivity(id); | ||
} while (queryResult); | ||
|
||
return id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import prisma from '../db/dataConnection'; | ||
import { activity } from '../db/models'; | ||
|
||
const service = { | ||
/** | ||
* @function getActivity | ||
* Get an activity | ||
* @param {string} activityId Unique activity ID | ||
* @returns {Promise<Activity | null>} The result of running the findFirst operation | ||
*/ | ||
getActivity: async (activityId: string) => { | ||
const response = await prisma.activity.findFirst({ | ||
where: { | ||
activity_id: activityId | ||
} | ||
}); | ||
|
||
return activity.fromPrismaModel(response); | ||
} | ||
}; | ||
|
||
export default service; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.