diff options
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/api.rs | 10 | ||||
| -rw-r--r-- | src/handlers/json_ld.rs | 14 | ||||
| -rw-r--r-- | src/handlers/mod.rs | 1 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/handlers/api.rs b/src/handlers/api.rs index 828f93c..af94f68 100644 --- a/src/handlers/api.rs +++ b/src/handlers/api.rs @@ -1,12 +1,12 @@ use crate::{ - app::{config::Job, PronounSet, State}, + app::{config::Author, PronounSet, State}, handlers::Result, post::Post, }; use axum::extract::{Extension, Json, Path}; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; -use std::sync::Arc; +use std::{collections::HashMap, sync::Arc}; lazy_static! { static ref BLOG: IntCounterVec = register_int_counter_vec!( @@ -23,14 +23,14 @@ lazy_static! { #[axum_macros::debug_handler] #[instrument(skip(state))] -pub async fn salary_transparency(Extension(state): Extension<Arc<State>>) -> Json<Vec<Job>> { +pub async fn authors(Extension(state): Extension<Arc<State>>) -> Json<HashMap<String, Author>> { super::HIT_COUNTER - .with_label_values(&["salary_transparency_json"]) + .with_label_values(&["authors_json"]) .inc(); let state = state.clone(); let cfg = state.cfg.clone(); - Json(cfg.job_history.clone()) + Json(cfg.authors.clone()) } #[axum_macros::debug_handler] diff --git a/src/handlers/json_ld.rs b/src/handlers/json_ld.rs new file mode 100644 index 0000000..07148dc --- /dev/null +++ b/src/handlers/json_ld.rs @@ -0,0 +1,14 @@ +use axum::extract::Json; +use serde_json::{json, Value}; + +pub async fn pronoun_set() -> Json<Value> { + Json(json!({ + "@type": "PronounSet", + "nominative": "string", + "accusative": "string", + "possessiveDeterminer": "string", + "possessive": "string", + "reflexive": "string", + "singular": "boolean", + })) +} diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 7284ec9..48a1b60 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -16,6 +16,7 @@ pub mod api; pub mod blog; pub mod feeds; pub mod gallery; +pub mod json_ld; pub mod talks; fn weekday_to_name(w: Weekday) -> &'static str { |
