complete chapter 7
Some checks failed
CI / gravity (push) Has been skipped
CI / build (push) Failing after 14s
CI / is_fresh (push) Successful in 49s
CI / formatter (push) Failing after 17s

This commit is contained in:
2025-05-02 14:11:16 +05:30
parent 4fbee2d894
commit b044878fe8
11 changed files with 90 additions and 31 deletions

View File

@@ -35,7 +35,15 @@ impl TicketStoreClient {
Ok(response_receiver.recv().unwrap())
}
pub fn update(&self, ticket_patch: TicketPatch) -> Result<(), OverloadedError> {}
pub fn update(&self, ticket_patch: TicketPatch) -> Result<(), OverloadedError> {
let (sender, receiver) = sync_channel(1);
self.sender
.try_send(Command::Update {
patch: ticket_patch,
response_channel: sender,
})
.map_err(|_| OverloadedError)
}
}
#[derive(Debug, thiserror::Error)]
@@ -85,7 +93,23 @@ pub fn server(receiver: Receiver<Command>) {
patch,
response_channel,
}) => {
todo!()
let ticket = store.get_mut(patch.id).unwrap();
match patch.title {
Some(a) => {
ticket.title = a;
}
None => {}
}
match patch.status {
Some(a) => ticket.status = a,
None => {}
}
match patch.description {
Some(a) => ticket.description = a,
None => {}
}
}
Err(_) => {
// There are no more senders, so we can safely break