remove old svelte web source
This commit is contained in:
16
src/projects/featured_projects.rs
Normal file
16
src/projects/featured_projects.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::post_utils::{post_listing::get_post_list, post_parser::ParseResult};
|
||||
|
||||
use super::project_model::ProjectMetadata;
|
||||
|
||||
pub async fn get_featured_projects() -> Result<Vec<ParseResult<ProjectMetadata>>, StatusCode> {
|
||||
let project_list = get_post_list::<ProjectMetadata>("../_projects").await?;
|
||||
|
||||
let featured_projects = project_list
|
||||
.into_iter()
|
||||
.filter(|post| post.metadata.featured)
|
||||
.collect();
|
||||
|
||||
Ok(featured_projects)
|
||||
}
|
2
src/projects/mod.rs
Normal file
2
src/projects/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod featured_projects;
|
||||
pub mod project_model;
|
23
src/projects/project_model.rs
Normal file
23
src/projects/project_model.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct ProjectMetadata {
|
||||
pub title: String,
|
||||
pub classification: String,
|
||||
pub displayed: bool,
|
||||
pub cover_image: Option<String>,
|
||||
pub tags: Vec<String>,
|
||||
pub featured: bool,
|
||||
pub link: Option<String>,
|
||||
}
|
||||
|
||||
pub fn translate_classification(classification: &str) -> &str {
|
||||
match classification {
|
||||
"webapp" => "Web application",
|
||||
"website" => "Web site",
|
||||
"presentation" => "Presentation",
|
||||
"videogame" => "Video game",
|
||||
"embedded" => "Embedded system",
|
||||
any => any,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user