Skip to content

Actuators#195

Open
MrBert wants to merge 16 commits intomainfrom
Actuators
Open

Actuators#195
MrBert wants to merge 16 commits intomainfrom
Actuators

Conversation

@MrBert
Copy link
Collaborator

@MrBert MrBert commented Dec 13, 2025

Added logi for proividing Actuator informations, still need post logic for tests

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this should be in the repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

.filter(and_(DB_Actuator.deletion_date.is_(None), DB_Actuator.enabled.is_(True)))
.all()
)
return [Mapper.map_db_actuator_to_actuator(x) for x in result]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:
any(Mapper.map_db_actuator_to_actuator(x) for x in result)
?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need Iterable not a boolean

Comment on lines +325 to +326
user = verify_token(x_access_token)
if user.role != "Admin":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:=

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there's no need to check if user is not None. Hence, grouping the two lines using the := operator can be avoided.


battery_status = Database.instance.get_last_battery_status(actuator_id)
temp_data = Database.instance.get_last_temperature_status(actuator_id)
temperature, humidity = temp_data if temp_data else (None, None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temperature, humidity = temp_data or (None, None)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +288 to +292
export async function fetchActuatorLogs(actuatorId : string): Promise<ActuatorLogsResponse> {
return await apiPOST(baseUrl.concat("api/v1/actuators/"+actuatorId+"/log"), (response : any) => {
return response.json();
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coding style is different from the previous code. For example, there's extra space before the : in the parameters definition. Or there are missing spaces around the + operator.

Comment on lines +325 to +326
user = verify_token(x_access_token)
if user.role != "Admin":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there's no need to check if user is not None. Hence, grouping the two lines using the := operator can be avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments