feat: add ci

This commit is contained in:
2023-03-07 23:20:06 +01:00
parent f56f8c6818
commit 2053220d01
10 changed files with 1092 additions and 71 deletions

View File

@@ -1,3 +1,5 @@
use std::path::PathBuf;
use cfg_if::cfg_if;
use leptos::*;
use serde::{Deserialize, Serialize};
@@ -10,11 +12,9 @@ cfg_if! {
use lazy_static::lazy_static;
lazy_static! {
static ref EVENTSTORE: EventStore = EventStore::default();
static ref EVENTSTORE: EventStore = EventStore::new(PathBuf::from("articles"));
}
async fn get_upcoming_events_fn() -> Result<UpcomingEventsOverview, ServerFnError> {
let current_time = chrono::Utc::now();
let mut events: Vec<EventOverview> = EVENTSTORE
.get_upcoming_events()
.await
@@ -24,7 +24,7 @@ cfg_if! {
.map(|data| data.clone().into())
.collect();
events.sort_by(|a, b| a.time.cmp(&b.time));
events.sort_by(|a, b| a.time.cmp(&b.time)) ;
Ok(UpcomingEventsOverview { events })
}
@@ -33,9 +33,12 @@ cfg_if! {
.get_event(event_id)
.await
.map_err(|e| ServerFnError::ServerError(e.to_string()))?;
Ok(event)
}
pub async fn boostrap() -> Result<(), ServerFnError> {
EVENTSTORE.bootstrap().await.map_err(|e| ServerFnError::ServerError(e.to_string()))
}
}
}

View File

@@ -1,16 +1,24 @@
#[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::{
extract::{Extension, Path},
routing::{get, post},
Router,
};
use axum::{extract::Extension, routing::post, Router};
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use ssr_modes_axum::app::*;
use ssr_modes_axum::fallback::file_and_error_handler;
use std::sync::Arc;
use tracing::metadata::LevelFilter;
std::env::set_var(
"BITE_ARTICLE_REPO_URL",
"git@git.front.kjuulh.io:kjuulh/articles.git",
);
tracing_subscriber::fmt()
.with_max_level(LevelFilter::TRACE)
.init();
ssr_modes_axum::api::events::boostrap().await.unwrap();
let conf = get_configuration(None).await.unwrap();
let addr = conf.leptos_options.site_addr;