Commit b045212
refactor(api): inject BookPersistence/UserPersistence at HTTP layer
- NewRouter accepts *gorm.DB and constructs GORM-backed stores internally.
- NewBookRepository and NewUserRepository take persistence interfaces,
matching service boundaries and allowing gomock at the store API.
- readyz postgres probe uses *gorm.DB directly (no type assertion).
- Fail fast in main when NewDatabase returns nil.
- Extend probe tests with an in-memory SQLite ping.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 90b2c12 commit b045212
8 files changed
Lines changed: 102 additions & 164 deletions
File tree
- cmd/server
- pkg/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | | - | |
| 37 | + | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
0 commit comments