forked from alemi/upub
fix!: instance counters as i64
This commit is contained in:
parent
e0273d5155
commit
935dceacfc
2 changed files with 14 additions and 4 deletions
|
@ -108,8 +108,8 @@ impl MigrationTrait for Migration {
|
||||||
.col(ColumnDef::new(Instances::Version).string().null())
|
.col(ColumnDef::new(Instances::Version).string().null())
|
||||||
.col(ColumnDef::new(Instances::Icon).string().null())
|
.col(ColumnDef::new(Instances::Icon).string().null())
|
||||||
.col(ColumnDef::new(Instances::DownSince).date_time().null())
|
.col(ColumnDef::new(Instances::DownSince).date_time().null())
|
||||||
.col(ColumnDef::new(Instances::Users).integer().null())
|
.col(ColumnDef::new(Instances::Users).big_integer().null())
|
||||||
.col(ColumnDef::new(Instances::Posts).integer().null())
|
.col(ColumnDef::new(Instances::Posts).big_integer().null())
|
||||||
.col(ColumnDef::new(Instances::Published).date_time().not_null().default(Expr::current_timestamp()))
|
.col(ColumnDef::new(Instances::Published).date_time().not_null().default(Expr::current_timestamp()))
|
||||||
.col(ColumnDef::new(Instances::Updated).date_time().not_null().default(Expr::current_timestamp()))
|
.col(ColumnDef::new(Instances::Updated).date_time().not_null().default(Expr::current_timestamp()))
|
||||||
.to_owned()
|
.to_owned()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use nodeinfo::NodeInfoOwned;
|
||||||
use sea_orm::{entity::prelude::*, QuerySelect, SelectColumns};
|
use sea_orm::{entity::prelude::*, QuerySelect, SelectColumns};
|
||||||
|
|
||||||
use crate::errors::UpubError;
|
use crate::errors::UpubError;
|
||||||
|
@ -14,8 +15,8 @@ pub struct Model {
|
||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
pub down_since: Option<ChronoDateTimeUtc>,
|
pub down_since: Option<ChronoDateTimeUtc>,
|
||||||
pub users: Option<i32>,
|
pub users: Option<i64>,
|
||||||
pub posts: Option<i32>,
|
pub posts: Option<i64>,
|
||||||
pub published: ChronoDateTimeUtc,
|
pub published: ChronoDateTimeUtc,
|
||||||
pub updated: ChronoDateTimeUtc,
|
pub updated: ChronoDateTimeUtc,
|
||||||
}
|
}
|
||||||
|
@ -57,4 +58,13 @@ impl Entity {
|
||||||
.await?
|
.await?
|
||||||
.ok_or_else(UpubError::not_found)
|
.ok_or_else(UpubError::not_found)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn nodeinfo(domain: &str) -> crate::Result<NodeInfoOwned> {
|
||||||
|
Ok(
|
||||||
|
reqwest::get(format!("https://{domain}/nodeinfo/2.0.json"))
|
||||||
|
.await?
|
||||||
|
.json()
|
||||||
|
.await?
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue