From 69c660d0c414c35ae04db1b2e7bb3a30c0ca1cf3 Mon Sep 17 00:00:00 2001 From: dev <> Date: Wed, 6 Dec 2023 07:32:48 +0000 Subject: [PATCH] fix types error --- phoenix-api/migrations/0000.up.sql | 54 ------------------------------ phoenix-blog/src/routes/index.tsx | 3 +- 2 files changed, 2 insertions(+), 55 deletions(-) delete mode 100644 phoenix-api/migrations/0000.up.sql diff --git a/phoenix-api/migrations/0000.up.sql b/phoenix-api/migrations/0000.up.sql deleted file mode 100644 index 1c01bc8..0000000 --- a/phoenix-api/migrations/0000.up.sql +++ /dev/null @@ -1,54 +0,0 @@ -CREATE TABLE users ( - id UUID PRIMARY KEY, - created_at TIMESTAMP WITH TIME ZONE NOT NULL, - updated_at TIMESTAMP WITH TIME ZONE NOT NULL, - - email TEXT NOT NULL, - password_hash TEXT NOT NULL, - is_admin BOOLEAN NOT NULL -); -CREATE UNIQUE INDEX index_users_on_email ON users (email); - - -CREATE TABLE blogs ( - id UUID PRIMARY KEY, - created_at TIMESTAMP WITH TIME ZONE NOT NULL, - updated_at TIMESTAMP WITH TIME ZONE NOT NULL, - - name TEXT NOT NULL, - slug TEXT NOT NULL UNIQUE, - navigation JSONB NOT NULL, - description_html TEXT NOT NULL -); -CREATE UNIQUE INDEX index_blogs_on_slug ON blogs (slug); - - -CREATE TYPE PAGE_TYPE AS ENUM ('page', 'post'); - -CREATE TABLE pages ( - id UUID PRIMARY KEY, - created_at TIMESTAMP WITH TIME ZONE NOT NULL, - updated_at TIMESTAMP WITH TIME ZONE NOT NULL, - - slug TEXT NOT NULL, - title TEXT NOT NULL, - type PAGE_TYPE NOT NULL, - content_html TEXT NOT NULL, - - blog_id UUID NOT NULL REFERENCES blogs(id) ON DELETE CASCADE, - - UNIQUE(slug, blog_id) -); -CREATE INDEX index_pages_on_blog_id ON pages (blog_id); -CREATE INDEX index_pages_on_slug ON pages (slug); -CREATE INDEX index_pages_on_type ON pages (type); - - -CREATE TABLE assets ( - id UUID PRIMARY KEY, - created_at TIMESTAMP WITH TIME ZONE NOT NULL, - updated_at TIMESTAMP WITH TIME ZONE NOT NULL, - - - blog_id UUID NOT NULL REFERENCES blogs(id) -); diff --git a/phoenix-blog/src/routes/index.tsx b/phoenix-blog/src/routes/index.tsx index 71583c3..3d797b9 100644 --- a/phoenix-blog/src/routes/index.tsx +++ b/phoenix-blog/src/routes/index.tsx @@ -6,6 +6,7 @@ import { Blog, Page } from '@phoenix/core/entities'; import type { FC } from 'hono/jsx'; import { Base } from './_base'; import { date } from '../utils'; +import { HtmlEscapedString } from "hono/utils/html"; export async function index(ctx: Context): Promise { // const reqUrl = new URL(ctx.req.url); @@ -15,7 +16,7 @@ export async function index(ctx: Context): Promise { getPosts(ctx, domain), ]); - const html = IndexTemplate({ blog, posts }); + const html = IndexTemplate({ blog, posts }) as HtmlEscapedString; const etag = await sha256Sum(html); const cacheHit = handleCaching(ctx, 'public, no-cache, must-revalidate', etag); if (cacheHit) {