resolve conflicts

This commit is contained in:
unknown
2024-10-08 10:59:31 +03:00
53 changed files with 1009 additions and 1535 deletions

View File

@ -4,7 +4,6 @@ import {
Controller,
Delete,
Get,
HttpException,
HttpStatus,
Param,
Post,
@ -32,52 +31,30 @@ export class AutomationController {
@UseGuards(JwtAuthGuard)
@Post()
async addAutomation(@Body() addAutomationDto: AddAutomationDto) {
try {
const automation =
await this.automationService.addAutomation(addAutomationDto);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Automation added successfully',
data: automation,
};
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
const automation =
await this.automationService.addAutomation(addAutomationDto);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Automation added successfully',
data: automation,
};
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get(':unitUuid')
async getAutomationByUnit(@Param('unitUuid') unitUuid: string) {
try {
const automation =
await this.automationService.getAutomationByUnit(unitUuid);
return automation;
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
const automation =
await this.automationService.getAutomationByUnit(unitUuid);
return automation;
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('details/:automationId')
async getAutomationDetails(@Param('automationId') automationId: string) {
try {
const automation =
await this.automationService.getAutomationDetails(automationId);
return automation;
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
``;
}
const automation =
await this.automationService.getAutomationDetails(automationId);
return automation;
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@ -86,18 +63,11 @@ export class AutomationController {
@Param('unitUuid') unitUuid: string,
@Param('automationId') automationId: string,
) {
try {
await this.automationService.deleteAutomation(unitUuid, automationId);
return {
statusCode: HttpStatus.OK,
message: 'Automation Deleted Successfully',
};
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
await this.automationService.deleteAutomation(unitUuid, automationId);
return {
statusCode: HttpStatus.OK,
message: 'Automation Deleted Successfully',
};
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@ -106,23 +76,16 @@ export class AutomationController {
@Body() updateAutomationDto: UpdateAutomationDto,
@Param('automationId') automationId: string,
) {
try {
const automation = await this.automationService.updateAutomation(
updateAutomationDto,
automationId,
);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Automation updated successfully',
data: automation,
};
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
const automation = await this.automationService.updateAutomation(
updateAutomationDto,
automationId,
);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Automation updated successfully',
data: automation,
};
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@ -131,21 +94,14 @@ export class AutomationController {
@Body() updateAutomationStatusDto: UpdateAutomationStatusDto,
@Param('automationId') automationId: string,
) {
try {
await this.automationService.updateAutomationStatus(
updateAutomationStatusDto,
automationId,
);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Automation status updated successfully',
};
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
await this.automationService.updateAutomationStatus(
updateAutomationStatusDto,
automationId,
);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Automation status updated successfully',
};
}
}