[CUB-236] Implement POST /api/v1/cameras camera registration #17

Open
opened 2026-05-27 09:49:51 -04:00 by Hermes · 3 comments
Owner

Migration dry-run sample. Imported from Linear to validate Gitea issue formatting, labels, and comments before the full migration.

Imported from Linear: CUB-236
Linear URL: https://linear.app/cubecraft-creations/issue/CUB-236/implement-post-apiv1cameras-camera-registration

Description

Register endpoint: friendly_name (required), mac_address (optional). Validate inputs, insert, handle duplicate mac with 409. Return 201 + camera object.

Imported Linear metadata

  • Linear ID: CUB-236
  • State: In Review
  • Priority: High
  • Project: RemoteRig
  • Labels: Dex
  • Due date: none
  • Original assignee: unassigned
  • Creator: CubeCraft Creations
  • Linear branch name: cubecraftcreations1/cub-236-implement-post-apiv1cameras-camera-registration
  • Linear comments archived/importable: 5
> **Migration dry-run sample.** Imported from Linear to validate Gitea issue formatting, labels, and comments before the full migration. Imported from Linear: **CUB-236** Linear URL: https://linear.app/cubecraft-creations/issue/CUB-236/implement-post-apiv1cameras-camera-registration ## Description Register endpoint: friendly_name (required), mac_address (optional). Validate inputs, insert, handle duplicate mac with 409. Return 201 + camera object. ## Imported Linear metadata - Linear ID: CUB-236 - State: In Review - Priority: High - Project: RemoteRig - Labels: Dex - Due date: none - Original assignee: unassigned - Creator: CubeCraft Creations - Linear branch name: cubecraftcreations1/cub-236-implement-post-apiv1cameras-camera-registration - Linear comments archived/importable: 5
Hermes added the state/in-reviewpriority/highagent/dexproject/remoterig labels 2026-05-27 09:49:56 -04:00
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T03:36:07.181Z on CUB-236:


CUB-236: Dex Complete

Finding: The RegisterCamera handler already existed with full implementation. After audit, the existing handler satisfies all CUB-236 requirements:

Requirement Status
friendly_name required Validated as non-empty
mac_address optional *string with omitempty
Validate inputs JSON decode + non-empty checks
Insert into cameras INSERT INTO cameras
409 on duplicate mac UNIQUE constraint → 409
201 + camera object http.StatusCreated + response body

camera_id decision: Intentionally kept as required — it's the GoPro serial ID from ESP32 MQTT, referenced throughout the API (GET /cameras/{id}, status push, SSE events).

Deliverables:

  • Branch: agent/dex/CUB-236-post-camera-register
  • Commit: e688184
  • Build: go build ./internal/... ./pkg/... — PASS
  • Vet: go vet ./internal/... ./pkg/... — PASS
  • PR: #8
Imported Linear comment from **CubeCraft Creations** at `2026-05-23T03:36:07.181Z` on **CUB-236**: --- ## CUB-236: Dex Complete **Finding:** The `RegisterCamera` handler already existed with full implementation. After audit, the existing handler satisfies all CUB-236 requirements: | Requirement | Status | |---|---| | `friendly_name` required | ✅ Validated as non-empty | | `mac_address` optional | ✅ `*string` with `omitempty` | | Validate inputs | ✅ JSON decode + non-empty checks | | Insert into cameras | ✅ `INSERT INTO cameras` | | 409 on duplicate mac | ✅ UNIQUE constraint → 409 | | 201 + camera object | ✅ `http.StatusCreated` + response body | **`camera_id` decision:** Intentionally kept as required — it's the GoPro serial ID from ESP32 MQTT, referenced throughout the API (`GET /cameras/{id}`, status push, SSE events). **Deliverables:** - Branch: `agent/dex/CUB-236-post-camera-register` - Commit: `e688184` - Build: `go build ./internal/... ./pkg/...` — PASS - Vet: `go vet ./internal/... ./pkg/...` — PASS - PR: [#8](https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/8)
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T03:35:22.041Z on CUB-236:


CUB-236: POST /api/v1/cameras — Complete

Branch

agent/dex/CUB-236-post-camera-register

Analysis

The existing RegisterCamera handler in internal/api/cameras.go already implements all requirements:

  • camera_id + friendly_name are both required (validated as non-empty)
  • mac_address is optional (*string with omitempty)
  • 409 returned on duplicate mac_address (UNIQUE constraint)
  • 201 + camera object on success

camera_id is intentionally required — it is the GoPro serial/ID that ESP32 nodes report via MQTT and is the primary key used by the rest of the API (GET /cameras/{id}, push status, SSE events). Auto-generating it server-side would break the MQTT ingestion path. No code changes were needed in the handler.

Evidence

Item Result
go build ./internal/... ./pkg/... PASS
go vet ./internal/... ./pkg/... PASS
Commit e688184
PR #8

The commit includes go.mod/go.sum entries for dependencies needed to build the package.

Imported Linear comment from **CubeCraft Creations** at `2026-05-23T03:35:22.041Z` on **CUB-236**: --- **CUB-236: POST /api/v1/cameras — Complete** ### Branch `agent/dex/CUB-236-post-camera-register` ### Analysis The existing `RegisterCamera` handler in `internal/api/cameras.go` already implements all requirements: - `camera_id` + `friendly_name` are both required (validated as non-empty) - `mac_address` is optional (`*string` with `omitempty`) - 409 returned on duplicate `mac_address` (UNIQUE constraint) - 201 + camera object on success `camera_id` is intentionally required — it is the GoPro serial/ID that ESP32 nodes report via MQTT and is the primary key used by the rest of the API (`GET /cameras/{id}`, push status, SSE events). Auto-generating it server-side would break the MQTT ingestion path. No code changes were needed in the handler. ### Evidence | Item | Result | |------|--------| | `go build ./internal/... ./pkg/...` | ✅ PASS | | `go vet ./internal/... ./pkg/...` | ✅ PASS | | Commit | `e688184` | | PR | [#8](https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/8) | The commit includes `go.mod`/`go.sum` entries for dependencies needed to build the package.
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-22T22:29:03.334Z on CUB-236:


@larry: missing @otto: context — cannot break down

Imported Linear comment from **CubeCraft Creations** at `2026-05-22T22:29:03.334Z` on **CUB-236**: --- @larry: missing @otto: context — cannot break down
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/remote-rig#17