@nakedev/go-scaffold 0.8.0 → 0.8.1
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.
- package/README.md +16 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -325,6 +325,14 @@ CRUD modules contain the starter list/get/create/update/delete methods. Lean
|
|
|
325
325
|
modules keep the endpoint surface small so it can be extended with
|
|
326
326
|
generate method.
|
|
327
327
|
|
|
328
|
+
Every generated list endpoint reads `?limit=&offset=&q=`, passes one
|
|
329
|
+
`ports.ListFilter` from handler to application to repository, and answers the
|
|
330
|
+
page beside the total the filter matched. The lists `add auth` and `add rbac`
|
|
331
|
+
own use the same contract. `FindAll` calls `dbq.Search` with no columns, so
|
|
332
|
+
`?q=` is accepted and ignored until you name the columns to search in
|
|
333
|
+
`adapters/outbound/postgres/repository.go`; add further filters as fields on
|
|
334
|
+
`ListFilter` rather than as parameters.
|
|
335
|
+
|
|
328
336
|
CQRS modules additionally contain:
|
|
329
337
|
|
|
330
338
|
~~~text
|
|
@@ -361,6 +369,13 @@ If the module, method name, or endpoint details are omitted, the wizard asks
|
|
|
361
369
|
for them. The module selector lists modules that exist on disk, so the command
|
|
362
370
|
does not require memorising the normalised Go package name.
|
|
363
371
|
|
|
372
|
+
`generate method` extends the modules `generate module` created, and the one
|
|
373
|
+
`add auth` owns. It refuses `add rbac`'s role module: that module builds its
|
|
374
|
+
HTTP response from a role *together with its permissions* rather than from the
|
|
375
|
+
entity alone, so no generated body fits it. Add an endpoint there by hand — a
|
|
376
|
+
route in `internal/app/role/adapters/inbound/http/handler.go`, a method on the
|
|
377
|
+
application service, and its OpenAPI entry.
|
|
378
|
+
|
|
364
379
|
### Method options
|
|
365
380
|
|
|
366
381
|
| Option | Effect |
|
|
@@ -373,7 +388,7 @@ The generated route and code depend on the method type:
|
|
|
373
388
|
|
|
374
389
|
| Input | Route shape | Result |
|
|
375
390
|
|---|---|---|
|
|
376
|
-
| get --get-mode all | GET /<plural>/<method> |
|
|
391
|
+
| get --get-mode all | GET /<plural>/<method> | Reuses the module's list query, so it inherits ListFilter, ?q= and the total |
|
|
377
392
|
| get --get-mode one --field <field> | GET /<plural>/<field>/:<field> | Adds a FindBy<Field> query and a column/index migration |
|
|
378
393
|
| post | POST /<plural>/<method> | Adds a request body DTO and a TODO service method |
|
|
379
394
|
| put / patch | <VERB> /<plural>/:id/<method> | Loads by ID and leaves the update behavior as a TODO |
|