Skip to content

Commit

Permalink
10491: refactor to use prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
pixiwyn committed Oct 4, 2024
1 parent d630e0f commit 604212f
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion web-api/src/database-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ColumnType, Insertable, Selectable, Updateable } from 'kysely';
export interface Database {
dwCase: CaseTable;
dwMessage: MessageTable;
workItem: WorkItemTable;
dwWorkItem: WorkItemTable;
}

export interface MessageTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Kysely } from 'kysely';

export async function up(db: Kysely<any>): Promise<void> {
await db.schema
.createTable('workItem')
.createTable('dwWorkItem')
.addColumn('workItemId', 'varchar', col => col.primaryKey())
.addColumn('assigneeId', 'varchar')
.addColumn('assigneeName', 'varchar')
Expand Down Expand Up @@ -30,5 +30,5 @@ export async function up(db: Kysely<any>): Promise<void> {
}

export async function down(db: Kysely<any>): Promise<void> {
await db.schema.dropTable('workItem').execute();
await db.schema.dropTable('dwWorkItem').execute();
}
2 changes: 1 addition & 1 deletion web-api/src/persistence/postgres/utils/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const seed = async () => {

await getDbWriter(writer =>
writer
.insertInto('workItem')
.insertInto('dwWorkItem')
.values(workItems)
.onConflict(oc => oc.column('workItemId').doNothing()) // ensure doesn't fail if exists
.execute(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const deleteWorkItem = async ({
}): Promise<void> => {
await getDbWriter(writer =>
writer
.deleteFrom('workItem')
.deleteFrom('dwWorkItem')
.where('workItemId', '=', workItem.workItemId)
.execute(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const getDocumentQCInboxForSection = async ({
}): Promise<WorkItem[] | undefined> => {
const workItems = await getDbReader(reader => {
let builder = reader
.selectFrom('workItem as w')
.leftJoin('case as c', 'c.docketNumber', 'w.docketNumber')
.selectFrom('dwWorkItem as w')
.leftJoin('dwCase as c', 'c.docketNumber', 'w.docketNumber')
.where('w.section', '=', section);

if (judgeUserName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const getDocumentQCInboxForUser = async ({
}): Promise<WorkItem[]> => {
const workItems = await getDbReader(reader => {
return reader
.selectFrom('workItem as w')
.leftJoin('case as c', 'c.docketNumber', 'w.docketNumber')
.selectFrom('dwWorkItem as w')
.leftJoin('dwCase as c', 'c.docketNumber', 'w.docketNumber')
.where('w.assigneeId', '=', userId)
.selectAll()
.select('w.docketNumber')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const getDocumentQCServedForSection = async ({
}): Promise<WorkItem[]> => {
const workItems = await getDbReader(reader => {
return reader
.selectFrom('workItem as w')
.leftJoin('case as c', 'c.docketNumber', 'w.docketNumber')
.selectFrom('dwWorkItem as w')
.leftJoin('dwCase as c', 'c.docketNumber', 'w.docketNumber')
.where('w.section', '=', section)
.where('w.createdAt', '>=', afterDate)
.selectAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const getDocumentQCServedForUser = async ({
}): Promise<WorkItem[]> => {
const workItems = await getDbReader(reader => {
return reader
.selectFrom('workItem as w')
.leftJoin('case as c', 'c.docketNumber', 'w.docketNumber')
.selectFrom('dwWorkItem as w')
.leftJoin('dwCase as c', 'c.docketNumber', 'w.docketNumber')
.where('w.assigneeId', '=', userId)
.where('w.createdAt', '>', afterDate)
.selectAll()
Expand Down
4 changes: 2 additions & 2 deletions web-api/src/persistence/postgres/workitems/getWorkItemById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const getWorkItemById = async ({
}): Promise<WorkItem | undefined> => {
const workItem = await getDbReader(reader =>
reader
.selectFrom('workItem as w')
.leftJoin('case as c', 'c.docketNumber', 'w.docketNumber')
.selectFrom('dwWorkItem as w')
.leftJoin('dwCase as c', 'c.docketNumber', 'w.docketNumber')
.where('w.workItemId', '=', workItemId)
.selectAll()
.select('w.docketNumber')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const getWorkItemsByDocketNumber = async ({
}): Promise<WorkItem[]> => {
const workItems = await getDbReader(reader => {
return reader
.selectFrom('workItem as w')
.leftJoin('case as c', 'c.docketNumber', 'w.docketNumber')
.selectFrom('dwWorkItem as w')
.leftJoin('dwCase as c', 'c.docketNumber', 'w.docketNumber')
.where('w.docketNumber', '=', docketNumber)
.selectAll()
.select('w.docketNumber')
Expand Down
2 changes: 1 addition & 1 deletion web-api/src/persistence/postgres/workitems/saveWorkItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const saveWorkItem = async ({
}): Promise<RawWorkItem> => {
const createdWorkItem = await getDbWriter(writer =>
writer
.insertInto('workItem')
.insertInto('dwWorkItem')
.values(toKyselyNewWorkItem(workItem))
.onConflict(oc =>
oc.column('workItemId').doUpdateSet(toKyselyNewWorkItem(workItem)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const setPriorityOnAllWorkItems = async ({
}) => {
await getDbWriter(writer => {
let builder = writer
.updateTable('workItem')
.updateTable('dwWorkItem')
.set('highPriority', highPriority);

return builder.where('docketNumber', '=', docketNumber).execute();
Expand Down

0 comments on commit 604212f

Please sign in to comment.