feat(models): source contacts + time_tracking DTOs from mokosh-types #457
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/MAPPS-383-adopt-mokosh-types-contacts-time"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MAPPS-383 asked to finish an adoption that had not started. Its background says MAPPS-378 (PR #445) already added an HTTPS git dependency on mokosh-types and re-exported auth / tenants / tickets from it. The source of truth says otherwise: MAPPS-378 landed as PR #443 (commit
cec5d47) and its own message records that crate adoption was feasibility-tested and rejected as not CI-viable, because it was tried over ssh://git@git.a8n.run and neither the pre-commit container nor the Forgejo check runner carries SSH credentials. Cargo.toml, Cargo.lock, and a grep of src/ all confirm the dependency was absent on main.That blocker is specific to the SSH transport, not to the crate. dev.a8n.run serves mokosh-server over anonymous HTTPS, which needs no credentials at all. Verified before writing code:
git ls-remotesucceeds with an empty HOME, andcargo fetchagainst the HTTPS URL succeeds inside the rust-builder-glibc image the gate and CI use. So this change adds the dependency over HTTPS and does the adoption the issue actually asks for.src/modules/contactsandsrc/modules/time_trackingare now one-line re-exports ofmokosh_types::contactsandmokosh_types::time_tracking. Theirmodels.rshand copies are deleted, and so are theroutes.rs/service.rsfiles beside them: those were byte-copies of server handlers gated behind aserverfeature that cannot compile here at all, since this crate depends on neither axum nor sqlx. Each module keeps a test that converts the shared type to the re-exported name through an identityfn, so re-introducing a hand copy fails to compile rather than silently drifting again.The issue's usage counts do not match this repo: the SPA had zero references to the time_tracking types and exactly one to contacts (
Addressin pages/contacts.rs). Everything else reads purpose-built subset structs, the same pattern MAPPS-378 preserved for tickets. The two divergences that do reach real code are fixed.RemoteTimeEntry.billing_statusis nowmokosh_types::tickets::BillingStatusinstead ofString, so an unrecognized wire tag fails decoding instead of rendering; the row also stops printing the raw tag ("ready_to_bill") and gets a label.CompanyType::Internalnow has a title-case arm inhumanize_company_type, and the company form preserves a non-customer-facing type as its own option so editing an internal company cannot silently retype it to Client, mirroring the existingstate_optionsidiom in the same file. The week-levelapproval_statusstaysStringbecause the sharedTimesheetSummaryResponsetypes it asStringtoo.Note for the reviewer: auth, tenants, and tickets are still hand-copied under
src/modules/<module>/models.rs. They are out of scope here and want their own issue now that the HTTPS transport is proven.Gate green via
just pre-commit: fmt --check, clippy --all-targets -D warnings, cargo check --target wasm32-unknown-unknown, cargo test --lib (240 passed, 0 failed; was 232).#MAPPS-383