Skip to content

Commit

Permalink
refactor: use type from prisma client.
Browse files Browse the repository at this point in the history
  • Loading branch information
jenbutongit committed Aug 23, 2023
1 parent 75f137a commit 721f12e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ export async function sendAnnualReviewProviderEmail(
}
}

type RemindersBeforeStartDate = Exclude<ListAnnualReviewPostReminderType, "oneDayBeforeUnpublish">;
export async function sendAnnualReviewPostEmail(
reminderType: ListAnnualReviewPostReminderType | MilestoneTillAnnualReview,
reminderType: RemindersBeforeStartDate | MilestoneTillAnnualReview,
emailAddress: string,
typePlural: string,
country: string,
Expand All @@ -63,7 +64,7 @@ export async function sendAnnualReviewPostEmail(
/**
* Maps `ListAnnualReviewPostReminderType` or `MilestoneTillAnnualReview` to the notify template ID.
*/
const notifyTemplates: Record<ListAnnualReviewPostReminderType | MilestoneTillAnnualReview, string> = {
const notifyTemplates: Record<RemindersBeforeStartDate | MilestoneTillAnnualReview, string> = {
oneMonthBeforeStart: annualReviewNotices.postOneMonth,
oneWeekBeforeStart: annualReviewNotices.postOneWeek,
oneDayBeforeStart: annualReviewNotices.postOneDay,
Expand Down
7 changes: 2 additions & 5 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type * as PrismaClient from "@prisma/client";
import type * as ServerTypes from "server/models/types";
import type { ListItemJsonData } from "server/models/listItem/providers/deserialisers/types";
import type { EventJsonData } from "server/models/listItem/types";
import type { AnnualReviewPostEmailType } from "@prisma/client";

export enum ServiceType {
"lawyers" = "lawyers",
Expand Down Expand Up @@ -37,11 +38,7 @@ export interface Audit extends PrismaClient.Audit {
jsonData: ServerTypes.AuditEventJsonData;
}

export type ListAnnualReviewPostReminderType =
| "oneMonthBeforeStart"
| "oneWeekBeforeStart"
| "oneDayBeforeStart"
| "started";
export type ListAnnualReviewPostReminderType = PrismaClient.AnnualReviewPostEmailType;

export interface ListEventJsonData extends ServerTypes.BaseAuditEventJsonData {
eventName: ServerTypes.AuditListEventName;
Expand Down

0 comments on commit 721f12e

Please sign in to comment.