Correção para obrigar o usuario a inserir numero com 55 no inicio

pull/21/head
adriano 2023-05-19 13:00:07 -03:00
parent 4aa90698f1
commit 2c48aafbdb
2 changed files with 5 additions and 5 deletions

View File

@ -88,6 +88,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
number: Yup.string()
.required()
.matches(/^\d+$/, "Invalid number format. Only numbers is allowed.")
.matches(/^55\d+$/, "The number must start with 55.")
});
try {
@ -152,10 +153,9 @@ export const update = async (
const schema = Yup.object().shape({
name: Yup.string(),
number: Yup.string().matches(
/^\d+$/,
"Invalid number format. Only numbers is allowed."
)
number: Yup.string()
.matches(/^\d+$/,"Invalid number format. Only numbers is allowed.")
.matches(/^55\d+$/, "The number must start with 55.")
});
try {

View File

@ -20,7 +20,7 @@ interface Request {
const CreateMessageService = async ({ messageData }: Request): Promise<Message> => {
console.log('UPSERT MESSAGE messageData: ', messageData)
// console.log('UPSERT MESSAGE messageData: ', messageData)
try {