Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to get the timestamp of the last client auto allocation #224

Conversation

Filip-L
Copy link
Collaborator

@Filip-L Filip-L commented Sep 11, 2024

No description provided.

@Filip-L Filip-L closed this Sep 11, 2024
@Filip-L Filip-L deleted the FIL-232-endpoint-for-fetching-timestamp-of-last-allocation-from-autoallocator branch September 11, 2024 12:16
use chrono::{DateTime, FixedOffset};
use sea_orm::{entity::*, query::*, DbErr};

pub async fn get_last_calient_autoallocation(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub async fn get_last_calient_autoallocation(
pub async fn get_last_client_autoallocation(

Typo.

.filter(Column::EvmWalletAddress.contains(client_evm_address.into()))
.one(&conn)
.await?
.ok_or_else(|| DbErr::Custom("Autoallocation not found.".to_string()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing autoallocation isn't an error, it will be a relatively normal occurrence.
Returning Error here should be reserved for real errors (db connection issue, db schema mismatch). If there's no autoallocation found, we should return Option::None.

fplus-database/src/models/autoallocations.rs Show resolved Hide resolved
Comment on lines +6 to +8
#[serde(rename = "EVM Wallet Address")]
pub evm_wallet_address: Address,
#[serde(rename = "Last Allocation")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename like this?

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Autoallocation {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this struct for, I don't see it used.
Also, why this file is named file.rs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants