fix(plans, recipes): added new end points for plans and recipes creation

This commit is contained in:
Username1548
2025-05-19 21:23:13 +07:00
parent cffa48d2ca
commit b942168167
13 changed files with 460 additions and 193 deletions

View File

@@ -1,7 +1,3 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:eatvio_app/core/image_compressing/image_compress_utility.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -20,20 +16,5 @@ class CreatePlanModel with _$CreatePlanModel {
required List<bool> type,
XFile? image,
required List<PacketOptions> options,
}) = _CreatePlanModel;
Future<Map<String, dynamic>> toCreationJson() async => {
'name': name,
'duration': duration,
'state': 'active',
'description_md': details,
'type[slim]': type[0] ? '1' : '0',
'type[fit]': type[1] ? '1' : '0',
'type[wellness]': type[2] ? '1' : '0',
'type[behavior]': type[3] ? '1' : '0',
'image': image != null ? await MultipartFile.fromFile((await ImageCompressUtility.compressFile(File(image!.path))).path, filename: image!.name) : null,
};
Map<String, dynamic> toOptionCreationJson() => {'packet1_options': options[0]};
Map<String, dynamic> toOptionsCreationJson() => {'packet1_options': options[0], 'packet2_options': options[1], 'packet3_options': options[2]};
}) = _CreatePlanModel;
}