Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
treinamento-2025.1-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RICARDO PRADO FARIA
treinamento-2025.1-backend
Commits
a5b6bbaf
Commit
a5b6bbaf
authored
2 months ago
by
Amanda Pollyanna da Silva Rodrigues
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#9
ADD user validations
parent
67b35225
No related branches found
No related tags found
1 merge request
!9
Issue #9 ADD user validations
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/validators/userValidator.ts
+9
-7
9 additions, 7 deletions
src/validators/userValidator.ts
with
9 additions
and
7 deletions
src/validators/userValidator.ts
+
9
−
7
View file @
a5b6bbaf
import
{
z
}
from
'
zod
'
import
{
z
}
from
'
zod
'
export
const
userSchema
=
z
.
object
({
export
const
userSchema
=
z
.
object
({
name
:
z
.
string
(),
name
:
z
.
string
().
min
(
3
,
{
message
:
"
O nome deve ter pelo menos 3 caracteres
"
}),
password
:
z
.
string
(),
password
:
z
.
string
().
min
(
8
,
{
message
:
"
A senha deve ter pelo menos 8 caracteres
"
}),
email
:
z
.
string
().
email
(),
email
:
z
.
string
().
email
({
message
:
"
Formato de e-mail inválido
"
}),
birthday
:
z
.
string
(),
birthday
:
z
.
string
().
refine
(
date
=>
!
isNaN
(
Date
.
parse
(
date
)),
cpf
:
z
.
string
(),
{
message
:
"
Data de nascimento inválida
"
}),
money
:
z
.
number
(),
cpf
:
z
.
string
().
min
(
11
,
{
message
:
"
O CPF deve ter pelo menos 11 números
"
})
cyberpsychosis
:
z
.
number
(),
.
regex
(
/^
\d{3}\.\d{3}\.\d{3}
-
\d{2}
$/
,
"
CPF inválido (use o formato 000.000.000-00)
"
),
money
:
z
.
number
().
nonnegative
(),
cyberpsychosis
:
z
.
number
(),
//a definir restrições de validação
cyberLimit
:
z
.
number
(),
cyberLimit
:
z
.
number
(),
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment