You've already forked AstralRinth
forked from didirus/AstralRinth
More project data (#406)
* More project data * Array_agg fixes + cleanup * fix prepare * Add approval dates to search * Update migrations/20220725204351_more-project-data.sql Co-authored-by: wafflecoffee <emmaffle@modrinth.com> * Add category labels + display categories Co-authored-by: wafflecoffee <emmaffle@modrinth.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#![allow(dead_code)]
|
||||
// TODO: remove attr once routes are created
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use thiserror::Error;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub mod categories;
|
||||
pub mod ids;
|
||||
@@ -123,14 +123,12 @@ impl ids::ProjectTypeId {
|
||||
.fetch_optional(exec)
|
||||
.await?;
|
||||
|
||||
Ok(result.map(|r| ids::ProjectTypeId(r.id)))
|
||||
Ok(result.map(|r| ProjectTypeId(r.id)))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn convert_postgres_date(input: &str) -> OffsetDateTime {
|
||||
OffsetDateTime::parse(
|
||||
format!("{}:00Z", input.replace(' ', "T")),
|
||||
time::Format::Rfc3339,
|
||||
)
|
||||
.unwrap_or_else(|_| OffsetDateTime::now_utc())
|
||||
pub fn convert_postgres_date(input: &str) -> DateTime<Utc> {
|
||||
DateTime::parse_from_rfc3339(&*format!("{}:00Z", input.replace(' ', "T")))
|
||||
.map(|x| x.with_timezone(&Utc))
|
||||
.unwrap_or_else(|_| Utc::now())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user