{#if fullPreview}
-
+ {#if !iframeLoaded}
+
Loading preview...
+ {/if}
+
{:else}
{@html md(
previewContent.value || "Write some markdown content to see a live preview here",
diff --git a/web-app/src/lib/db-schema.ts b/web-app/src/lib/db-schema.ts
index 08845aa..798c35b 100644
--- a/web-app/src/lib/db-schema.ts
+++ b/web-app/src/lib/db-schema.ts
@@ -5,7 +5,7 @@
* AUTO-GENERATED FILE - DO NOT EDIT!
*
* This file was automatically generated by pg-to-ts v.4.1.1
- * $ pg-to-ts generate -c postgres://username:password@localhost:15432/archtika -t article -t change_log -t collab -t docs_category -t domain_prefix -t footer -t header -t home -t legal_information -t media -t settings -t user -t website -s internal
+ * $ pg-to-ts generate -c postgres://username:password@localhost:15432/archtika -t article -t change_log -t collab -t docs_category -t footer -t header -t home -t media -t settings -t user -t website -s internal
*
*/
@@ -17,15 +17,16 @@ export interface Article {
website_id: string;
user_id: string | null;
title: string;
+ slug: string | null;
meta_description: string | null;
meta_author: string | null;
cover_image: string | null;
- publication_date: Date | null;
+ publication_date: string | null;
main_content: string | null;
category: string | null;
article_weight: number | null;
- created_at: Date;
- last_modified_at: Date;
+ created_at: string;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface ArticleInput {
@@ -33,15 +34,16 @@ export interface ArticleInput {
website_id: string;
user_id?: string | null;
title: string;
+ slug?: string | null;
meta_description?: string | null;
meta_author?: string | null;
cover_image?: string | null;
- publication_date?: Date | null;
+ publication_date?: string | null;
main_content?: string | null;
category?: string | null;
article_weight?: number | null;
- created_at?: Date;
- last_modified_at?: Date;
+ created_at?: string;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const article = {
@@ -51,6 +53,7 @@ const article = {
"website_id",
"user_id",
"title",
+ "slug",
"meta_description",
"meta_author",
"cover_image",
@@ -81,7 +84,7 @@ export interface ChangeLog {
website_id: string | null;
user_id: string | null;
username: string;
- tstamp: Date;
+ tstamp: string;
table_name: string;
operation: string;
old_value: any | null;
@@ -92,7 +95,7 @@ export interface ChangeLogInput {
website_id?: string | null;
user_id?: string | null;
username?: string;
- tstamp?: Date;
+ tstamp?: string;
table_name: string;
operation: string;
old_value?: any | null;
@@ -126,16 +129,16 @@ export interface Collab {
website_id: string;
user_id: string;
permission_level: number;
- added_at: Date;
- last_modified_at: Date;
+ added_at: string;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface CollabInput {
website_id: string;
user_id: string;
permission_level?: number;
- added_at?: Date;
- last_modified_at?: Date;
+ added_at?: string;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const collab = {
@@ -166,8 +169,8 @@ export interface DocsCategory {
user_id: string | null;
category_name: string;
category_weight: number;
- created_at: Date;
- last_modified_at: Date;
+ created_at: string;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface DocsCategoryInput {
@@ -176,8 +179,8 @@ export interface DocsCategoryInput {
user_id?: string | null;
category_name: string;
category_weight: number;
- created_at?: Date;
- last_modified_at?: Date;
+ created_at?: string;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const docs_category = {
@@ -203,45 +206,17 @@ const docs_category = {
$input: null as unknown as DocsCategoryInput
} as const;
-// Table domain_prefix
-export interface DomainPrefix {
- website_id: string;
- prefix: string;
- created_at: Date;
- last_modified_at: Date;
- last_modified_by: string | null;
-}
-export interface DomainPrefixInput {
- website_id: string;
- prefix: string;
- created_at?: Date;
- last_modified_at?: Date;
- last_modified_by?: string | null;
-}
-const domain_prefix = {
- tableName: "domain_prefix",
- columns: ["website_id", "prefix", "created_at", "last_modified_at", "last_modified_by"],
- requiredForInsert: ["website_id", "prefix"],
- primaryKey: "website_id",
- foreignKeys: {
- website_id: { table: "website", column: "id", $type: null as unknown as Website },
- last_modified_by: { table: "user", column: "id", $type: null as unknown as User }
- },
- $type: null as unknown as DomainPrefix,
- $input: null as unknown as DomainPrefixInput
-} as const;
-
// Table footer
export interface Footer {
website_id: string;
additional_text: string;
- last_modified_at: Date;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface FooterInput {
website_id: string;
additional_text: string;
- last_modified_at?: Date;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const footer = {
@@ -263,7 +238,7 @@ export interface Header {
logo_type: string;
logo_text: string | null;
logo_image: string | null;
- last_modified_at: Date;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface HeaderInput {
@@ -271,7 +246,7 @@ export interface HeaderInput {
logo_type?: string;
logo_text?: string | null;
logo_image?: string | null;
- last_modified_at?: Date;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const header = {
@@ -300,14 +275,14 @@ export interface Home {
website_id: string;
main_content: string;
meta_description: string | null;
- last_modified_at: Date;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface HomeInput {
website_id: string;
main_content: string;
meta_description?: string | null;
- last_modified_at?: Date;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const home = {
@@ -329,34 +304,6 @@ const home = {
$input: null as unknown as HomeInput
} as const;
-// Table legal_information
-export interface LegalInformation {
- website_id: string;
- main_content: string;
- created_at: Date;
- last_modified_at: Date;
- last_modified_by: string | null;
-}
-export interface LegalInformationInput {
- website_id: string;
- main_content: string;
- created_at?: Date;
- last_modified_at?: Date;
- last_modified_by?: string | null;
-}
-const legal_information = {
- tableName: "legal_information",
- columns: ["website_id", "main_content", "created_at", "last_modified_at", "last_modified_by"],
- requiredForInsert: ["website_id", "main_content"],
- primaryKey: "website_id",
- foreignKeys: {
- website_id: { table: "website", column: "id", $type: null as unknown as Website },
- last_modified_by: { table: "user", column: "id", $type: null as unknown as User }
- },
- $type: null as unknown as LegalInformation,
- $input: null as unknown as LegalInformationInput
-} as const;
-
// Table media
export interface Media {
id: string;
@@ -365,7 +312,7 @@ export interface Media {
blob: string;
mimetype: string;
original_name: string;
- created_at: Date;
+ created_at: string;
}
export interface MediaInput {
id?: string;
@@ -374,7 +321,7 @@ export interface MediaInput {
blob: string;
mimetype: string;
original_name: string;
- created_at?: Date;
+ created_at?: string;
}
const media = {
tableName: "media",
@@ -397,7 +344,7 @@ export interface Settings {
background_color_dark_theme: string;
background_color_light_theme: string;
favicon_image: string | null;
- last_modified_at: Date;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface SettingsInput {
@@ -407,7 +354,7 @@ export interface SettingsInput {
background_color_dark_theme?: string;
background_color_light_theme?: string;
favicon_image?: string | null;
- last_modified_at?: Date;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const settings = {
@@ -440,7 +387,7 @@ export interface User {
password_hash: string;
user_role: string;
max_number_websites: number;
- created_at: Date;
+ created_at: string;
}
export interface UserInput {
id?: string;
@@ -448,7 +395,7 @@ export interface UserInput {
password_hash: string;
user_role?: string;
max_number_websites?: number;
- created_at?: Date;
+ created_at?: string;
}
const user = {
tableName: "user",
@@ -466,10 +413,10 @@ export interface Website {
user_id: string;
content_type: string;
title: string;
+ slug: string | null;
max_storage_size: number;
- is_published: boolean;
- created_at: Date;
- last_modified_at: Date;
+ created_at: string;
+ last_modified_at: string;
last_modified_by: string | null;
}
export interface WebsiteInput {
@@ -477,10 +424,10 @@ export interface WebsiteInput {
user_id?: string;
content_type: string;
title: string;
+ slug?: string | null;
max_storage_size?: number;
- is_published?: boolean;
- created_at?: Date;
- last_modified_at?: Date;
+ created_at?: string;
+ last_modified_at?: string;
last_modified_by?: string | null;
}
const website = {
@@ -490,8 +437,8 @@ const website = {
"user_id",
"content_type",
"title",
+ "slug",
"max_storage_size",
- "is_published",
"created_at",
"last_modified_at",
"last_modified_by"
@@ -523,10 +470,6 @@ export interface TableTypes {
select: DocsCategory;
input: DocsCategoryInput;
};
- domain_prefix: {
- select: DomainPrefix;
- input: DomainPrefixInput;
- };
footer: {
select: Footer;
input: FooterInput;
@@ -539,10 +482,6 @@ export interface TableTypes {
select: Home;
input: HomeInput;
};
- legal_information: {
- select: LegalInformation;
- input: LegalInformationInput;
- };
media: {
select: Media;
input: MediaInput;
@@ -566,11 +505,9 @@ export const tables = {
change_log,
collab,
docs_category,
- domain_prefix,
footer,
header,
home,
- legal_information,
media,
settings,
user,
diff --git a/web-app/src/lib/server/utils.ts b/web-app/src/lib/server/utils.ts
index 134430c..c5b41d4 100644
--- a/web-app/src/lib/server/utils.ts
+++ b/web-app/src/lib/server/utils.ts
@@ -19,11 +19,13 @@ export const apiRequest = async (
body?: any;
successMessage?: string;
returnData?: boolean;
+ noJSONTransform?: boolean;
} = {
headers: {},
body: undefined,
successMessage: "Operation was successful",
- returnData: false
+ returnData: false,
+ noJSONTransform: false
}
) => {
const headers = {
@@ -48,7 +50,7 @@ export const apiRequest = async (
return {
success: true,
message: options.successMessage,
- data: method === "HEAD" ? response : await response.json()
+ data: method === "HEAD" || options.noJSONTransform ? response : await response.json()
};
}
diff --git a/web-app/src/lib/templates/Article.svelte b/web-app/src/lib/templates/Article.svelte
new file mode 100644
index 0000000..4a52f28
--- /dev/null
+++ b/web-app/src/lib/templates/Article.svelte
@@ -0,0 +1,64 @@
+
+
+
+
+