From ad6fba4c79e8b5ab08e2f0db8bc4087f03151f7f Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Tue, 14 Jun 2022 15:04:17 -0400 Subject: Add salary transparency page (#492) * Move dhall data and types into `/dhall` folder * Reformat salary transparency data into Dhall * Wire up the old salary transparency page with a custom element * Wire up a new salary transparency page * Expose raw data as JSON * Make dhall types more portable * Remove gallery from the navbar * Make signal boost page point to the new data location * Add salary transparency page to the footer of the site * Add site update post for this Signed-off-by: Xe --- src/handlers/mod.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/handlers') diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index fa8203c..fc2a154 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -1,9 +1,13 @@ -use crate::{app::State, templates}; +use crate::{ + app::{Job, State}, + templates, +}; use axum::{ body, extract::Extension, http::StatusCode, response::{Html, IntoResponse, Response}, + Json, }; use chrono::{Datelike, Timelike, Utc, Weekday}; use lazy_static::lazy_static; @@ -72,6 +76,28 @@ pub async fn feeds() -> Result { Ok(Html(result)) } +#[axum_macros::debug_handler] +#[instrument(skip(state))] +pub async fn salary_transparency(Extension(state): Extension>) -> Result { + HIT_COUNTER + .with_label_values(&["salary_transparency"]) + .inc(); + let state = state.clone(); + let mut result: Vec = vec![]; + templates::salary_transparency(&mut result, state.cfg.clone())?; + Ok(Html(result)) +} + +#[axum_macros::debug_handler] +#[instrument(skip(state))] +pub async fn salary_transparency_json(Extension(state): Extension>) -> Json> { + HIT_COUNTER + .with_label_values(&["salary_transparency_json"]) + .inc(); + + Json(state.clone().cfg.clone().job_history.clone()) +} + #[axum_macros::debug_handler] #[instrument(skip(state))] pub async fn resume(Extension(state): Extension>) -> Result { -- cgit v1.2.3