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

@@ -2,13 +2,13 @@ use crate::models::error::ApiError;
use crate::models::projects::SearchRequest;
use actix_web::http::StatusCode;
use actix_web::HttpResponse;
use chrono::{DateTime, Utc};
use meilisearch_sdk::client::Client;
use meilisearch_sdk::document::Document;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::cmp::min;
use thiserror::Error;
use time::OffsetDateTime;
pub mod indexing;
@@ -74,6 +74,7 @@ pub struct UploadSearchProject {
pub title: String,
pub description: String,
pub categories: Vec<String>,
pub display_categories: Vec<String>,
pub versions: Vec<String>,
pub follows: i32,
pub downloads: i32,
@@ -83,16 +84,12 @@ pub struct UploadSearchProject {
pub client_side: String,
pub server_side: String,
pub gallery: Vec<String>,
#[serde(with = "crate::util::time_ser")]
/// RFC 3339 formatted creation date of the project
pub date_created: OffsetDateTime,
pub date_created: DateTime<Utc>,
/// Unix timestamp of the creation date of the project
pub created_timestamp: i64,
#[serde(with = "crate::util::time_ser")]
/// RFC 3339 formatted date/time of last major modification (update)
pub date_modified: OffsetDateTime,
pub date_modified: DateTime<Utc>,
/// Unix timestamp of the last major modification
pub modified_timestamp: i64,
}
@@ -114,6 +111,7 @@ pub struct ResultSearchProject {
pub title: String,
pub description: String,
pub categories: Vec<String>,
pub display_categories: Vec<String>,
// TODO: more efficient format for listing versions, without many repetitions
pub versions: Vec<String>,
pub downloads: i32,