Skip to content

Commit 523702f

Browse files
committed
fix: apply link email mark optional
1 parent aa7e322 commit 523702f

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/modules/link/link.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class LinkController {
6767

6868
process.nextTick(async () => {
6969
if (doc.email) {
70-
this.linkService.sendToCandidate(doc)
70+
await this.linkService.sendToCandidate(doc)
7171
}
7272
})
7373
return

src/modules/link/link.model.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ApiProperty } from '@nestjs/swagger'
22
import { modelOptions, prop } from '@typegoose/typegoose'
3+
import { Transform } from 'class-transformer'
34
import { IsEmail, IsEnum, IsOptional, IsString, IsUrl } from 'class-validator'
45
import { range } from 'lodash'
56
import { BaseModel } from '~/shared/model/base.model'
@@ -32,6 +33,8 @@ export class LinkModel extends BaseModel {
3233
@IsOptional()
3334
@IsUrl({ require_protocol: true })
3435
@prop({ trim: true })
36+
// 对空字符串处理
37+
@Transform(({ value }) => (value === '' ? null : value))
3538
avatar?: string
3639

3740
@IsOptional()
@@ -52,6 +55,9 @@ export class LinkModel extends BaseModel {
5255

5356
@prop()
5457
@IsEmail()
58+
@IsOptional()
59+
// 对空字符串处理
60+
@Transform(({ value }) => (value === '' ? null : value))
5561
email?: string
5662
get hide() {
5763
return this.state === LinkState.Audit

src/modules/link/link.service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ export class LinkService {
8484
站点描述: ${model.description}`)
8585
return
8686
}
87-
process.nextTick(async () => {
88-
await this.emailService.sendLinkApplyEmail({
89-
model,
90-
to: model.email,
91-
template: LinkApplyEmailType.ToCandidate,
92-
})
87+
88+
await this.emailService.sendLinkApplyEmail({
89+
model,
90+
to: model.email,
91+
template: LinkApplyEmailType.ToCandidate,
9392
})
9493
}
9594
async sendToMaster(authorName: string, model: LinkModel) {

src/modules/pageproxy/pageproxy.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class PageProxyController {
117117
`<!-- injectable script -->`,
118118
`<script>${`window.page_source='${
119119
source.from
120-
}'};\nwindow.injectData = ${JSON.stringify({
120+
}';\nwindow.injectData = ${JSON.stringify({
121121
LOGIN_BG: adminExtra.background,
122122
TITLE: adminExtra.title,
123123
WEB_URL: webUrl,

0 commit comments

Comments
 (0)