Repository navigation
Club: add a camera the catalogue does not have, with its photos - #400
Conversation
A member could send photos only from an existing board's panel; a camera the catalogue lacked needed ipctool's output, and even then nothing could add it: only the importers make boards. Sending: /cameras/report#new takes the camera's maker, its board's marking or model, at least one photo, and optionally the SoC, ipctool's output and a boot log (POST /api/v1/club/reports, channel web, maker/board/soc in place of model). The proposal is kept as sent in report_proposals (migration 028), guarded like the other owner-report tables. The catalogue's empty searches and /club's My submissions link to the form. Reviewing: the queue shows the proposal and the board publishing would add (boards.Suggest): the catalogue's own maker when the name or an alias matches, ids made the way the importers make them, and the board that already answers to the marking, if one does. The reviewer corrects any of it; publishing with new_board adds the maker and the board (boards.CreateModel), with an alias of source "club" so a later archive import joins it instead of adding a twin, and refuses a board id or marking the catalogue already has. `openipc reports publish <id> --new-board` does the same. Decide now adds the board, links the report and records the review in one transaction, so a refused board or a link to a missing one leaves nothing behind -- before, a failed link left earlier links in place. Stars are unchanged: 1 per photo and file, once published.
PR Summary by QodoLet Club members submit and publish cameras missing from the catalogue
AI Description
Diagram
High-Level Assessment
Files changed (30)
|
Code Review by Qodo
1.
|
…n, link only on publish, importers join club boards - Redact replaces any MAC written as six colon- or hyphen-separated pairs, not only the one ipctool named: a boot log or U-Boot environment sent without ipctool's output (to a catalogue board, or with a new camera's photos) was published with its ethaddr. - Decide writes the new board, the links, the review and the sender's stars in one transaction: a ledger that cannot be written no longer leaves the board published and the decision unrepeatable. - Rejecting links nothing again; the links had moved outside the publish branch. - The archive importer puts a unit on the board a review added under the reviewer's id (alias source club) instead of making a twin; the snapshot importer accepts a maker a review added; Suggest knows the importers' makers and cuts the ids it makes to their lengths. - NewCamera.test.tsx: its field helper takes an Element (typecheck).
A camera owner can now add a camera the catalogue does not have. They send its maker, its board's marking or model, and photos of it; ipctool is not needed. Publishing the report adds the board to the catalogue, and the member earns stars as usual.
Why
Until now a member could send photos only from an existing board's panel. A camera the catalogue lacked needed ipctool's output, and even then nothing could add it to the catalogue: only the importers create boards.
Sending
/cameras/report#newhas a new form,club/NewCameraForm. It asks for the maker, the marking or model, and at least one photo. The SoC, ipctool's output and a boot log are optional.POST /api/v1/club/reportswithchannel=web, sendingmaker,boardandsocinstead ofmodel. The rules are inreports.proposalOf:model;report_proposals(migration 028), which is insert-only and guarded like the other owner-report tables./club, where a pending report is shown as "New: Maker Board".Reviewing
/club/reviewshows the proposal and the board that publishing would add (boards.Suggest):new_board(boards.CreateModel):club, so a later import of the same board joins it instead of adding a twin;openipc reports publish <id> --new-board.Decidenow adds the board, links the report and records the review in one transaction. A refused board, or a link to a board that does not exist, leaves nothing behind. Before this, a failed link kept the earlier links in a multi-board publish.data/catalogueto resolve SoCs. If loading fails, it logs a warning and keeps only the label.Stars are unchanged: 1 per photo and file, once published.
Tests
service/run.sh test: all 22 packages pass. New tests:reports: what a proposal is accepted or refused with; a proposal cannot be changed after it is stored.club: send, queue suggestion, a refused twin board that leaves nothing behind, publish, stars, the photos listed for the board's unit, and a second owner linked to the existing board.boards: maker matching, refusing a twin, a later import joining the board, and refusing bad ids.deploytest:report_proposalsis now one of the tables onlyinternal/reportsmay touch.frontend(node:24): lint and typecheck are clean, and all 673 tests pass. The newNewCamera.test.tsxcovers what the form posts and the review page publishing a corrected board or an existing one.deploy/static/build.shandcheck-bundle.shpass: 698 files checked against reserved-paths.Not yet done
/club/review, then check that the board appears in/cameras/boardswith the photos and that/clubshows +2 ★.