Skip to content

Commit

Permalink
Add road_affix resource
Browse files Browse the repository at this point in the history
  • Loading branch information
DougLau committed Nov 6, 2024
1 parent 1750183 commit 4a07928
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ update, and is caused by one of these conditions:
`ramp_meter` | ✔️ | ✔️ | ✔️ |
`r_node` | ✔️ | | |
`road` | | | |
`road_affix` | | | |
`role` | | | | ✔️
`sign_config` | | | |
`sign_detail` | | | |
Expand Down
1 change: 1 addition & 0 deletions honeybee/src/honey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ const fn one_sql(res: Res) -> &'static str {
MsgLine => query::MSG_LINE_ONE,
MsgPattern => query::MSG_PATTERN_ONE,
Permission => query::PERMISSION_ONE,
RoadAffix => query::ROAD_AFFIX_ONE,
RampMeter => query::RAMP_METER_ONE,
Role => query::ROLE_ONE,
SignConfig => query::SIGN_CONFIG_ONE,
Expand Down
12 changes: 12 additions & 0 deletions honeybee/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,18 @@ pub const ROAD_ONE: &str = "\
JOIN iris.road_class ON r_class = id \
WHERE name = $1";

/// SQL query for all road affixes (primary)
pub const ROAD_AFFIX_ALL: &str = "\
SELECT name, prefix, fixup, allow_retain \
FROM iris.road_affix \
ORDER BY name";

/// SQL query for one road affix
pub const ROAD_AFFIX_ONE: &str = "\
SELECT name, prefix, fixup, allow_retain \
FROM iris.road_affix \
WHERE name = $1";

/// SQL query for road classes (LUT)
pub const ROAD_CLASS_LUT: &str = "\
SELECT id, description, grade, scale \
Expand Down
5 changes: 5 additions & 0 deletions honeybee/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub enum Resource {
RnodeType,
Road,
RoadFull,
RoadAffix,
RoadClass,
RoadModifier,
Role,
Expand Down Expand Up @@ -165,6 +166,7 @@ impl Resource {
RnodeType,
Road,
RoadFull,
RoadAffix,
RoadClass,
RoadModifier,
Role,
Expand Down Expand Up @@ -241,6 +243,7 @@ impl Resource {
RnodeTransition => Res::RnodeTransition,
RnodeType => Res::RnodeType,
Road | RoadFull => Res::Road,
RoadAffix => Res::RoadAffix,
RoadClass => Res::RoadClass,
RoadModifier => Res::RoadModifier,
Role => Res::Role,
Expand Down Expand Up @@ -318,6 +321,7 @@ impl Resource {
RnodeType => "lut/r_node_type",
Road => "api/road",
RoadFull => unreachable!(),
RoadAffix => "api/road_affix",
RoadClass => "lut/road_class",
RoadModifier => "lut/road_modifier",
Role => "api/role",
Expand Down Expand Up @@ -407,6 +411,7 @@ impl Resource {
RnodeType => query::RNODE_TYPE_LUT,
Road => query::ROAD_ALL,
RoadFull => query::ROAD_FULL,
RoadAffix => query::ROAD_AFFIX_ALL,
RoadClass => query::ROAD_CLASS_LUT,
RoadModifier => query::ROAD_MODIFIER_LUT,
Role => query::ROLE_ALL,
Expand Down
14 changes: 10 additions & 4 deletions resources/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub enum Res {
RnodeTransition,
RnodeType,
Road,
RoadAffix,
RoadClass,
RoadModifier,
Role,
Expand Down Expand Up @@ -161,6 +162,7 @@ impl Res {
RnodeTransition,
RnodeType,
Road,
RoadAffix,
RoadClass,
RoadModifier,
Role,
Expand Down Expand Up @@ -238,6 +240,7 @@ impl Res {
RnodeTransition => "r_node_transition",
RnodeType => "r_node_type",
Road => "road",
RoadAffix => "road_affix",
RoadClass => "road_class",
RoadModifier => "road_modifier",
Role => "role",
Expand Down Expand Up @@ -288,6 +291,7 @@ impl Res {
LcsIndication => "🡇 ",
Modem => "🖀 ",
Permission => "🗝️ ",
RoadAffix => "🛣️ ",
RampMeter => "🚦",
Role => "💪",
SignConfig => "📐",
Expand Down Expand Up @@ -325,9 +329,10 @@ impl Res {
| GateArm | GateArmArray | Gps | Incident | IncidentDetail
| IncAdvice | IncDescriptor | IncLocator | LaneMarking
| LcsArray | LcsIndication | Modem | MsgLine | MsgPattern
| ParkingArea | Permission | RampMeter | Rnode | Road | Role
| SignConfig | SignDetail | SignMessage | SystemAttribute
| TagReader | User | VideoMonitor | WeatherSensor | Word => true,
| ParkingArea | Permission | RampMeter | Rnode | Road
| RoadAffix | Role | SignConfig | SignDetail | SignMessage
| SystemAttribute | TagReader | User | VideoMonitor
| WeatherSensor | Word => true,
_ => false,
}
}
Expand All @@ -350,7 +355,8 @@ impl Res {
// Gate arm resources
GateArmArray => GateArm,
// Incident resources
IncidentDetail | IncAdvice | IncDescriptor | IncLocator => Incident,
IncidentDetail | IncAdvice | IncDescriptor | IncLocator
| RoadAffix => Incident,
// LCS resources
LcsArray | LcsIndication | LaneMarking => Lcs,
// Permission resources
Expand Down
4 changes: 4 additions & 0 deletions sql/migrate-5.62.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ CREATE TRIGGER camera_preset_notify_trig
AFTER INSERT OR UPDATE OR DELETE ON iris.camera_preset
FOR EACH STATEMENT EXECUTE FUNCTION iris.table_notify();

CREATE TRIGGER road_affix_notify_trig
AFTER INSERT OR UPDATE OR DELETE ON iris.road_affix
FOR EACH STATEMENT EXECUTE FUNCTION iris.table_notify();

-- Rename iris_user to user_id in client_event
DROP VIEW client_event_view;

Expand Down
4 changes: 4 additions & 0 deletions sql/tms-template.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,10 @@ TR f f
WAY f f
\.

CREATE TRIGGER road_affix_notify_trig
AFTER INSERT OR UPDATE OR DELETE ON iris.road_affix
FOR EACH STATEMENT EXECUTE FUNCTION iris.table_notify();

--
-- Domains, Roles, Users, and Permissions
--
Expand Down

0 comments on commit 4a07928

Please sign in to comment.