-
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: add dynamo gsi and implement repositories + fixes
- Loading branch information
1 parent
ec23d38
commit 12f8716
Showing
15 changed files
with
371 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,48 @@ | ||
import type { FastifyReply, FastifyRequest } from 'fastify'; | ||
import { injectable } from 'tsyringe'; | ||
import { inject, injectable } from 'tsyringe'; | ||
|
||
import { HttpStatusCodesEnum } from '@/constants'; | ||
import type { | ||
RecoveryPasswordService, | ||
RecoveryPasswordVerifyService, | ||
ResetPasswordService, | ||
ResetPasswordServiceDto, | ||
} from '@/interfaces'; | ||
|
||
@injectable() | ||
export class PasswordController { | ||
public recovery(_request: FastifyRequest, reply: FastifyReply) { | ||
constructor( | ||
@inject('RecoveryPasswordVerifyService') | ||
private readonly recoveryPasswordVerifyService: RecoveryPasswordVerifyService, | ||
|
||
@inject('RecoveryPasswordService') | ||
private readonly recoveryPasswordService: RecoveryPasswordService, | ||
|
||
@inject('ResetPasswordService') | ||
private readonly resetPasswordService: ResetPasswordService, | ||
) {} | ||
|
||
public async recovery(request: FastifyRequest, reply: FastifyReply) { | ||
const { email } = request.body as { email: string }; | ||
|
||
await this.recoveryPasswordService.execute({ email }); | ||
|
||
return reply.code(HttpStatusCodesEnum.NO_CONTENT).send(); | ||
} | ||
|
||
public recoveryVerify(_request: FastifyRequest, reply: FastifyReply) { | ||
public async recoveryVerify(request: FastifyRequest, reply: FastifyReply) { | ||
const { code } = request.body as { code: string }; | ||
|
||
await this.recoveryPasswordVerifyService.execute({ code }); | ||
|
||
return reply.code(HttpStatusCodesEnum.NO_CONTENT).send(); | ||
} | ||
|
||
public reset(_request: FastifyRequest, reply: FastifyReply) { | ||
public async reset(request: FastifyRequest, reply: FastifyReply) { | ||
const { code, email, password } = request.body as ResetPasswordServiceDto; | ||
|
||
await this.resetPasswordService.execute({ code, email, password }); | ||
|
||
return reply.code(HttpStatusCodesEnum.NO_CONTENT).send(); | ||
} | ||
} |
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
Oops, something went wrong.