MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / join_event

Method join_event

chirpstack/src/integration/postgresql/mod.rs:303–334  ·  view source on GitHub ↗
(
        &self,
        _vars: &HashMap<String, String>,
        pl: &integration::JoinEvent,
    )

Source from the content-addressed store, hash-verified

301 }
302
303 async fn join_event(
304 &self,
305 _vars: &HashMap<String, String>,
306 pl: &integration::JoinEvent,
307 ) -> Result<()> {
308 let di = pl.device_info.as_ref().unwrap();
309 info!(dev_eui = %di.dev_eui, event = "join", "Inserting event");
310
311 let e = EventJoin {
312 deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
313 time: (*pl.time.as_ref().unwrap())
314 .try_into()
315 .map_err(anyhow::Error::msg)?,
316 tenant_id: Uuid::from_str(&di.tenant_id)?,
317 tenant_name: di.tenant_name.clone(),
318 application_id: Uuid::from_str(&di.application_id)?,
319 application_name: di.application_name.clone(),
320 device_profile_id: Uuid::from_str(&di.device_profile_id)?,
321 device_profile_name: di.device_profile_name.clone(),
322 device_name: di.device_name.clone(),
323 dev_eui: di.dev_eui.clone(),
324 tags: serde_json::to_value(&di.tags)?,
325 dev_addr: pl.dev_addr.clone(),
326 };
327 let mut c = self.pg_pool.get().await?;
328
329 diesel::insert_into(event_join::table)
330 .values(&e)
331 .execute(&mut c)
332 .await?;
333 Ok(())
334 }
335
336 async fn ack_event(
337 &self,

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.80
as_refMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected