mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor(server): mail service (#10934)
This commit is contained in:
@@ -2,6 +2,7 @@ import './config';
|
||||
|
||||
import { ServerFeature } from '../../core/config';
|
||||
import { FeatureModule } from '../../core/features';
|
||||
import { MailModule } from '../../core/mail';
|
||||
import { PermissionModule } from '../../core/permission';
|
||||
import { QuotaModule } from '../../core/quota';
|
||||
import { UserModule } from '../../core/user';
|
||||
@@ -33,6 +34,7 @@ import { StripeWebhook } from './webhook';
|
||||
UserModule,
|
||||
PermissionModule,
|
||||
WorkspaceModule,
|
||||
MailModule,
|
||||
],
|
||||
providers: [
|
||||
StripeProvider,
|
||||
|
||||
@@ -6,11 +6,8 @@ import { pick } from 'lodash-es';
|
||||
import Stripe from 'stripe';
|
||||
import { z } from 'zod';
|
||||
|
||||
import {
|
||||
MailService,
|
||||
SubscriptionPlanNotFound,
|
||||
URLHelper,
|
||||
} from '../../../base';
|
||||
import { SubscriptionPlanNotFound, URLHelper } from '../../../base';
|
||||
import { Mailer } from '../../../core/mail';
|
||||
import {
|
||||
KnownStripeInvoice,
|
||||
KnownStripePrice,
|
||||
@@ -49,7 +46,7 @@ export class SelfhostTeamSubscriptionManager extends SubscriptionManager {
|
||||
stripe: Stripe,
|
||||
db: PrismaClient,
|
||||
private readonly url: URLHelper,
|
||||
private readonly mailer: MailService
|
||||
private readonly mailer: Mailer
|
||||
) {
|
||||
super(stripe, db);
|
||||
}
|
||||
@@ -140,7 +137,11 @@ export class SelfhostTeamSubscriptionManager extends SubscriptionManager {
|
||||
}),
|
||||
]);
|
||||
|
||||
await this.mailer.sendTeamLicenseMail(userEmail, { license: key });
|
||||
await this.mailer.send({
|
||||
name: 'TeamLicense',
|
||||
to: userEmail,
|
||||
props: { license: key },
|
||||
});
|
||||
|
||||
return subscription;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user