Repository navigation
Commit 311d679
authored
refactor: move the admin view types into piquel-common (#226)
The views of administration (what the admin dashboard shows, the CLI
prints as JSON and the database crate decodes into) had a crate of their
own, `piquel-admin-api`, holding one file. They are shared types, and
`piquel-common` is the one home for shared types, so they move there and
the workspace has one fewer crate.
**What moved.** `crates/admin-api/src/lib.rs` is now
`crates/common/src/admin.rs`, reached as `piquel_common::admin::X`.
Every item keeps its visibility and docs, including the `Identity` and
`Passkey` re-exports. No behaviour changes: only import paths, manifests
and docs differ.
**Feature gating.** The module sits behind a new `admin` feature, which
enables the optional `serde_json` it needs. Auth, `crates/database` and
`crates/ui` enable it. The Rust SDK (`crates/auth-sdk`) still builds
`piquel-common` with no features, so it compiles nothing new. No view
type implements `sqlx` traits (the database crate builds them with
`query_as!`), so nothing new is needed under `sqlx`, and the offline
query cache is unchanged.
**`REGISTRATION_PATH`.** It is already gone: `git grep
REGISTRATION_PATH` finds nothing on `main` (18259b7), so there is
nothing to remove from `admin/service.rs`.
**Docs.** The `crates/admin-api` row is gone from
`docs/architecture/monorepo.md`, and the `crates/common` row describes
the `admin` feature instead. `surfaces.md`, `database-crate.md`, the
README and two code comments now name `piquel_common::admin`.
**Checks run:**
- `cargo fmt --all --check`: passes
- `just lint` (clippy pedantic, `-D warnings`, plus ESLint): passes
- `just doc` (`-D warnings`): passes
- `just db test`: 258 of 258 tests pass, and the sqlx query cache check
passes with no `.sqlx` changes
- `cargo check -p piquel-auth`: passes; `cargo tree` shows the SDK pulls
in only `piquel-common`'s default features
- `cargo clippy -p piquel-common --no-default-features --features
admin`: passes
Reviewed lightly, as a change of paths only, by Claude Opus 5.5 on
xhigh. Verdict: approved. It checked that:
- only the module header changed in the move, at 98% similarity;
- the SDK resolves piquel-common with default features only;
- no reference to `admin-api` is left.
Its two doc-wrap nits are applied.
> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus
5.5 (via T3 Code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary
This change consolidates the admin view types in `piquel-common` and
removes the standalone `piquel-admin-api` crate. The types are available
through `piquel_common::admin` when the new `admin` feature is enabled.
## Changes by scope
- **Common crate:** Added the feature-gated `admin` module. It contains
the administration views and request types, including `User`, `Client`,
`Event`, and their search and pagination types. It re-exports `Identity`
and `Passkey` from `protocol::api`.
- **Feature and dependency wiring:** Added the `admin` feature to
`piquel-common`, backed by optional `serde_json`. Enabled it for the
auth service, database crate, and UI crate. The Rust SDK continues to
use `piquel-common` without features.
- **Crate removal and imports:** Removed `crates/admin-api` from the
workspace and deleted its manifest. Updated auth, database, and UI
imports to use `piquel_common::admin`.
- **Documentation:** Updated the README and architecture docs to
describe the new location of the admin views and the feature boundary.
Updated related code comments to refer to `piquel_common::admin`.
The change relocates the existing view types; it does not report changes
to their behavior. The author reports that `REGISTRATION_PATH` was
already absent from `main` at `18259b74`, and that the SQLx offline
query cache is unchanged.
## Reported checks
The author reports successful runs of `cargo fmt --all --check`, `just
lint`, `just doc`, `just db test` (258 of 258 tests, with the SQLx query
cache check passing), `cargo check -p piquel-auth`, and `cargo clippy -p
piquel-common --no-default-features --features admin`. The author also
reports that `cargo tree` confirms the SDK uses only `piquel-common`’s
default features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent ddd021b commit 311d679
32 files changed
Lines changed: 68 additions & 92 deletions
File tree
- apps/auth-service
- src
- admin
- cli
- web/admin
- crates
- admin-api
- common
- src
- database
- src/repositories
- emails
- oidc
- users
- ui
- src/admin
- docs/architecture
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 13 | | |
18 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
0 commit comments