Skip to content

Commit

Permalink
fix: apply link email mark optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Oct 4, 2021
1 parent aa7e322 commit 523702f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/modules/link/link.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class LinkController {

process.nextTick(async () => {
if (doc.email) {
this.linkService.sendToCandidate(doc)
await this.linkService.sendToCandidate(doc)
}
})
return
Expand Down
6 changes: 6 additions & 0 deletions src/modules/link/link.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiProperty } from '@nestjs/swagger'
import { modelOptions, prop } from '@typegoose/typegoose'
import { Transform } from 'class-transformer'
import { IsEmail, IsEnum, IsOptional, IsString, IsUrl } from 'class-validator'
import { range } from 'lodash'
import { BaseModel } from '~/shared/model/base.model'
Expand Down Expand Up @@ -32,6 +33,8 @@ export class LinkModel extends BaseModel {
@IsOptional()
@IsUrl({ require_protocol: true })
@prop({ trim: true })
// 对空字符串处理
@Transform(({ value }) => (value === '' ? null : value))
avatar?: string

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

@prop()
@IsEmail()
@IsOptional()
// 对空字符串处理
@Transform(({ value }) => (value === '' ? null : value))
email?: string
get hide() {
return this.state === LinkState.Audit
Expand Down
11 changes: 5 additions & 6 deletions src/modules/link/link.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ export class LinkService {
站点描述: ${model.description}`)
return
}
process.nextTick(async () => {
await this.emailService.sendLinkApplyEmail({
model,
to: model.email,
template: LinkApplyEmailType.ToCandidate,
})

await this.emailService.sendLinkApplyEmail({
model,
to: model.email,
template: LinkApplyEmailType.ToCandidate,
})
}
async sendToMaster(authorName: string, model: LinkModel) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/pageproxy/pageproxy.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class PageProxyController {
`<!-- injectable script -->`,
`<script>${`window.page_source='${
source.from
}'};\nwindow.injectData = ${JSON.stringify({
}';\nwindow.injectData = ${JSON.stringify({
LOGIN_BG: adminExtra.background,
TITLE: adminExtra.title,
WEB_URL: webUrl,
Expand Down

0 comments on commit 523702f

Please sign in to comment.