1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Actix-web handlers and utoipa annotations for the generated models.
//!
//! The model layer already knows every column, its type, and the table's primary key —
//! everything a REST endpoint needs. Deriving the handlers from the same source keeps the
//! route, the SQL, and the OpenAPI document in step: a column added to the database reaches
//! the HTTP surface and the published schema without being described a third time.
//!
//! One `routes.rs` per model folder, plus a parent `api` module collecting them into a single
//! `configure` and one `ApiDoc`. A view gets `GET` only — the same read-only rule the model
//! layer enforces, carried up to the transport.
//!
//! Routes are never mounted for you. `configure` is a function you call inside whatever
//! `web::scope` and auth middleware your application already uses: generating 800 open CRUD
//! endpoints against a live business database would be a security hole, not a feature.
use crateSchema;
use crateModel;
pub use parent;
/// Renders the `routes.rs` for one model.
///
/// Each handler is emitted only when the model actually has the method behind it: a table whose
/// every column is the key or database-assigned gets no `update`, and a route calling it would
/// not compile.