diff --git a/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart b/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart index a1e59dd..844d4b1 100644 --- a/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart +++ b/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart @@ -154,7 +154,7 @@ class AdminCardsApiV2 { final card = await _db.packDao.getCardById(cardId); if (card == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The requested card does not exist or has been deleted', 'details': 'Card with ID "$cardId" was not found in the database. Please verify the card ID and try again.', @@ -242,7 +242,7 @@ class AdminCardsApiV2 { final existing = await _db.packDao.getCardById(cardId); if (existing == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The card you are trying to update does not exist', 'details': 'Card with ID "$cardId" was not found. The card may have been deleted or the ID may be incorrect.', @@ -305,7 +305,7 @@ class AdminCardsApiV2 { // Если передан packId, создать связь через CardPackCards if (data['packId'] != null) { final packId = data['packId'] as String; - await _db.packDao.addCardToPack(cardId, packId); + await _db.packDao.addCardToPack(cardId: cardId, packId: packId); } final created = await _db.packDao.getCardById(cardId); @@ -394,7 +394,7 @@ class AdminCardsApiV2 { final existing = await _db.packDao.getCardById(cardId); if (existing == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The card you are trying to update does not exist', 'details': 'Card with ID "$cardId" was not found. The card may have been deleted or the ID may be incorrect.', @@ -456,7 +456,7 @@ class AdminCardsApiV2 { final existing = await _db.packDao.getCardById(cardId); if (existing == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The card you are trying to delete does not exist', 'details': 'Card with ID "$cardId" was not found. It may have already been deleted.', @@ -468,7 +468,7 @@ class AdminCardsApiV2 { await _db.packDao.deleteCard(cardId); return Response.ok( - body: json.encode({ + json.encode({ 'success': true, 'message': 'Card deleted successfully', }), @@ -522,7 +522,7 @@ class AdminCardsApiV2 { final card = await _db.packDao.getCardById(cardId); if (card == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The requested card does not exist', 'details': 'Card with ID "$cardId" was not found. Cannot retrieve voices for a non-existent card.', @@ -661,7 +661,7 @@ class AdminCardsApiV2 { final card = await _db.packDao.getCardById(cardId); if (card == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The card you are trying to add a voice to does not exist', 'details': 'Card with ID "$cardId" was not found. Cannot add voice to a non-existent card.', @@ -745,7 +745,7 @@ class AdminCardsApiV2 { final card = await _db.packDao.getCardById(cardId); if (card == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Card not found', 'message': 'The card you are trying to remove a voice from does not exist', 'details': 'Card with ID "$cardId" was not found. Cannot remove voice from a non-existent card.', @@ -758,7 +758,7 @@ class AdminCardsApiV2 { final voice = await _db.packDao.getVoiceById(voiceId); if (voice == null) { return Response.notFound( - body: json.encode({ + json.encode({ 'error': 'Voice not found', 'message': 'The voice you are trying to remove does not exist', 'details': 'Voice with ID "$voiceId" was not found. It may have already been deleted.', @@ -788,7 +788,7 @@ class AdminCardsApiV2 { await _db.packDao.deleteVoice(voiceId); return Response.ok( - body: json.encode({ + json.encode({ 'success': true, 'message': 'Voice removed successfully', }),