0.7.27 +Refactor
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
/// Application-facing normalized token burn event DTO.
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct KbTokenBurnEventDto {
|
||||
pub struct TokenBurnEventDto {
|
||||
/// Optional numeric primary key.
|
||||
pub id: std::option::Option<i64>,
|
||||
/// Related token id.
|
||||
@@ -27,7 +27,7 @@ pub struct KbTokenBurnEventDto {
|
||||
pub executed_at: chrono::DateTime<chrono::Utc>,
|
||||
}
|
||||
|
||||
impl KbTokenBurnEventDto {
|
||||
impl TokenBurnEventDto {
|
||||
/// Creates a new token burn event DTO.
|
||||
pub fn new(
|
||||
token_id: i64,
|
||||
@@ -54,15 +54,15 @@ impl KbTokenBurnEventDto {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<crate::KbTokenBurnEventEntity> for KbTokenBurnEventDto {
|
||||
type Error = crate::KbError;
|
||||
impl TryFrom<crate::TokenBurnEventEntity> for TokenBurnEventDto {
|
||||
type Error = crate::Error;
|
||||
|
||||
fn try_from(entity: crate::KbTokenBurnEventEntity) -> Result<Self, Self::Error> {
|
||||
fn try_from(entity: crate::TokenBurnEventEntity) -> Result<Self, Self::Error> {
|
||||
let executed_at_result = chrono::DateTime::parse_from_rfc3339(&entity.executed_at);
|
||||
let executed_at = match executed_at_result {
|
||||
Ok(executed_at) => executed_at.with_timezone(&chrono::Utc),
|
||||
Err(error) => {
|
||||
return Err(crate::KbError::Db(format!(
|
||||
return Err(crate::Error::Db(format!(
|
||||
"cannot parse token burn event executed_at '{}': {}",
|
||||
entity.executed_at, error
|
||||
)));
|
||||
@@ -74,7 +74,7 @@ impl TryFrom<crate::KbTokenBurnEventEntity> for KbTokenBurnEventDto {
|
||||
match slot_result {
|
||||
Ok(slot) => Some(slot),
|
||||
Err(error) => {
|
||||
return Err(crate::KbError::Db(format!(
|
||||
return Err(crate::Error::Db(format!(
|
||||
"cannot convert token burn event slot '{}' to u64: {}",
|
||||
slot, error
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user