add the delete api

This commit is contained in:
ashrafzarkanisala
2024-09-22 14:51:15 +03:00
parent f99744338c
commit b3d891b2c8
3 changed files with 18 additions and 15 deletions

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
import 'package:syncrow_web/pages/device_managment/water_heater/models/send_schedule.dart';
import 'package:syncrow_web/pages/device_managment/water_heater/models/schedule_model.dart';
import 'package:syncrow_web/pages/visitor_password/model/device_model.dart';
import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart';
@ -177,7 +177,8 @@ class DevicesManagementApi {
}
}
Future<bool> addScheduleRecord(SendSchedule sendSchedule, String uuid) async {
Future<bool> addScheduleRecord(
ScheduleModel sendSchedule, String uuid) async {
try {
final response = await HTTPService().post(
path: ApiEndpoints.scheduleByDeviceId.replaceAll('{deviceUuid}', uuid),
@ -218,10 +219,12 @@ class DevicesManagementApi {
}
}
Future<bool> deleteScheduleRecord(String uuid) async {
Future<bool> deleteScheduleRecord(String uuid, String scheduleId) async {
try {
final response = await HTTPService().delete(
path: ApiEndpoints.scheduleByDeviceId.replaceAll('{deviceUuid}', uuid),
path: ApiEndpoints.scheduleByDeviceId
.replaceAll('{deviceUuid}', uuid)
.replaceAll('{scheduleUuid}', scheduleId),
showServerMessage: true,
expectedResponseModel: (json) {
return json['success'] ?? false;