Refactor: Dismantle MemoryState into semantic domain sub-structs
This commit is contained in:
1 parent
0e866f2465
commit
a34554b7ff
13 files changed
+186
-158
No files matched your search
@@ -38,7 +38,7 @@ pub async fn gate_verify_handler(
|
||||
) -> Result<impl IntoResponse, AppError> {
|
||||
let mut found = None;
|
||||
let mut to_remove = None;
|
||||
app_state.handler.state.gates.modify(|gates| {
|
||||
app_state.handler.state.env.gates.modify(|gates| {
|
||||
if let Some(idx) = gates.iter().position(|g| {
|
||||
g.action == q.action
|
||||
&& g.target == q.target
|
||||
@@ -96,7 +96,7 @@ pub async fn gate_set_handler(
|
||||
reason: body.reason.clone(),
|
||||
timestamp: crate::handlers::utils::now_secs(),
|
||||
};
|
||||
app_state.handler.state.gates.modify(|gates| {
|
||||
app_state.handler.state.env.gates.modify(|gates| {
|
||||
gates.retain(|g| !(g.action == record.action && g.target == record.target));
|
||||
gates.push(record);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user