add EmailSendResponse
This commit is contained in:
parent
abf41f3c95
commit
9be9a1a2b3
@ -18,6 +18,11 @@ export class EmailSendDto {
|
|||||||
scene: EmailScene
|
scene: EmailScene
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class EmailSendResponse {
|
||||||
|
token: string
|
||||||
|
userId?: string
|
||||||
|
}
|
||||||
|
|
||||||
export class EmailVerifyDto {
|
export class EmailVerifyDto {
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
|
@ -9,7 +9,12 @@ import { securityConfig, SecurityConfig } from 'src/common/configs'
|
|||||||
import { MailerService } from '@nestjs-modules/mailer'
|
import { MailerService } from '@nestjs-modules/mailer'
|
||||||
import { JwtService } from '@nestjs/jwt'
|
import { JwtService } from '@nestjs/jwt'
|
||||||
import { PrismaService } from 'nestjs-prisma'
|
import { PrismaService } from 'nestjs-prisma'
|
||||||
import { EmailScene, EmailVerifycationDto, EmailSendDto } from './dto/email.dto'
|
import {
|
||||||
|
EmailScene,
|
||||||
|
EmailVerifycationDto,
|
||||||
|
EmailSendDto,
|
||||||
|
EmailSendResponse,
|
||||||
|
} from './dto/email.dto'
|
||||||
import { UserEntity } from 'src/users/entities/user.entity'
|
import { UserEntity } from 'src/users/entities/user.entity'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -28,7 +33,10 @@ export class EmailService {
|
|||||||
private secureConfig: SecurityConfig,
|
private secureConfig: SecurityConfig,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async sendEmailToken(email: string, scene: EmailScene) {
|
async sendEmailToken(
|
||||||
|
email: string,
|
||||||
|
scene: EmailScene,
|
||||||
|
): Promise<EmailSendResponse> {
|
||||||
const user: UserEntity | null = await this.prismaService.user.findUnique({
|
const user: UserEntity | null = await this.prismaService.user.findUnique({
|
||||||
where: { email },
|
where: { email },
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user