Add bbox PATCH endpoint + seed watermelon test bbox
- PATCH /api/objects/:id/pictures/:pictureId sets bounding box values - Migration seeds bbox for watermelon test object (x=0.08, y=0.10, w=0.78, h=0.76) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -220,6 +220,20 @@ router.post('/:id/pictures/:pictureId', async (req, res, next) => {
|
||||
} catch (err) { next(err); }
|
||||
});
|
||||
|
||||
// PATCH /api/objects/:id/pictures/:pictureId — set bounding box (0–1 percentages)
|
||||
router.patch('/:id/pictures/:pictureId', async (req, res, next) => {
|
||||
try {
|
||||
const { bbox_x, bbox_y, bbox_w, bbox_h } = req.body;
|
||||
await query(
|
||||
`UPDATE object_pictures
|
||||
SET bbox_x = $3, bbox_y = $4, bbox_w = $5, bbox_h = $6
|
||||
WHERE object_id = $1 AND picture_id = $2`,
|
||||
[req.params.id, req.params.pictureId, bbox_x ?? null, bbox_y ?? null, bbox_w ?? null, bbox_h ?? null]
|
||||
);
|
||||
res.status(204).end();
|
||||
} catch (err) { next(err); }
|
||||
});
|
||||
|
||||
// DELETE /api/objects/:id/pictures/:pictureId
|
||||
router.delete('/:id/pictures/:pictureId', async (req, res, next) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user