updated endpoint for getting automation by id

This commit is contained in:
hannathkadher
2025-03-14 12:55:33 +04:00
parent 0673548745
commit 88aac86b10
3 changed files with 7 additions and 4 deletions

View File

@ -427,6 +427,8 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
emit(CreateSceneLoading());
try {
Project? project = HomeCubit.getInstance().project;
tasksList.clear();
tempTasksList.clear();
selectedValues.clear();
@ -442,7 +444,7 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
conditionRule = 'or';
final response = event.isAutomation
? await SceneApi.getAutomationDetails(event.sceneId)
? await SceneApi.getAutomationDetails(event.sceneId, project?.uuid ?? '')
: await SceneApi.getSceneDetails(event.sceneId);
if (response.id.isNotEmpty) {
if (event.isAutomation) {

View File

@ -156,7 +156,7 @@ abstract class ApiEndpoints {
static const String getUnitAutomation = '/projects/{projectId}/communities/{communityId}/spaces/{unitUuid}/automations';
static const String getAutomationDetails =
'/automation/details/{automationId}';
'/projects/{projectId}/automations/{automationId}';
/// PUT
static const String updateScene = '/scene/tap-to-run/{sceneId}';

View File

@ -119,11 +119,12 @@ class SceneApi {
//automation details
static Future<SceneDetailsModel> getAutomationDetails(
String automationId) async {
String automationId, String projectId) async {
try {
final response = await _httpService.get(
path: ApiEndpoints.getAutomationDetails
.replaceAll('{automationId}', automationId),
.replaceAll('{automationId}', automationId)
.replaceAll('{projectId}', projectId),
showServerMessage: false,
expectedResponseModel: (json) => SceneDetailsModel.fromJson(json),
);