From 548dd0d022da69667111d3c89be2fe1c3348ada0 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Thu, 23 Sep 2021 15:30:39 +0200 Subject: [PATCH] Tried to add MirageJS but failed --- src/db/posts.rs | 4 - src/db/sections.rs | 2 +- web/package.json | 4 +- web/src/components/MirageTest.svelte | 19 + web/src/components/SvelteCounter.svelte | 2 +- web/src/layouts/index.astro | 4 + web/src/pages/index.astro | 23 + web/yarn.lock | 996 +++++++++++++++--------- 8 files changed, 681 insertions(+), 373 deletions(-) create mode 100644 web/src/components/MirageTest.svelte diff --git a/src/db/posts.rs b/src/db/posts.rs index 2486c08..163902e 100644 --- a/src/db/posts.rs +++ b/src/db/posts.rs @@ -1,5 +1,3 @@ -//! Handles all posts-related database operations. - use chrono::NaiveDate; use diesel::{insert_into, prelude::*, Insertable, PgConnection, Queryable}; use uuid::Uuid; @@ -9,7 +7,6 @@ use crate::{ schema::{posts, posts::dsl::*}, }; -/// Represents a post contained within the database. #[derive(Queryable)] pub struct Post { @@ -20,7 +17,6 @@ pub struct Post pub content: String, } -/// Represents a new post to be added to the database. #[derive(Insertable)] #[table_name = "posts"] pub struct NewPost diff --git a/src/db/sections.rs b/src/db/sections.rs index ca8956b..b429c85 100644 --- a/src/db/sections.rs +++ b/src/db/sections.rs @@ -23,7 +23,7 @@ pub struct Section /// A new section to be added into the database. #[derive(Deserialize, Insertable)] #[table_name = "sections"] -// #[serde(rename_all = "camelCase")] +#[serde(rename_all = "camelCase")] pub struct NewSection { title: String, diff --git a/web/package.json b/web/package.json index 6dfbfa6..b1070aa 100644 --- a/web/package.json +++ b/web/package.json @@ -7,7 +7,9 @@ "build": "astro build" }, "devDependencies": { + "@astrojs/renderer-svelte": "^0.1.1", "astro": "0.19.0-next.2", - "@astrojs/renderer-svelte": "^0.1.1" + "miragejs": "^0.1.41", + "typescript": "^4.4.3" } } diff --git a/web/src/components/MirageTest.svelte b/web/src/components/MirageTest.svelte new file mode 100644 index 0000000..ac3676b --- /dev/null +++ b/web/src/components/MirageTest.svelte @@ -0,0 +1,19 @@ + + + diff --git a/web/src/components/SvelteCounter.svelte b/web/src/components/SvelteCounter.svelte index f493c25..ea6cf52 100644 --- a/web/src/components/SvelteCounter.svelte +++ b/web/src/components/SvelteCounter.svelte @@ -1,4 +1,4 @@ -