aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-06-14 15:04:17 -0400
committerGitHub <noreply@github.com>2022-06-14 15:04:17 -0400
commitad6fba4c79e8b5ab08e2f0db8bc4087f03151f7f (patch)
tree9888fe24eb3ea35ea0f9b54af8723b4a000e6ad9 /src/handlers
parent7541df778165b5a96da714256d011685b476abc0 (diff)
downloadxesite-ad6fba4c79e8b5ab08e2f0db8bc4087f03151f7f.tar.xz
xesite-ad6fba4c79e8b5ab08e2f0db8bc4087f03151f7f.zip
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 <me@xeiaso.net>
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/mod.rs28
1 files changed, 27 insertions, 1 deletions
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;
@@ -74,6 +78,28 @@ pub async fn feeds() -> Result {
#[axum_macros::debug_handler]
#[instrument(skip(state))]
+pub async fn salary_transparency(Extension(state): Extension<Arc<State>>) -> Result {
+ HIT_COUNTER
+ .with_label_values(&["salary_transparency"])
+ .inc();
+ let state = state.clone();
+ let mut result: Vec<u8> = 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<Arc<State>>) -> Json<Vec<Job>> {
+ 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<Arc<State>>) -> Result {
HIT_COUNTER.with_label_values(&["resume"]).inc();
let state = state.clone();