Skip to content

Commit

Permalink
Add liveurl on tenant registration
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandiny committed Feb 26, 2021
1 parent 8628f39 commit 826e607
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/controller/UserController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export class UserController {
}

async registerTenant(request: Request, response: Response): Promise<void> {
const { email, username, password, point } = request.body;
const { email, username, password, point, liveUrl } = request.body;

const name = request.body.name || username;

Expand Down Expand Up @@ -368,7 +368,8 @@ export class UserController {

await tmTenantRepository.save({
userId: savedUser,
point: point || config.tenantInitial
point: point || config.tenantInitial,
liveURL: liveUrl
});

return responseGenerator(response, 200, "ok", { id: savedUser.id });
Expand Down
2 changes: 2 additions & 0 deletions src/routes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default (): Router => {
.isLength({ min: 1 }).withMessage("must be >= 1 character long");
const pointCheck = () => check("point").isInt({ min: 0 }).withMessage("must be a positive integer");
const tokenCheck = () => check("token").isAlphanumeric().isLength({ min: 6, max: 6 }).withMessage("muse be 6 alpanumeric character");
const liveUrlCheck = () => check("liveUrl").isURL().withMessage("must be valid url");

// Public user endpoint
router.post("/login", [
Expand Down Expand Up @@ -80,6 +81,7 @@ export default (): Router => {
emailCheck().optional(),
nameCheck().optional(),
pointCheck().optional(),
liveUrlCheck().optional(),
checkParam,
], uc.registerTenant.bind(uc));

Expand Down

0 comments on commit 826e607

Please sign in to comment.