mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:11:13 -05:00
feat: Implement full type safety plan
This commit is contained in:
@@ -22,7 +22,13 @@ serve(async (req) => {
|
||||
secretKey: novuApiKey
|
||||
});
|
||||
|
||||
const { workflowId, subscriberId, topicKey, payload, overrides } = await req.json();
|
||||
const { workflowId, subscriberId, topicKey, payload, overrides } = await req.json() as {
|
||||
workflowId: string;
|
||||
subscriberId?: string;
|
||||
topicKey?: string;
|
||||
payload: Record<string, unknown>;
|
||||
overrides?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
// Support both individual subscribers and topics
|
||||
if (!subscriberId && !topicKey) {
|
||||
@@ -31,7 +37,7 @@ serve(async (req) => {
|
||||
|
||||
const recipient = subscriberId
|
||||
? { subscriberId }
|
||||
: { topicKey };
|
||||
: { topicKey: topicKey! };
|
||||
|
||||
console.log('Triggering notification:', { workflowId, recipient });
|
||||
|
||||
@@ -54,13 +60,14 @@ serve(async (req) => {
|
||||
status: 200,
|
||||
}
|
||||
);
|
||||
} catch (error: any) {
|
||||
console.error('Error triggering notification:', error);
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
||||
console.error('Error triggering notification:', errorMessage);
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: false,
|
||||
error: error.message,
|
||||
error: errorMessage,
|
||||
}),
|
||||
{
|
||||
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
|
||||
|
||||
Reference in New Issue
Block a user