Skip to content

Commit

Permalink
Merge pull request #36 from kentibs/feat/events-api
Browse files Browse the repository at this point in the history
feat: include details in the signup tokens
  • Loading branch information
Tibz-Dankan authored Jan 27, 2024
2 parents 791f9d1 + ee06824 commit dfdff51
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/controllers/tokenController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ export const getSignupTokensByGeneratedByUserId = asyncHandler(
}
const tokens = await SignupToken.findMany({
where: { generatedByUserId: { equals: generatedByUserId } },
include: {
User: {
select: {
firstName: true,
lastName: true,
email: true,
phoneNumber: true,
gender: true,
role: true,
imageUrl: true,
createdAt: true,
},
},
},
});

if (!tokens[0]) {
Expand All @@ -161,7 +175,22 @@ export const getSignupTokensByGeneratedByUserId = asyncHandler(

export const getAllSignupTokens = asyncHandler(
async (req: Request, res: Response, next: NextFunction) => {
const tokens = await SignupToken.findMany({});
const tokens = await SignupToken.findMany({
include: {
User: {
select: {
firstName: true,
lastName: true,
email: true,
phoneNumber: true,
gender: true,
role: true,
imageUrl: true,
createdAt: true,
},
},
},
});

if (!tokens[0]) {
return next(new AppError("No tokens found", 404));
Expand Down

0 comments on commit dfdff51

Please sign in to comment.