-
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.
feat: pref team invite & email content
- Loading branch information
Showing
4 changed files
with
43 additions
and
25 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
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
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
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 |
---|---|---|
|
@@ -140,13 +140,6 @@ export const teamRouter = router({ | |
|
||
// send email | ||
data.forEach(async (item) => { | ||
const template = await useCompiler('teamInvite.vue', { | ||
props: { | ||
id: '', | ||
confirmUrl: `http://localhost:3000/dashboard/t/confirm?id=${item.id}`, | ||
}, | ||
}) | ||
|
||
const transporter = nodemailer.createTransport({ | ||
host: 'smtp.exmail.qq.com', | ||
port: 465, | ||
|
@@ -157,12 +150,31 @@ export const teamRouter = router({ | |
}, | ||
}) | ||
|
||
await transporter.sendMail({ | ||
from: '"OsmanthusBeer Labs🌹" <[email protected]>', // sender address | ||
to: '[email protected]', // list of receivers | ||
subject: 'OsmanthusBeer Labs: Team invite', // Subject line | ||
html: template, // html body | ||
const team = await ctx.prisma.team.findFirst({ where: { | ||
id: item.teamId, | ||
} }) | ||
|
||
const user = await ctx.prisma.user.findFirst({ where: { | ||
id: item.userId, | ||
} }) | ||
|
||
const template = await useCompiler('teamInvite.vue', { | ||
props: { | ||
teamname: team?.name || '', | ||
username: user?.username || '', | ||
confirmUrl: `http://apibeer.com/dashboard/t/confirm?id=${item.id}`, | ||
}, | ||
}) | ||
|
||
if (user) { | ||
await transporter.sendMail({ | ||
from: '"OsmanthusBeer Labs🌹" <[email protected]>', // sender address | ||
// to: '[email protected]', // list of receivers | ||
to: user.email, // list of receivers | ||
subject: 'OsmanthusBeer Labs: Team invite', // Subject line | ||
html: template, // html body | ||
}) | ||
} | ||
}) | ||
|
||
return res | ||
|