1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

chore: extract and export type used by CR emails (#6234)

This change takes the (now rather involved) type used to send CR
schedule suspension emails and extracts it into a proper exported type.

This will allow us to import it in enterprise as well instead of
redefining it.
This commit is contained in:
Thomas Heartman 2024-02-14 10:38:13 +09:00 committed by GitHub
parent fd977c57e8
commit 7eb9a01bda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,6 +38,28 @@ const SCHEDULED_EXECUTION_FAILED_SUBJECT =
export const MAIL_ACCEPTED = '250 Accepted';
export type ChangeRequestScheduleConflictData =
| { reason: 'flag archived'; flagName: string }
| {
reason: 'strategy deleted';
flagName: string;
strategyId: string;
}
| {
reason: 'strategy updated';
flagName: string;
strategyId: string;
}
| {
reason: 'segment updated';
segment: { id: number; name: string };
}
| {
reason: 'environment variants updated';
flagName: string;
environment: string;
};
export class EmailService {
private logger: Logger;
private config: IUnleashConfig;
@ -177,27 +199,8 @@ export class EmailService {
async sendScheduledChangeSuspendedEmail(
recipient: string,
conflictData:
| { reason: 'flag archived'; flagName: string }
| {
reason: 'strategy deleted';
flagName: string;
strategyId: string;
}
| {
reason: 'strategy updated';
flagName: string;
strategyId: string;
}
| {
reason: 'segment updated';
segment: { id: number; name: string };
}
| {
reason: 'environment variants updated';
flagName: string;
environment: string;
},
conflictData: ChangeRequestScheduleConflictData,
conflictingChangeRequestId: number | undefined,
changeRequests: {
id: number;