Skip to content

Commit

Permalink
fix!: Update username and email validator schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafeqm committed Jan 30, 2023
1 parent 32e9ef2 commit 43870b2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-music-api",
"version": "3.0.0-beta.31",
"version": "3.0.0",
"description": "",
"private": true,
"main": "src/server.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/validator/exports/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Joi from "joi";

export const exportPayloadSchema = Joi.object({
targetEmail: Joi.string().required(),
targetEmail: Joi.string().email().required(),
});
9 changes: 8 additions & 1 deletion src/validator/users/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import Joi from "joi";

export const userPayloadSchema = Joi.object({
username: Joi.string().min(4).max(25).required(),
username: Joi.string()
.pattern(/^\w+$/)
.message(
'"username" must only contain alpha-numeric characters and underscore'
)
.min(4)
.max(25)
.required(),
password: Joi.string().required(),
fullname: Joi.string().required(),
});

0 comments on commit 43870b2

Please sign in to comment.