MCPcopy Create free account
hub / github.com/dfinity/orbit / try_from

Method try_from

core/station/impl/src/mappers/notification.rs:18–30  ·  view source on GitHub ↗
(notification: Notification)

Source from the content-addressed store, hash-verified

16impl TryFrom<Notification> for NotificationDTO {
17 type Error = NotificationMapperError;
18 fn try_from(notification: Notification) -> Result<NotificationDTO, NotificationMapperError> {
19 Ok(NotificationDTO {
20 id: Uuid::from_bytes(notification.id).hyphenated().to_string(),
21 target_user_id: Uuid::from_bytes(notification.target_user_id)
22 .hyphenated()
23 .to_string(),
24 status: notification.status.into(),
25 title: notification.title,
26 message: notification.message,
27 notification_type: notification.notification_type.try_into()?,
28 created_at: timestamp_to_rfc3339(&notification.created_timestamp),
29 })
30 }
31}

Callers

nothing calls this directly

Calls 1

timestamp_to_rfc3339Function · 0.85

Tested by

no test coverage detected