add latest price route

This commit is contained in:
JMARyA 2024-09-16 08:10:26 +02:00
parent 0d4ed15460
commit 9c03d38f6e
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 31 additions and 4 deletions

View file

@ -225,14 +225,14 @@ impl Variant {
)
}
pub async fn price_history_by_origin(&self, origin: &str) -> Vec<Price> {
pub async fn price_history_by_origin(&self, origin: &str, limit: Option<i64>) -> Vec<Price> {
Transaction::find(
doc! {
"item": &self.item,
"variant": &self.variant,
"origin": origin
},
None,
limit,
Some(sort_by_timestamp()),
)
.await