Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Allow prefers email ID
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Sep 3, 2020
1 parent 4d070cf commit 27baa6e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/_staart/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const IdValues = [
"id",
"userId",
"groupId",
"primaryEmail",
"prefersEmailId",
"apiKeyId",
"apiKeyGroupId",
];
Expand Down
4 changes: 2 additions & 2 deletions src/_staart/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export const updateUser = async (id: number, user: KeyValue) => {
const originalUser = await getUserById(id);
await deleteItemFromCache(`cache_getUserById_${originalUser.id}`);
if (user.password) user.password = await hash(user.password, 8);
if (user.primaryEmail) {
if (user.prefersEmailId) {
if ((originalUser.profilePictureUrl || "").includes("api.adorable.io")) {
const emailDetails = await prisma.emails.findOne({
where: { id: user.primaryEmail },
where: { id: user.prefersEmailId },
});
if (emailDetails)
user.profilePicture = `https://www.gravatar.com/avatar/${createHash(
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/users/_id/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class UserController {
.min(3)
.regex(/^[a-zA-Z ]*$/),
nickname: Joi.string(),
primaryEmail: [Joi.string(), Joi.number()],
prefersEmailId: [Joi.string(), Joi.number()],
countryCode: Joi.string().length(2),
password: Joi.string().min(6),
gender: Joi.string()
Expand Down
Empty file added src/rest/index.ts
Empty file.
Empty file added src/services/index.ts
Empty file.

0 comments on commit 27baa6e

Please sign in to comment.