From fdaa1a0472e39095cd94ecf11792b0297d4a23e3 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 9 May 2026 13:38:52 -0400 Subject: [PATCH] feat(flutter/api): QuarantineApi for flag/unflag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dio client for /api/quarantine — flag a track with a reason + optional notes, unflag by track id. Mirrors the server's user-scoped quarantine endpoints (separate from /admin/quarantine). Used by the track-actions menu's Hide/Unhide action in the next slice of commits. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../lib/api/endpoints/quarantine.dart | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 flutter_client/lib/api/endpoints/quarantine.dart diff --git a/flutter_client/lib/api/endpoints/quarantine.dart b/flutter_client/lib/api/endpoints/quarantine.dart new file mode 100644 index 00000000..5568e222 --- /dev/null +++ b/flutter_client/lib/api/endpoints/quarantine.dart @@ -0,0 +1,25 @@ +import 'package:dio/dio.dart'; + +/// /api/quarantine — flag a track (with reason + optional notes) and +/// unflag it. Both endpoints are user-scoped: callers can only flag +/// their own quarantine entries; admins use a separate /admin/quarantine +/// surface. +class QuarantineApi { + QuarantineApi(this._dio); + final Dio _dio; + + /// POST /api/quarantine. Server returns 201 with the row. + /// Reason values: bad_rip | wrong_file | wrong_tags | duplicate | other. + Future flag(String trackId, String reason, {String notes = ''}) async { + await _dio.post('/api/quarantine', data: { + 'track_id': trackId, + 'reason': reason, + 'notes': notes, + }); + } + + /// DELETE /api/quarantine/{track_id}. Server returns 204. + Future unflag(String trackId) async { + await _dio.delete('/api/quarantine/$trackId'); + } +}