generated from polijrorg/template-node-ts-prisma
-
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.
Merge pull request #11 from polijrorg/feat/update-optional
Feat/update optional
- Loading branch information
Showing
13 changed files
with
979 additions
and
67 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 +1,12 @@ | ||
interface IUpdateUserDTO { | ||
name: string; | ||
email: string; | ||
password: string; | ||
language: string; | ||
phone: string; | ||
name?: string; | ||
email?: string; | ||
password?: string; | ||
language?: string; | ||
phone?: string; | ||
image?: string; | ||
gender?: string; | ||
birthdate?: Date; | ||
} | ||
|
||
export default IUpdateUserDTO; |
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
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
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ export default class SendPinToUserEmailService { | |
}: IRequest): Promise<Users> { | ||
const userAlreadyExists = await this.usersRepository.findByEmailWithRelations(email); | ||
if (!userAlreadyExists) throw new AppError('User with this email does not exist'); | ||
|
||
const expiration = 15; | ||
const pin = Math.floor(Math.random() * 9999).toString(); | ||
const data = new Date(); | ||
|
@@ -34,13 +34,13 @@ export default class SendPinToUserEmailService { | |
data, | ||
); | ||
|
||
sgMail.setApiKey(process.env.SENDGRID_API_KEY as string) | ||
sgMail.setApiKey(process.env.SENDGRID_API_KEY as string); | ||
const msg = { | ||
to: email, | ||
from: '[email protected]', | ||
to: email, | ||
from: '[email protected]', | ||
subject: 'Apogeo | Recuperação de senha', | ||
text: user.name + ', seu pin para recuperação de senha é: ' + pin + '. O processo de recuperação expira em ' + expiration + ' minutos.', | ||
html: user.name + ', seu pin para recuperação de senha é: <strong>' + pin + '</strong>. O processo de recuperação expira em ' + expiration + ' minutos.', | ||
text: `${user.name}, seu pin para recuperação de senha é: ${pin}. O processo de recuperação expira em ${expiration} minutos.`, | ||
html: `${user.name}, seu pin para recuperação de senha é: <strong>${pin}</strong>. O processo de recuperação expira em ${expiration} minutos.`, | ||
}; | ||
|
||
try { | ||
|
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
4 changes: 4 additions & 0 deletions
4
src/shared/infra/prisma/migrations/20240824231846_extra_user_fields/migration.sql
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- AlterTable | ||
ALTER TABLE "Users" ADD COLUMN "birthdate" TIMESTAMP(3), | ||
ADD COLUMN "gender" TEXT, | ||
ADD COLUMN "image" TEXT; |
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