Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Prathamesh483 committed Dec 7, 2024
1 parent b1844c1 commit c378d65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ router.post(
"/register",
validateMiddleware(userSchema.registerSchema),
async (req, res) => {
const { email, password } = req.body;
const { email, password,referral_code } = req.body;

const data = await service.register(email, password);
const data = await service.register(email, password,referral_code);
return res.status(201).json(data);
}
);
Expand Down
3 changes: 2 additions & 1 deletion services/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Service {
}

// Register method will be used to create a new user
async register(email, password) {
async register(email, password,referral_code) {
const user = await this.repository.getUser(email);
if (user) throw new BadRequestError("User already exists");

Expand All @@ -132,6 +132,7 @@ class Service {
type: EVENT_TYPES.USER_CREATED,
data: {
userId: newUser.public_id,
referral_code: referral_code
},
});

Expand Down

0 comments on commit c378d65

Please sign in to comment.