This commit is contained in:
MartinBraquet
2025-09-16 12:48:44 +02:00
parent 639991dde4
commit bebe7c28f8
3 changed files with 30 additions and 31 deletions

View File

@@ -69,10 +69,10 @@ export const sendSearchNotifications: APIHandler<'send-search-notifications'> =
matches[row.creator_id].matches.push({
id: row.creator_id,
description: {filters: row.search_filters, location: row.location},
matches: [profiles.map((item: any) => ({
matches: profiles.map((item: any) => ({
name: item.name,
username: item.username,
}))],
})),
})
}
console.log(JSON.stringify(matches, null, 2))

View File

@@ -1,7 +1,6 @@
import {PrivateUser, User} from 'common/user'
import {getNotificationDestinationsForUser} from 'common/user-notification-preferences'
import {sendEmail} from './send-email'
import {NewMatchEmail} from '../new-match'
import {NewMessageEmail} from '../new-message'
import {NewEndorsementEmail} from '../new-endorsement'
import {Test} from '../test'
@@ -12,33 +11,33 @@ import NewSearchAlertsEmail from "email/new-search_alerts";
const from = 'Compass <no-reply@compassmeet.com>'
export const sendNewMatchEmail = async (
privateUser: PrivateUser,
matchedWithUser: User
) => {
const {sendToEmail, unsubscribeUrl} = getNotificationDestinationsForUser(
privateUser,
'new_match'
)
if (!privateUser.email || !sendToEmail) return
const lover = await getLover(privateUser.id)
if (!lover) return
return await sendEmail({
from,
subject: `You have a new match!`,
to: privateUser.email,
react: (
<NewMatchEmail
onUser={lover.user}
email={privateUser.email}
matchedWithUser={matchedWithUser}
matchedLover={lover}
unsubscribeUrl={unsubscribeUrl}
/>
),
})
}
// export const sendNewMatchEmail = async (
// privateUser: PrivateUser,
// matchedWithUser: User
// ) => {
// const {sendToEmail, unsubscribeUrl} = getNotificationDestinationsForUser(
// privateUser,
// 'new_match'
// )
// if (!privateUser.email || !sendToEmail) return
// const lover = await getLover(privateUser.id)
// if (!lover) return
//
// return await sendEmail({
// from,
// subject: `You have a new match!`,
// to: privateUser.email,
// react: (
// <NewMatchEmail
// onUser={lover.user}
// email={privateUser.email}
// matchedWithUser={matchedWithUser}
// matchedLover={lover}
// unsubscribeUrl={unsubscribeUrl}
// />
// ),
// })
// }
export const sendNewMessageEmail = async (
privateUser: PrivateUser,

View File

@@ -13,7 +13,7 @@ export interface MatchesType {
filters: any; // You might want to replace 'any' with a more specific type
location: any; // You might want to replace 'any' with a more specific type
};
matches: any[]; // You might want to replace 'any' with a more specific type
matches: MatchUser[]; // You might want to replace 'any' with a more specific type
id: string
}