minimonolith 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +5 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -112,8 +112,7 @@ This file contains the `get:id` method handler for the `todo` service. It retrie
112
112
  ```js
113
113
  // todo/get/index.js
114
114
  export default async ({ body, MODELS }) => {
115
- const id = parseInt(body.id);
116
- return await MODELS.todo.findOne({ where: { id } });
115
+ return await MODELS.todo.findOne({ where: { id: body.id } });
117
116
  }
118
117
  ```
119
118
 
@@ -126,8 +125,9 @@ This file validates the `get:id` method's input, ensuring that the provided `id`
126
125
  import { z, DB_VALIDATION } from 'minimonolith';
127
126
 
128
127
  export default (MODELS, ROUTE_CODE) => ({
129
- id: z.string().superRefine(
130
- DB_VALIDATION.exists(MODELS.todo, 'id', { parseInt: true })
131
- ),
128
+ id: z.string()
129
+ .superRefine(DB_VALIDATION.isSafeInt('id'))
130
+ .transform(id => parseInt(id))
131
+ .superRefine(DB_VALIDATION.exists(MODELS.todo, 'id')),
132
132
  })
133
133
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minimonolith",
3
3
  "type": "module",
4
- "version": "0.13.0",
4
+ "version": "0.13.2",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "scripts": {