updated Admin UI translations for Error Messages of API
parent
0638f18b16
commit
c0e363c87d
File diff suppressed because it is too large
Load Diff
|
@ -217,7 +217,7 @@ class CombinedEquipmentItem:
|
|||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACE')
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
||||
# check relation with meter
|
||||
cursor.execute(" SELECT meter_id "
|
||||
|
@ -604,7 +604,7 @@ class CombinedEquipmentEquipmentCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_EQUIPMENT_RELATION_EXISTED')
|
||||
description='API.COMBINED_EQUIPMENT_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_combined_equipments_equipments (combined_equipment_id, equipment_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1474,7 +1474,7 @@ class CombinedEquipmentMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_METER_RELATION_EXISTED')
|
||||
description='API.COMBINED_EQUIPMENT_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_combined_equipments_meters (combined_equipment_id, meter_id, is_output ) "
|
||||
" VALUES (%s, %s, %s) ")
|
||||
|
@ -1660,7 +1660,7 @@ class CombinedEquipmentOfflineMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_OFFLINE_METER_RELATION_EXISTED')
|
||||
description='API.COMBINED_EQUIPMENT_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_combined_equipments_offline_meters "
|
||||
" (combined_equipment_id, offline_meter_id, is_output ) "
|
||||
|
@ -1847,7 +1847,7 @@ class CombinedEquipmentVirtualMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.COMBINED_EQUIPMENT_VIRTUAL_METER_RELATION_EXISTED')
|
||||
description='API.COMBINED_EQUIPMENT_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_combined_equipments_virtual_meters "
|
||||
" (combined_equipment_id, virtual_meter_id, is_output ) "
|
||||
|
|
|
@ -252,7 +252,7 @@ class CostCenterItem:
|
|||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATIONSHIP_WITH_SPACES')
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
||||
# check relation with shopfloors
|
||||
cursor.execute(" SELECT id "
|
||||
|
@ -442,7 +442,7 @@ class CostCenterTariffCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.TARIFF_ALREADY_ASSOCIATED_WITH_COST_CENTER')
|
||||
description='API.TARIFF_IS_ALREADY_ASSOCIATED_WITH_COST_CENTER')
|
||||
|
||||
add_row = (" INSERT INTO tbl_cost_centers_tariffs "
|
||||
" (cost_center_id, tariff_id) "
|
||||
|
|
|
@ -472,7 +472,7 @@ class DistributionCircuitPointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.DISTRIBUTION_CIRCUIT_POINT_RELATION_EXISTED')
|
||||
description='API.DISTRIBUTION_CIRCUIT_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_distribution_circuits_points (distribution_circuit_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -43,7 +43,7 @@ class EmailMessageCollection:
|
|||
if start_datetime_utc >= end_datetime_utc:
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME')
|
||||
description='API.START_DATETIME_MUST_BE_EARLIER_THAN_END_DATETIME')
|
||||
|
||||
try:
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
|
|
|
@ -217,7 +217,7 @@ class EquipmentItem:
|
|||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SPACE')
|
||||
description='API.THERE_IS_RELATION_WITH_SPACES')
|
||||
|
||||
# check relation with combined equipments
|
||||
cursor.execute(" SELECT combined_equipment_id "
|
||||
|
@ -1320,7 +1320,7 @@ class EquipmentMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.EQUIPMENT_METER_RELATION_EXISTED')
|
||||
description='API.EQUIPMENT_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_equipments_meters (equipment_id, meter_id, is_output ) "
|
||||
" VALUES (%s, %s, %s) ")
|
||||
|
@ -1505,7 +1505,7 @@ class EquipmentOfflineMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.EQUIPMENT_OFFLINE_METER_RELATION_EXISTED')
|
||||
description='API.EQUIPMENT_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_equipments_offline_meters (equipment_id, offline_meter_id, is_output ) "
|
||||
" VALUES (%s, %s, %s) ")
|
||||
|
@ -1691,7 +1691,7 @@ class EquipmentVirtualMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.EQUIPMENT_VIRTUAL_METER_RELATION_EXISTED')
|
||||
description='API.EQUIPMENT_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_equipments_virtual_meters (equipment_id, virtual_meter_id, is_output ) "
|
||||
" VALUES (%s, %s, %s) ")
|
||||
|
|
|
@ -929,7 +929,7 @@ class MeterPointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.METER_POINT_RELATION_EXISTED')
|
||||
description='API.METER_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_meters_points (meter_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -346,7 +346,7 @@ class OfflineMeterItem:
|
|||
title='API.BAD_REQUEST',
|
||||
description='API.THIS_OFFLINE_METER_IS_BEING_USED_BY_A_VIRTUAL_METER')
|
||||
|
||||
# check relationship with spaces
|
||||
# check relation with spaces
|
||||
cursor.execute(" SELECT id "
|
||||
" FROM tbl_spaces_offline_meters "
|
||||
" WHERE offline_meter_id = %s ", (id_,))
|
||||
|
@ -430,7 +430,7 @@ class OfflineMeterItem:
|
|||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATIONSHIP_WITH_EQUIPMENTS')
|
||||
description='API.THERE_IS_RELATION_WITH_EQUIPMENTS')
|
||||
|
||||
# check relation with equipment parameters
|
||||
cursor.execute(" SELECT equipment_id "
|
||||
|
|
|
@ -103,7 +103,7 @@ class PrivilegeItem:
|
|||
cnx = mysql.connector.connect(**config.myems_user_db)
|
||||
cursor = cnx.cursor()
|
||||
|
||||
# check relationship with users
|
||||
# check relation with users
|
||||
cursor.execute(" SELECT id "
|
||||
" FROM tbl_users "
|
||||
" WHERE privilege_id = %s ", (id_,))
|
||||
|
@ -113,7 +113,7 @@ class PrivilegeItem:
|
|||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATIONSHIP_WITH_USERS')
|
||||
description='API.THERE_IS_RELATION_WITH_USERS')
|
||||
|
||||
cursor.execute(" SELECT name "
|
||||
" FROM tbl_privileges "
|
||||
|
@ -144,7 +144,7 @@ class PrivilegeItem:
|
|||
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_PRIVILEGE_ID_')
|
||||
description='API.INVALID_PRIVILEGE_ID')
|
||||
if 'name' not in new_values['data'] or \
|
||||
not isinstance(new_values['data']['name'], str) or \
|
||||
len(str.strip(new_values['data']['name'])) == 0:
|
||||
|
|
|
@ -352,7 +352,7 @@ class SensorPointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SENSOR_POINT_RELATION_EXISTED')
|
||||
description='API.SENSOR_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_sensors_points (sensor_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -278,7 +278,7 @@ class ShopfloorItem:
|
|||
description='API.INVALID_SHOPFLOOR_ID')
|
||||
if int(id_) == 1:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.THIS_SHOPFLOOR_CAN_NOT_BE_DELETED')
|
||||
description='API.THIS_SHOPFLOOR_CANNOT_BE_DELETED')
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||
cursor = cnx.cursor()
|
||||
|
@ -603,7 +603,7 @@ class ShopfloorEquipmentCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_EQUIPMENT_RELATION_EXISTED')
|
||||
description='API.SHOPFLOOR_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_shopfloors_equipments (shopfloor_id, equipment_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -782,7 +782,7 @@ class ShopfloorMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_METER_RELATION_EXISTED')
|
||||
description='API.SHOPFLOOR_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_shopfloors_meters (shopfloor_id, meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -960,7 +960,7 @@ class ShopfloorOfflineMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_OFFLINE_METER_RELATION_EXISTED')
|
||||
description='API.SHOPFLOOR_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_shopfloors_offline_meters (shopfloor_id, offline_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1138,7 +1138,7 @@ class ShopfloorPointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_POINT_RELATION_EXISTED')
|
||||
description='API.SHOPFLOOR_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_shopfloors_points (shopfloor_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1303,7 +1303,7 @@ class ShopfloorSensorCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_SENSOR_RELATION_EXISTED')
|
||||
description='API.SHOPFLOOR_SENSOR_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_shopfloors_sensors (shopfloor_id, sensor_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1481,7 +1481,7 @@ class ShopfloorVirtualMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SHOPFLOOR_VIRTUAL_METER_RELATION_EXISTED')
|
||||
description='API.SHOPFLOOR_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_shopfloors_virtual_meters (shopfloor_id, virtual_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -360,7 +360,7 @@ class SpaceItem:
|
|||
description='API.INVALID_SPACE_ID')
|
||||
if int(id_) == 1:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.THIS_SPACE_CAN_NOT_BE_DELETED')
|
||||
description='API.THIS_SPACE_CANNOT_BE_DELETED')
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||
cursor = cnx.cursor()
|
||||
|
@ -899,7 +899,7 @@ class SpaceCombinedEquipmentCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_COMBINED_EQUIPMENT_RELATION_EXISTED')
|
||||
description='API.SPACE_COMBINED_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_combined_equipments (space_id, combined_equipment_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1064,7 +1064,7 @@ class SpaceEquipmentCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_EQUIPMENT_RELATION_EXISTED')
|
||||
description='API.SPACE_EQUIPMENT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_equipments (space_id, equipment_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1242,7 +1242,7 @@ class SpaceMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_METER_RELATION_EXISTED')
|
||||
description='API.SPACE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_meters (space_id, meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1422,7 +1422,7 @@ class SpaceOfflineMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_OFFLINE_METER_RELATION_EXISTED')
|
||||
description='API.SPACE_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_offline_meters (space_id, offline_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1600,7 +1600,7 @@ class SpacePointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_POINT_RELATION_EXISTED')
|
||||
description='API.SPACE_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_points (space_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1765,7 +1765,7 @@ class SpaceSensorCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_SENSOR_RELATION_EXISTED')
|
||||
description='API.SPACE_SENSOR_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_sensors (space_id, sensor_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1929,7 +1929,7 @@ class SpaceShopfloorCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_SHOPFLOOR_RELATION_EXISTED')
|
||||
description='API.SPACE_SHOPFLOOR_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_shopfloors (space_id, shopfloor_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -2093,7 +2093,7 @@ class SpaceStoreCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_STORE_RELATION_EXISTED')
|
||||
description='API.SPACE_STORE_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_stores (space_id, store_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -2257,7 +2257,7 @@ class SpaceTenantCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_TENANT_RELATION_EXISTED')
|
||||
description='API.SPACE_TENANT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_tenants (space_id, tenant_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -2435,7 +2435,7 @@ class SpaceVirtualMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.SPACE_VIRTUAL_METER_RELATION_EXISTED')
|
||||
description='API.SPACE_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_spaces_virtual_meters (space_id, virtual_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -693,7 +693,7 @@ class StoreMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_METER_RELATION_EXISTED')
|
||||
description='API.STORE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_stores_meters (store_id, meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -871,7 +871,7 @@ class StoreOfflineMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_OFFLINE_METER_RELATION_EXISTED')
|
||||
description='API.STORE_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_stores_offline_meters (store_id, offline_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1049,7 +1049,7 @@ class StorePointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_POINT_RELATION_EXISTED')
|
||||
description='API.STORE_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_stores_points (store_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1214,7 +1214,7 @@ class StoreSensorCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_SENSOR_RELATION_EXISTED')
|
||||
description='API.STORE_SENSOR_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_stores_sensors (store_id, sensor_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1392,7 +1392,7 @@ class StoreVirtualMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.STORE_VIRTUAL_METER_RELATION_EXISTED')
|
||||
description='API.STORE_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_stores_virtual_meters (store_id, virtual_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -460,7 +460,7 @@ class TenantItem:
|
|||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.THERE_IS_RELATION_WITH_SENSOR')
|
||||
description='API.THERE_IS_RELATION_WITH_SENSORS')
|
||||
|
||||
# check relation with virtual meter
|
||||
cursor.execute(" SELECT virtual_meter_id "
|
||||
|
@ -790,7 +790,7 @@ class TenantMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_METER_RELATION_EXISTED')
|
||||
description='API.TENANT_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_tenants_meters (tenant_id, meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -968,7 +968,7 @@ class TenantOfflineMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_OFFLINE_METER_RELATION_EXISTED')
|
||||
description='API.TENANT_OFFLINE_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_tenants_offline_meters (tenant_id, offline_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1146,7 +1146,7 @@ class TenantPointCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_POINT_RELATION_EXISTED')
|
||||
description='API.TENANT_POINT_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_tenants_points (tenant_id, point_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1311,7 +1311,7 @@ class TenantSensorCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_SENSOR_RELATION_EXISTED')
|
||||
description='API.TENANT_SENSOR_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_tenants_sensors (tenant_id, sensor_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
@ -1489,7 +1489,7 @@ class TenantVirtualMeterCollection:
|
|||
cursor.close()
|
||||
cnx.disconnect()
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
||||
description='API.TENANT_VIRTUAL_METER_RELATION_EXISTED')
|
||||
description='API.TENANT_VIRTUAL_METER_RELATION_EXISTS')
|
||||
|
||||
add_row = (" INSERT INTO tbl_tenants_virtual_meters (tenant_id, virtual_meter_id) "
|
||||
" VALUES (%s, %s) ")
|
||||
|
|
|
@ -43,7 +43,7 @@ class TextMessageCollection:
|
|||
if start_datetime_utc >= end_datetime_utc:
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME')
|
||||
description='API.START_DATETIME_MUST_BE_EARLIER_THAN_END_DATETIME')
|
||||
try:
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
|
|
@ -231,7 +231,7 @@ class UserItem:
|
|||
|
||||
if not id_.isdigit() or int(id_) <= 0:
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_')
|
||||
description='API.INVALID_USER_ID')
|
||||
|
||||
new_values = json.loads(raw_json)
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class WebMessageCollection:
|
|||
if start_datetime_utc >= end_datetime_utc:
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME')
|
||||
description='API.START_DATETIME_MUST_BE_EARLIER_THAN_END_DATETIME')
|
||||
# get user dict
|
||||
cnx = mysql.connector.connect(**config.myems_user_db)
|
||||
cursor = cnx.cursor(dictionary=True)
|
||||
|
|
|
@ -40,7 +40,7 @@ class WechatMessageCollection(object):
|
|||
if start_datetime_utc >= end_datetime_utc:
|
||||
raise falcon.HTTPError(falcon.HTTP_400,
|
||||
title='API.BAD_REQUEST',
|
||||
description='API.START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME')
|
||||
description='API.START_DATETIME_MUST_BE_EARLIER_THAN_END_DATETIME')
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_fdd_db)
|
||||
cursor = cnx.cursor()
|
||||
|
|
Loading…
Reference in New Issue