fix
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions

This commit is contained in:
Dmitry 2025-12-15 00:13:52 +03:00
parent ef5d7318e7
commit a4c33e99bf

View file

@ -154,7 +154,7 @@ class AdminCardsApiV2 {
final card = await _db.packDao.getCardById(cardId); final card = await _db.packDao.getCardById(cardId);
if (card == null) { if (card == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The requested card does not exist or has been deleted', '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.', '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); final existing = await _db.packDao.getCardById(cardId);
if (existing == null) { if (existing == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The card you are trying to update does not exist', '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.', '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 // Если передан packId, создать связь через CardPackCards
if (data['packId'] != null) { if (data['packId'] != null) {
final packId = data['packId'] as String; 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); final created = await _db.packDao.getCardById(cardId);
@ -394,7 +394,7 @@ class AdminCardsApiV2 {
final existing = await _db.packDao.getCardById(cardId); final existing = await _db.packDao.getCardById(cardId);
if (existing == null) { if (existing == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The card you are trying to update does not exist', '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.', '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); final existing = await _db.packDao.getCardById(cardId);
if (existing == null) { if (existing == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The card you are trying to delete does not exist', '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.', '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); await _db.packDao.deleteCard(cardId);
return Response.ok( return Response.ok(
body: json.encode({ json.encode({
'success': true, 'success': true,
'message': 'Card deleted successfully', 'message': 'Card deleted successfully',
}), }),
@ -522,7 +522,7 @@ class AdminCardsApiV2 {
final card = await _db.packDao.getCardById(cardId); final card = await _db.packDao.getCardById(cardId);
if (card == null) { if (card == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The requested card does not exist', 'message': 'The requested card does not exist',
'details': 'Card with ID "$cardId" was not found. Cannot retrieve voices for a non-existent card.', '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); final card = await _db.packDao.getCardById(cardId);
if (card == null) { if (card == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The card you are trying to add a voice to does not exist', '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.', '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); final card = await _db.packDao.getCardById(cardId);
if (card == null) { if (card == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Card not found', 'error': 'Card not found',
'message': 'The card you are trying to remove a voice from does not exist', '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.', '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); final voice = await _db.packDao.getVoiceById(voiceId);
if (voice == null) { if (voice == null) {
return Response.notFound( return Response.notFound(
body: json.encode({ json.encode({
'error': 'Voice not found', 'error': 'Voice not found',
'message': 'The voice you are trying to remove does not exist', '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.', '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); await _db.packDao.deleteVoice(voiceId);
return Response.ok( return Response.ok(
body: json.encode({ json.encode({
'success': true, 'success': true,
'message': 'Voice removed successfully', 'message': 'Voice removed successfully',
}), }),