chore (backend-rs): in the current implementation we need to call to_string() anyway

There's room for refactoring
This commit is contained in:
naskya 2024-04-22 00:30:59 +09:00
parent 137d0fe3e5
commit 574d3b3fe5
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -4,7 +4,7 @@ use crate::util::id::get_timestamp;
use redis::{streams::StreamMaxlen, Commands};
#[crate::export]
pub fn add_note_to_antenna(antenna_id: &str, note_id: &str) -> Result<(), Error> {
pub fn add_note_to_antenna(antenna_id: String, note_id: &str) -> Result<(), Error> {
redis_conn()?.xadd_maxlen(
redis_key(format!("antennaTimeline:{}", antenna_id)),
StreamMaxlen::Approx(200),
@ -12,11 +12,8 @@ pub fn add_note_to_antenna(antenna_id: &str, note_id: &str) -> Result<(), Error>
&[("note", note_id)],
)?;
let stream = Stream::Antenna {
antenna_id: antenna_id.to_string(),
};
publish_to_stream(
&stream,
&Stream::Antenna { antenna_id },
Some("note"),
Some(format!("{{ \"id\": \"{}\" }}", note_id)),
)