|
9 | 9 | ## Version 0.x.x -> 1.x.x |
10 | 10 |
|
11 | 11 | 1. Remove `response` parameter from responders and handlers |
12 | | - Responders and handlers no longer take a `response` parameter, so you just need to remove the parameter from all calls to the following functions. This is easiest via find and replace (pro tip: use regex!) |
| 12 | + Responders and handlers no longer take a `response` parameter, so you just need to remove the parameter from all calls to the following functions. This is easiest via find and replace (pro tip: use regex!) |
13 | 13 | - `response.error()` |
14 | 14 | - `response.conflictResponder()` |
15 | 15 | - `response.deleteResponder()` |
|
21 | 21 | - `response.unauthorizedResponder()` |
22 | 22 | - `response.validationResponder()` |
23 | 23 | 2. Rename hooks |
24 | | - Hooks have been renamed for clarity. Rename all hooks in your models (pro tip: project-wide find & replace). **Make sure you go in order, and replace all occourences before moving on, because some hook names conflict with old hook names!** |
| 24 | + Hooks have been renamed for clarity. Rename all hooks in your models (pro tip: project-wide find & replace). **Make sure you go in order, and replace all occourences before moving on, because some hook names conflict with old hook names!** |
25 | 25 | - `beforePut()` -> `beforePatch()` |
26 | 26 | - `beforeGet()` -> REMOVED |
27 | 27 | - `beforeDelete()` -> `delete()` |
|
43 | 43 | } |
44 | 44 | }); |
45 | 45 | ``` |
46 | | -4. Remove `deleteFilter`. This filter does not have any value |
| 46 | +4. Remove `deleteFilter`. This filter does not have any value |
47 | 47 | 5. Update import directories |
48 | 48 | - `/fork-server` -> `/utils` |
49 | 49 | - `/get-identifier-value` -> `/utils` |
50 | 50 | - `/listen` -> `/utils` |
51 | 51 | - `/run-hooks` -> `/utils` |
52 | 52 | - `/upgrade-user-role` -> `/utils` |
53 | 53 | 6. Update `setModel()` for auth routers |
54 | | - Previously, `setModel()` would run the incorrect hooks for auth routers, and may even lead to deleting the wrong user's token. This has been fixed by passing `true` to the fourth parameter (`isAuth`) |
| 54 | + Previously, `setModel()` would run the incorrect hooks for auth routers, and may even lead to deleting the wrong user's token. This has been fixed by passing `true` to the fourth parameter (`isAuth`) |
55 | 55 |
|
56 | 56 | ```typescript |
57 | 57 | // Set model |
|
64 | 64 | }); |
65 | 65 | ``` |
66 | 66 | 7. Make sure all hooks are `async` functions |
67 | | - Hooks must now be async functions. Search through hooks, and replace with `public async HOOK_NAME()` |
| 67 | + Hooks must now be async functions. Search through hooks, and replace with `public async HOOK_NAME()` |
68 | 68 | 8. Make sure hooks utilize this. |
69 | 69 | Hooks are now bound to the resource, and should utilize `this.` notation |
70 | 70 | 9. Make sure hooks don't loop |
71 | 71 | Hooks are called once per object, therefore they should only take care of one resource at a time |
72 | 72 | 11. Default resources can now be added via `addResource(User, {...})` |
73 | 73 | 12. Update GET queries. |
74 | | - GET queries have been reworked. The following field names have changed: |
| 74 | + GET queries have been reworked. The following field names have changed: |
75 | 75 | - `__select` => `select` |
76 | 76 | - `__whereAnyOf` => `whereAnyOf` |
77 | 77 | - `__search` => `search` |
|
109 | 109 | 17. Remove empty searches. |
110 | 110 | Get queries no longer require a `search` key to access other query keys |
111 | 111 | 18. All mdoel members must be initialized to undefined, including relational arrays |
112 | | -19. Queries may no longer pass special keys with `__` or `___`. You should now put these queries in the `additionalParameters` query object |
| 112 | +19. Queries may no longer pass special keys with `__` or `___`. You should now put these queries in the `additionalParameters` query object |
113 | 113 |
|
114 | 114 | ## Version 1.x.x -> 2.x.x |
115 | 115 |
|
|
118 | 118 | 1. Make a POST endpoint in your auth router: |
119 | 119 | `router.post('/refresh', loader, refreshTokenEndpoint);` |
120 | 120 | 2. Update your front-end auth refreshTokenservice to save the `refreshToken` and `refreshExpiration` from the `loginEndpoint` |
121 | | - 3. Set a timeout to call the `refreshTokenEndpoint` route when the access token expires. Setup the body like this: `{ __refreshToken: myRefreshToken }`. This will return an updated user object, including a new access token & expiration time. |
| 121 | + 3. Set a timeout to call the `refreshTokenEndpoint` route when the access token expires. Setup the body like this: `{ __refreshToken: myRefreshToken }`. This will return an updated user object, including a new access token & expiration time. |
122 | 122 | 3. **(Optional)** PointyAPI now supports `UUID`. Follow the steps in the Readme to enable UUID (strongly recommended for production). |
123 | 123 |
|
124 | 124 | **NOTE** If you are already in production and decide to migrate to UUID, you must make sure to update relations etc |
|
0 commit comments