Correção para obrigar o usuario a inserir numero com 55 no inicio
parent
4aa90698f1
commit
2c48aafbdb
|
@ -88,6 +88,7 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
|
||||||
number: Yup.string()
|
number: Yup.string()
|
||||||
.required()
|
.required()
|
||||||
.matches(/^\d+$/, "Invalid number format. Only numbers is allowed.")
|
.matches(/^\d+$/, "Invalid number format. Only numbers is allowed.")
|
||||||
|
.matches(/^55\d+$/, "The number must start with 55.")
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -152,10 +153,9 @@ export const update = async (
|
||||||
|
|
||||||
const schema = Yup.object().shape({
|
const schema = Yup.object().shape({
|
||||||
name: Yup.string(),
|
name: Yup.string(),
|
||||||
number: Yup.string().matches(
|
number: Yup.string()
|
||||||
/^\d+$/,
|
.matches(/^\d+$/,"Invalid number format. Only numbers is allowed.")
|
||||||
"Invalid number format. Only numbers is allowed."
|
.matches(/^55\d+$/, "The number must start with 55.")
|
||||||
)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -20,7 +20,7 @@ interface Request {
|
||||||
|
|
||||||
const CreateMessageService = async ({ messageData }: Request): Promise<Message> => {
|
const CreateMessageService = async ({ messageData }: Request): Promise<Message> => {
|
||||||
|
|
||||||
console.log('UPSERT MESSAGE messageData: ', messageData)
|
// console.log('UPSERT MESSAGE messageData: ', messageData)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue