Compare commits

...

2 commits

Author SHA1 Message Date
29065c72c8 feat: add sources form and table 2025-02-05 19:56:47 -03:00
e2a6c92322 chore: add example .env 2025-02-05 19:09:17 -03:00
8 changed files with 83 additions and 7 deletions

7
.env.example Normal file
View file

@ -0,0 +1,7 @@
POSTGRES_DB=index
POSTGRES_USER=index
POSTGRES_PASSWORD=
DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?sslmode=disable"
SQLPAGE_WEB_ROOT=app

View file

@ -11,3 +11,5 @@ dev:
docker compose up --watch docker compose up --watch
dbmate +ARGS: (compose-exec "index dbmate" ARGS) dbmate +ARGS: (compose-exec "index dbmate" ARGS)
migrate: (dbmate "migrate")

View file

@ -2,7 +2,6 @@ FROM ghcr.io/linuxcontainers/debian-slim:latest
COPY --from=ghcr.io/amacneil/dbmate /usr/local/bin/dbmate /usr/local/bin/dbmate COPY --from=ghcr.io/amacneil/dbmate /usr/local/bin/dbmate /usr/local/bin/dbmate
COPY --from=lovasoa/sqlpage:latest /usr/local/bin/sqlpage /usr/local/bin/sqlpage COPY --from=lovasoa/sqlpage:latest /usr/local/bin/sqlpage /usr/local/bin/sqlpage
COPY --from=lovasoa/sqlpage:latest /lib/libgcc_s.so.1 /lib/libgcc_s.so.1
WORKDIR /app WORKDIR /app

View file

@ -17,3 +17,8 @@ services:
db: db:
image: postgres:17 image: postgres:17
env_file: ../.env env_file: ../.env
volumes:
- db_data:/var/lib/postgresql/data
volumes:
db_data:

1
src/app/index.sql Normal file
View file

@ -0,0 +1 @@
SELECT 'dynamic' AS component, sqlpage.read_file_as_text('../shared/shell.json') AS properties;

47
src/app/sources/index.sql Normal file
View file

@ -0,0 +1,47 @@
SELECT
'dynamic' AS component,
sqlpage.read_file_as_text('../shared/shell.json') AS properties;
-- ╭─────────────────────────────────────────────────────────╮
-- │ Form │
-- ╰─────────────────────────────────────────────────────────╯
SELECT
'form' AS component,
'sources/create.sql' AS ACTION,
'Save' AS validate,
'Sources' AS title;
SELECT
'name' AS name,
'Name' AS label,
8 AS width,
TRUE AS required;
SELECT
'uid' AS name,
'Identifier' AS label,
4 AS width,
5 AS maxlength,
1 AS minlength,
TRUE AS required;
SELECT
'uri' AS name,
'URI' AS label,
TRUE AS required;
INSERT INTO
public.sources(name, uid, uri)
VALUES
(:name, :uid, :uri);
-- ╭─────────────────────────────────────────────────────────╮
-- │ Table list │
-- ╰─────────────────────────────────────────────────────────╯
SELECT
'table' AS component;
SELECT
*
FROM
public.sources;

View file

@ -1,6 +0,0 @@
SELECT 'list' AS component,
'Popular websites TESTOOO' AS title;
SELECT 'Hello' AS title,
'world' AS description,
'https://wikipedia.org' AS link;

21
src/shared/shell.json Normal file
View file

@ -0,0 +1,21 @@
{
"component": "shell",
"title": "Index",
"link": "/",
"layout": "boxed",
"theme": "dark",
"menu_item": [
{ "link": "index.sql", "title": "Home" },
{
"title": "Dependencies",
"icon": "brand-stackshare",
"submenu": [
{
"link": "/sources/index.sql",
"title": "Sources",
"icon": "external-link"
}
]
}
]
}