-
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
Showing
6 changed files
with
193 additions
and
192 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import { z } from "zod"; | ||
|
||
const ConfigSchema = z.object({ | ||
DISCORD_BOT_TOKEN: z.string().min(1), | ||
DISCORD_CHANNEL_ID: z.string().min(1), | ||
DISCORD_WEBHOOK: z.string().min(1), | ||
}); | ||
|
||
export const config = ConfigSchema.parse(process.env); |
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
6 changes: 6 additions & 0 deletions
6
packages/automated-dispute/src/exceptions/notificationFailure.exception.ts
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,6 @@ | ||
export class NotificationFailureException extends Error { | ||
constructor(message: string) { | ||
super(`Failed to send notification: ${message}`); | ||
this.name = "NotificationFailureException"; | ||
} | ||
} |
22 changes: 11 additions & 11 deletions
22
packages/automated-dispute/src/interfaces/notificationService.ts
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/** | ||
* Interface representing a notification service capable of sending error notifications. | ||
*/ | ||
export interface IMessage { | ||
title: string; | ||
subtitle?: string; | ||
description?: string; | ||
username?: string; | ||
avatarUrl?: string; | ||
actionUrl?: string; | ||
} | ||
|
||
export interface NotificationService { | ||
/** | ||
* Sends an error notification along with optional contextual information. | ||
* | ||
* @param error - The error object containing information about the error that occurred. | ||
* @param context - Additional context or data related to the error | ||
* @returns A promise that resolves when the notification process is complete. | ||
*/ | ||
notifyError(error: Error, context: any): Promise<void>; | ||
// send(message: IMessage): Promise<void>; | ||
notifyError(err: Error, context: unknown): Promise<void>; | ||
} |
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.