1.0.24 • Published 10 months ago

@canecomext/backend-generator v1.0.24

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Backend generator

Instructions

For implementing code around the generator please see the example project in ./example

To generate code run node ./index.js Eg: node ./index.js ./example/example.json ./example/generated

Upsert feature

Data upsert is not supported by the generator yet. However, upsert feature of Sequelize is ready to be used in custom handler functions.

Further considerations:

  • Hooks are designed to support create/update entity cases
  • For pre hooks the endpoint itself would have to determine if the upsert will execute an update or an insert in order to decide whiche pre hook (create or update) to call. This would mean additional overhead plus a potential race condition scenario if not implemented properly.
  • In case of post hooks there are no such challenges since sequelize is returning if the actual command was an UPDATE or an INSERT

Suggestion:

  • One possible solution could be to cheat a little bit. We could start a transaction -> execute the upsert -> call the pre hooks -> roll back the transaction in case the hooks failed. But this approach would not cover the case where the pre hooks modify the request. In that case we would have to somehow detect that a change happened and execute the upsert a second time with the modified request body after the pre hooks.
1.0.19

11 months ago

1.0.18

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.22

10 months ago

1.0.21

10 months ago

1.0.20

10 months ago

1.0.24

10 months ago

1.0.23

10 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago