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:
Geometrically
2022-07-31 13:29:20 -07:00
committed by GitHub
parent 13335cadc6
commit b04bced37f
38 changed files with 3673 additions and 3517 deletions

View File

@@ -21,10 +21,10 @@ use crate::util::auth::get_github_user_from_token;
use actix_web::http::StatusCode;
use actix_web::web::{scope, Data, Query, ServiceConfig};
use actix_web::{get, HttpResponse};
use chrono::Utc;
use serde::{Deserialize, Serialize};
use sqlx::postgres::PgPool;
use thiserror::Error;
use time::OffsetDateTime;
pub fn config(cfg: &mut ServiceConfig) {
cfg.service(scope("auth").service(auth_callback).service(init));
@@ -176,9 +176,9 @@ pub async fn auth_callback(
.await?;
if let Some(result) = result_option {
let duration = result.expires - OffsetDateTime::now_utc();
let duration: chrono::Duration = result.expires - Utc::now();
if duration.whole_seconds() < 0 {
if duration.num_seconds() < 0 {
return Err(AuthorizationError::InvalidCredentials);
}
@@ -255,7 +255,7 @@ pub async fn auth_callback(
email: user.email,
avatar_url: Some(user.avatar_url),
bio: user.bio,
created: OffsetDateTime::now_utc(),
created: Utc::now(),
role: Role::Developer.to_string(),
}
.insert(&mut transaction)