-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: change way to use z.infer from zod
- Loading branch information
Showing
7 changed files
with
20 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { z } from 'zod'; | ||
|
||
import exampleSchema from '../schemas/example.schema'; | ||
|
||
export type exampleProps = z.infer<typeof exampleSchema.example>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './example'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { Router } from 'express'; | ||
// import { Router } from 'express'; | ||
// import authMiddleware from '../middlewares/auth.middleware'; | ||
// import schemaMiddleware from "../middlewares/schema.middleware"; | ||
|
||
const exampleRouter = Router(); | ||
|
||
// exampleRouter.post("/", schemaMiddleware()); | ||
|
||
// exempleRouter.get("/", schemaMiddleware()); | ||
// const exampleRouter = Router(); | ||
// exampleRouter.all('/*', authMiddleware); | ||
// exampleRouter.post('/', schemaMiddleware()); | ||
|
||
// outras rotas aqui | ||
|
||
export default exampleRouter; | ||
// export default exampleRouter; |
4 changes: 2 additions & 2 deletions
4
src/schemas/example.schama.ts → src/schemas/example.schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { z } from 'zod'; | ||
|
||
const exampleSchema = z.object({ | ||
const example = z.object({ | ||
email: z.string().email(), | ||
password: z.string().min(3).max(20) | ||
}); | ||
|
||
export default { | ||
exampleSchema | ||
example | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters