simple-web-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 613fd402b13f2bc33c6597f04818120ed1efa503
parent 278aaf6e9fe33219de6bd3088ebf2c379492d570
Author: Silas Brack <silasbrack@gmail.com>
Date:   Fri, 12 Jun 2026 21:22:51 +0200

chore: remove old seeds, scripts, guests, and schemas

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Dguests/rust/Cargo.lock | 987-------------------------------------------------------------------------------
Dguests/rust/Cargo.toml | 13-------------
Dguests/rust/src/lib.rs | 242-------------------------------------------------------------------------------
Dschemas/category.json | 19-------------------
Dschemas/comment.json | 47-----------------------------------------------
Dschemas/story.json | 61-------------------------------------------------------------
Dschemas/story_category.json | 21---------------------
Dschemas/user_profile.json | 35-----------------------------------
Dschemas/vote.json | 29-----------------------------
Dscripts/generate-types.sh | 46----------------------------------------------
Dscripts/migrate-from-trailbase.sql | 71-----------------------------------------------------------------------
Dscripts/seed.sh | 96-------------------------------------------------------------------------------
Dseed.sql | 29-----------------------------
13 files changed, 0 insertions(+), 1696 deletions(-)

diff --git a/guests/rust/Cargo.lock b/guests/rust/Cargo.lock @@ -1,987 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "anyhow" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" - -[[package]] -name = "bumpalo" -version = "3.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" - -[[package]] -name = "bytes" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "displaydoc" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-core" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" - -[[package]] -name = "futures-macro" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-task" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" - -[[package]] -name = "futures-util" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" -dependencies = [ - "futures-core", - "futures-macro", - "futures-task", - "pin-project-lite", - "slab", -] - -[[package]] -name = "hashbrown" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" -dependencies = [ - "foldhash", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "http" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be7462df143984c4598a256ef469b251d7d7f9e271135073e78fc535414f3d0" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "icu_collections" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" - -[[package]] -name = "icu_properties" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" - -[[package]] -name = "icu_provider" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" -dependencies = [ - "equivalent", - "hashbrown", - "serde", - "serde_core", -] - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "js-sys" -version = "0.3.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11" -dependencies = [ - "cfg-if", - "futures-util", - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] -name = "litemap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" - -[[package]] -name = "log" -version = "0.4.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" - -[[package]] -name = "macro-string" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a9dbbfc75d2688ed057456ce8a3ee3f48d12eec09229f560f3643b9f275653" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "memchr" -version = "2.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "potential_utf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" -dependencies = [ - "zerovec", -] - -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn", -] - -[[package]] -name = "proc-macro2" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "search-guest" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "trailbase-wasm", -] - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.150" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_path_to_error" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" -dependencies = [ - "itoa", - "serde", - "serde_core", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "syn" -version = "2.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinystr" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "trailbase-sqlvalue" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339e31ccaa86173d702b699ea0490cd221a53174189bce274e28b748e614f2c6" -dependencies = [ - "base64", - "serde", - "serde_bytes", - "thiserror", - "ts-rs", -] - -[[package]] -name = "trailbase-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6539601fa59e998bfa69a1cf56ebe0817e1f34c58e457505efca8c7ca91ebbbf" -dependencies = [ - "base64", - "bytes", - "futures-util", - "http", - "log", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "static_assertions", - "thiserror", - "trailbase-sqlvalue", - "trailbase-wasm-common", - "url", - "wit-bindgen", - "wstd", -] - -[[package]] -name = "trailbase-wasm-common" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b767529d0290d969d3eb768ce4cf93e2588cc58bde1ae407a6e96e991e5365" -dependencies = [ - "serde", - "trailbase-sqlvalue", - "ts-rs", -] - -[[package]] -name = "ts-rs" -version = "11.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4994acea2522cd2b3b85c1d9529a55991e3ad5e25cdcd3de9d505972c4379424" -dependencies = [ - "indexmap", - "serde_json", - "thiserror", - "ts-rs-macros", - "uuid", -] - -[[package]] -name = "ts-rs-macros" -version = "11.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6ff59666c9cbaec3533964505d39154dc4e0a56151fdea30a09ed0301f62e2" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "termcolor", -] - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "uuid" -version = "1.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d258b83ceec21034727ecee8c382cfa6c3e133699b0742c64571814fb420c9f7" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "wasip2" -version = "1.0.3+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.122" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.122" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.122" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.122" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-encoder" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b6733b8b91d010a6ac5b0fb237dc46a19650bc4c67db66857e2e787d437204" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "665fe59e56cc9b419ca6fcca56673e3421d1a5011e3b65caf6b726fd9e041d10" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6fb4c2bee46c5ea4d40f8cdb5c131725cd976718ec56f1c8e82fbde5fa2a80" -dependencies = [ - "bitflags", - "hashbrown", - "indexmap", - "semver", -] - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" -dependencies = [ - "bitflags", - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dee27a2dc20d1008016c742ec9fc6ea498492994ba3750be7454cbc97ff04c" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5007dae772945b7a5003d69d90a3a4a78929d41f19d004e980c4259a6af4484" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af9237d678e3513ad24e96fe98beacdc0db6405284ba2a2400418cf0d42caa89" -dependencies = [ - "anyhow", - "macro-string", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d567162a6b9843080e5e0053f696623ff694bae8ae017c9ec536d1873bbe3d8" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ffe4064318cdf3c08cb99343b44c039fcefe61ccdf58aa9975285f13d74d1fc" -dependencies = [ - "anyhow", - "hashbrown", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "writeable" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" - -[[package]] -name = "wstd" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0736607b57fcb58dd3148cf34d6a6ca63ba041fde8a12ab3f2c48ddf6d11877" -dependencies = [ - "async-task", - "http", - "itoa", - "pin-project-lite", - "serde", - "serde_json", - "slab", - "wasip2", - "wstd-macro", -] - -[[package]] -name = "wstd-macro" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb142608f932022fa7d155d8ed99649d02c56a50532e71913a5a03c7c4e288d3" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "yoke" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/guests/rust/Cargo.toml b/guests/rust/Cargo.toml @@ -1,13 +0,0 @@ -[package] -name = "search-guest" -version = "0.1.0" -edition = "2021" -publish = false - -[lib] -crate-type = ["cdylib"] - -[dependencies] -serde = { version = "1", features = ["derive"] } -serde_json = "1" -trailbase-wasm = "0.5" diff --git a/guests/rust/src/lib.rs b/guests/rust/src/lib.rs @@ -1,242 +0,0 @@ -#![forbid(unsafe_code)] - -use trailbase_wasm::db::{query, Value}; -use trailbase_wasm::http::{HttpError, HttpRoute, Json, Request, StatusCode, routing}; -use trailbase_wasm::{Guest, export}; - -struct ApiGuest; - -fn as_integer(v: &Value) -> i64 { - match v { - Value::Integer(i) => *i, - Value::Text(s) => s.parse().unwrap_or(0), - _ => 0, - } -} - -fn as_text(v: &Value) -> String { - match v { - Value::Text(s) => s.clone(), - _ => String::new(), - } -} - -fn as_opt_text(v: &Value) -> Option<String> { - match v { - Value::Text(s) => Some(s.clone()), - _ => None, - } -} - -fn err(msg: impl std::fmt::Display) -> HttpError { - HttpError::message(StatusCode::INTERNAL_SERVER_ERROR, msg.to_string()) -} - -// GET /search?q=...&limit=20 -#[derive(serde::Serialize)] -struct SearchResult { - id: i64, - title: String, - text: String, - score: i64, - comment_count: i64, -} - -async fn search_handler(req: Request) -> Result<Json<Vec<SearchResult>>, HttpError> { - let q = req - .query_param("q") - .ok_or_else(|| HttpError::message(StatusCode::BAD_REQUEST, "Missing 'q' parameter"))?; - - let limit: i64 = req - .query_param("limit") - .and_then(|l| l.parse().ok()) - .unwrap_or(20); - - let rows = query( - "SELECT s.id, s.title, s.text, s.score, s.comment_count - FROM story_fts - JOIN story s ON s.id = story_fts.rowid - WHERE story_fts MATCH $1 - LIMIT $2", - [Value::Text(q), Value::Integer(limit)], - ) - .await - .map_err(err)?; - - let results = rows - .iter() - .map(|row| SearchResult { - id: as_integer(&row[0]), - title: as_text(&row[1]), - text: as_text(&row[2]), - score: as_integer(&row[3]), - comment_count: as_integer(&row[4]), - }) - .collect(); - - Ok(Json(results)) -} - -// GET /enrich?ids=1,2,3 -// Returns tags and author usernames for multiple stories in one round trip. -#[derive(serde::Serialize)] -struct StoryMeta { - story_id: i64, - author_username: Option<String>, - tags: Vec<String>, -} - -async fn enrich_handler(req: Request) -> Result<Json<Vec<StoryMeta>>, HttpError> { - let ids_str = req - .query_param("ids") - .ok_or_else(|| HttpError::message(StatusCode::BAD_REQUEST, "Missing 'ids' parameter"))?; - - let ids: Vec<i64> = ids_str - .split(',') - .filter_map(|s| s.trim().parse().ok()) - .collect(); - - if ids.is_empty() { - return Ok(Json(vec![])); - } - - // Build placeholders: $1, $2, $3, ... - let placeholders: Vec<String> = (1..=ids.len()).map(|i| format!("${}", i)).collect(); - let placeholder_str = placeholders.join(","); - - // Fetch author usernames - let author_sql = format!( - "SELECT s.id, up.username - FROM story s - LEFT JOIN user_profile up ON up.user_id = s.created_by - WHERE s.id IN ({})", - placeholder_str - ); - let params: Vec<Value> = ids.iter().map(|&id| Value::Integer(id)).collect(); - let author_rows = query(&author_sql, params.clone()).await.map_err(err)?; - - // Fetch tags - let tag_sql = format!( - "SELECT sc.news_item_id, c.name - FROM story_category sc - JOIN category c ON c.id = sc.category_id - WHERE sc.news_item_id IN ({})", - placeholder_str - ); - let tag_rows = query(&tag_sql, params).await.map_err(err)?; - - // Build result - let mut result: Vec<StoryMeta> = ids - .iter() - .map(|&id| StoryMeta { - story_id: id, - author_username: None, - tags: vec![], - }) - .collect(); - - for row in &author_rows { - let id = as_integer(&row[0]); - let username = as_opt_text(&row[1]); - if let Some(meta) = result.iter_mut().find(|m| m.story_id == id) { - meta.author_username = username; - } - } - - for row in &tag_rows { - let id = as_integer(&row[0]); - let tag_name = as_text(&row[1]); - if let Some(meta) = result.iter_mut().find(|m| m.story_id == id) { - meta.tags.push(tag_name); - } - } - - Ok(Json(result)) -} - -// GET /enrich_comments?user_ids=abc,def -// Returns a mapping from user_id to username for a batch of user IDs. -#[derive(serde::Serialize)] -struct UserMapping { - user_id: String, - username: String, -} - -async fn enrich_comments_handler(req: Request) -> Result<Json<Vec<UserMapping>>, HttpError> { - let ids_str = req - .query_param("user_ids") - .ok_or_else(|| HttpError::message(StatusCode::BAD_REQUEST, "Missing 'user_ids' parameter"))?; - - let ids: Vec<&str> = ids_str.split(',').map(|s| s.trim()).filter(|s| !s.is_empty()).collect(); - - if ids.is_empty() { - return Ok(Json(vec![])); - } - - let placeholders: Vec<String> = (1..=ids.len()).map(|i| format!("${}", i)).collect(); - let placeholder_str = placeholders.join(","); - - let sql = format!( - "SELECT user_id, username FROM user_profile WHERE user_id IN ({})", - placeholder_str - ); - let params: Vec<Value> = ids.iter().map(|&id| Value::Text(id.to_string())).collect(); - let rows = query(&sql, params).await.map_err(err)?; - - let result = rows - .iter() - .map(|row| UserMapping { - user_id: as_text(&row[0]), - username: as_text(&row[1]), - }) - .collect(); - - Ok(Json(result)) -} - -// GET /stories_by_tag?category_id=5&limit=31&offset=0 -// Returns story IDs for a category, ordered by published date descending. -async fn stories_by_tag_handler(req: Request) -> Result<Json<Vec<i64>>, HttpError> { - let category_id: i64 = req - .query_param("category_id") - .and_then(|s| s.parse().ok()) - .ok_or_else(|| HttpError::message(StatusCode::BAD_REQUEST, "Missing 'category_id' parameter"))?; - - let limit: i64 = req - .query_param("limit") - .and_then(|s| s.parse().ok()) - .unwrap_or(31); - - let offset: i64 = req - .query_param("offset") - .and_then(|s| s.parse().ok()) - .unwrap_or(0); - - let rows = query( - "SELECT s.id - FROM story s - JOIN story_category sc ON sc.news_item_id = s.id - WHERE sc.category_id = $1 - ORDER BY s.published DESC - LIMIT $2 OFFSET $3", - [Value::Integer(category_id), Value::Integer(limit), Value::Integer(offset)], - ) - .await - .map_err(err)?; - - let ids = rows.iter().map(|row| as_integer(&row[0])).collect(); - Ok(Json(ids)) -} - -impl Guest for ApiGuest { - fn http_handlers() -> Vec<HttpRoute> { - vec![ - routing::get("/search", search_handler), - routing::get("/enrich", enrich_handler), - routing::get("/enrich_comments", enrich_comments_handler), - routing::get("/stories_by_tag", stories_by_tag_handler), - ] - } -} - -export!(ApiGuest); diff --git a/schemas/category.json b/schemas/category.json @@ -1,19 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": [ - "null", - "string" - ] - } - }, - "required": [ - "id" - ], - "title": "category", - "type": "object" -} diff --git a/schemas/comment.json b/schemas/comment.json @@ -1,47 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "created_at": { - "type": "string" - }, - "created_by": { - "type": "string" - }, - "depth": { - "type": "integer" - }, - "id": { - "type": "integer" - }, - "parent_id": { - "type": [ - "null", - "integer" - ] - }, - "path": { - "type": "string" - }, - "score": { - "type": "integer" - }, - "story_id": { - "type": "integer" - }, - "text": { - "type": "string" - } - }, - "required": [ - "id", - "story_id", - "path", - "depth", - "text", - "score", - "created_at", - "created_by" - ], - "title": "comment", - "type": "object" -} diff --git a/schemas/story.json b/schemas/story.json @@ -1,61 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "author": { - "type": [ - "null", - "string" - ] - }, - "comment_count": { - "type": "integer" - }, - "created_by": { - "type": [ - "null", - "string" - ] - }, - "domain": { - "type": [ - "null", - "string" - ] - }, - "id": { - "type": "integer" - }, - "language": { - "type": "string" - }, - "published": { - "type": "string" - }, - "score": { - "type": "integer" - }, - "text": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": [ - "null", - "string" - ] - } - }, - "required": [ - "id", - "title", - "text", - "published", - "language", - "score", - "comment_count" - ], - "title": "story", - "type": "object" -} diff --git a/schemas/story_category.json b/schemas/story_category.json @@ -1,21 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "category_id": { - "type": "integer" - }, - "id": { - "type": "integer" - }, - "news_item_id": { - "type": "integer" - } - }, - "required": [ - "id", - "news_item_id", - "category_id" - ], - "title": "story_category", - "type": "object" -} diff --git a/schemas/user_profile.json b/schemas/user_profile.json @@ -1,35 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "about": { - "type": [ - "null", - "string" - ] - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "karma": { - "type": "integer" - }, - "user_id": { - "type": "string" - }, - "username": { - "type": "string" - } - }, - "required": [ - "id", - "user_id", - "username", - "karma", - "created_at" - ], - "title": "user_profile", - "type": "object" -} diff --git a/schemas/vote.json b/schemas/vote.json @@ -1,29 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "properties": { - "created_at": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "target_id": { - "type": "integer" - }, - "target_type": { - "type": "integer" - }, - "user_id": { - "type": "string" - } - }, - "required": [ - "id", - "user_id", - "target_type", - "target_id", - "created_at" - ], - "title": "vote", - "type": "object" -} diff --git a/scripts/generate-types.sh b/scripts/generate-types.sh @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_DIR="$(dirname "$SCRIPT_DIR")" -SCHEMA_DIR="$PROJECT_DIR/schemas" -OUTPUT_FILE="$PROJECT_DIR/src/trailbase_types.rs" - -mkdir -p "$SCHEMA_DIR" - -echo "Exporting schemas from Trailbase..." - -tables=(story comment vote user_profile category story_category) -for table in "${tables[@]}"; do - trail schema "$table" --mode select 2>/dev/null | grep -v "^Rust\|^Run " > "$SCHEMA_DIR/${table}.json" - echo " - $table" -done - -echo "Generating Rust types with quicktype..." - -quicktype \ - --src-lang schema \ - --lang rust \ - --visibility public \ - --derive-debug \ - --density dense \ - --src "$SCHEMA_DIR/story.json" \ - --src "$SCHEMA_DIR/comment.json" \ - --src "$SCHEMA_DIR/vote.json" \ - --src "$SCHEMA_DIR/user_profile.json" \ - --src "$SCHEMA_DIR/category.json" \ - --src "$SCHEMA_DIR/story_category.json" \ - --out "$OUTPUT_FILE" - -# Add Clone derive -sed -i 's/#\[derive(Debug, Serialize, Deserialize)\]/#[derive(Debug, Clone, Serialize, Deserialize)]/g' "$OUTPUT_FILE" - -# Add module doc -sed -i '1,/^use serde/{ /^use serde/!d }' "$OUTPUT_FILE" -sed -i '1i //! Auto-generated types from Trailbase schema.\n//! Run `./scripts/generate-types.sh` to regenerate.\n' "$OUTPUT_FILE" - -echo "Generated $OUTPUT_FILE" -echo "" -echo "NOTE: You may need to manually adjust:" -echo " - Option<T> for nullable fields" -echo " - Field comments (e.g. target_type: 1=story, 2=comment)" diff --git a/scripts/migrate-from-trailbase.sql b/scripts/migrate-from-trailbase.sql @@ -1,71 +0,0 @@ --- Migration script: TrailBase -> direct SQLite --- Usage: sqlite3 /var/lib/simple-web-app/data/app.db < migrate-from-trailbase.sql --- --- Prerequisites: --- 1. Stop the old TrailBase service --- 2. Copy old DB: cp /var/lib/simple-web-app-trailbase/traildepot/data/main.db /tmp/old.db --- 3. Run this script --- 4. Users will need to re-register (passwords can't be migrated) - -ATTACH '/tmp/old.db' AS old; - --- Migrate categories -INSERT OR IGNORE INTO category (id, name) -SELECT id, name FROM old.category; - --- Create users from old user_profile (without passwords - they'll need to re-register) --- Use a placeholder password hash -INSERT OR IGNORE INTO user (id, email, password_hash, username, about, karma, created_at, email_verified) -SELECT - up.id, - 'migrated_' || up.id || '@placeholder.com', - '$placeholder$needs_reregister', - up.username, - up.about, - up.karma, - up.created_at, - 0 -FROM old.user_profile up; - --- Create ID mapping: old UUID blob -> new integer user ID --- This uses user_profile.user_id (blob) -> user_profile.id (integer) -CREATE TEMP TABLE user_id_map AS -SELECT user_id AS old_id, id AS new_id FROM old.user_profile; - --- Migrate stories -INSERT OR IGNORE INTO story (id, url, title, text, published, author, language, created_by, score, comment_count, domain) -SELECT - s.id, s.url, s.title, s.text, s.published, s.author, s.language, - COALESCE(m.new_id, NULL), - s.score, s.comment_count, s.domain -FROM old.story s -LEFT JOIN user_id_map m ON m.old_id = s.created_by; - --- Migrate comments -INSERT OR IGNORE INTO comment (id, story_id, parent_id, path, depth, text, score, created_at, created_by) -SELECT - c.id, c.story_id, c.parent_id, c.path, c.depth, c.text, c.score, c.created_at, - COALESCE(m.new_id, 0) -FROM old.comment c -LEFT JOIN user_id_map m ON m.old_id = c.created_by; - --- Migrate votes -INSERT OR IGNORE INTO vote (id, user_id, target_type, target_id, created_at) -SELECT - v.id, - COALESCE(m.new_id, 0), - v.target_type, v.target_id, v.created_at -FROM old.vote v -LEFT JOIN user_id_map m ON m.old_id = v.user_id; - --- Migrate story_category -INSERT OR IGNORE INTO story_category (id, news_item_id, category_id) -SELECT id, news_item_id, category_id FROM old.story_category; - --- Rebuild FTS index -INSERT INTO story_fts(story_fts) VALUES('rebuild'); - -DROP TABLE user_id_map; -DETACH old; - -.quit diff --git a/scripts/seed.sh b/scripts/seed.sh @@ -1,96 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -TRAILBASE_URL="${TRAILBASE_URL:-http://127.0.0.1:4000}" -AUTH="${TOKEN#Bearer }" - -post() { - local title="$1" url="$2" text="$3" published="$4" - local domain="" - if [ -n "$url" ]; then - domain=$(echo "$url" | sed 's|https\?://\(www\.\)\?||;s|/.*||') - fi - - local url_field="null" - [ -n "$url" ] && url_field="\"$url\"" - local domain_field="null" - [ -n "$domain" ] && domain_field="\"$domain\"" - - curl -s -X POST \ - -H "Authorization: Bearer $AUTH" \ - -H "Content-Type: application/json" \ - "${TRAILBASE_URL}/api/records/v1/story" \ - -d "{\"title\":\"$title\",\"url\":$url_field,\"text\":\"$text\",\"domain\":$domain_field,\"published\":\"$published\",\"language\":\"en\"}" > /dev/null - echo " + $title" -} - -tag() { - curl -s -X POST \ - -H "Authorization: Bearer $AUTH" \ - -H "Content-Type: application/json" \ - "${TRAILBASE_URL}/api/records/v1/story_category" \ - -d "{\"news_item_id\":$1,\"category_id\":$2}" > /dev/null -} - -echo "Seeding stories..." - -post "Show: I built a link aggregator with Rust and Trailbase" "" \ - "After trying several backend frameworks, I settled on Trailbase for the auth and data layer, with a custom Rust frontend using Axum and Askama templates. FTS5 search, HTMX for voting." \ - "2026-06-07T15:00:00Z" - -post "SQLite is the only database you need for most web apps" \ - "https://www.sqlite.org/whentouse.html" "" "2026-06-07T13:00:00Z" - -post "Ask: What is your preferred way to handle auth in a side project?" "" \ - "I have been going back and forth between rolling my own JWT auth, using OAuth providers, and using something like Trailbase or Supabase. What do you all use?" \ - "2026-06-07T11:00:00Z" - -post "The unreasonable effectiveness of simple HTML" \ - "https://www.swyx.io/simplicity-economy" "" "2026-06-07T08:00:00Z" - -post "NixOS: declarative infrastructure as code for your servers" \ - "https://nixos.org/guides/how-nix-works" "" "2026-06-07T06:00:00Z" - -post "Why we moved from microservices back to a monolith" \ - "https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90" "" \ - "2026-06-06T18:00:00Z" - -post "Full-text search with SQLite FTS5" \ - "https://www.sqlite.org/fts5.html" "" "2026-06-06T12:00:00Z" - -post "The web does not need JavaScript frameworks" \ - "https://htmx.org/essays/a-real-world-react-to-htmx-port/" "" "2026-06-05T18:00:00Z" - -post "Show: Self-hosting everything on a single Hetzner box" "" \ - "Running NixOS on a Hetzner dedicated server with nginx, Forgejo, MediaWiki, a mail server, and now this link aggregator. All managed through a single flake." \ - "2026-06-05T12:00:00Z" - -post "Rust error handling is beautiful" \ - "https://blog.burntsushi.net/rust-error-handling/" "" "2026-06-04T18:00:00Z" - -post "Ask: How do you manage secrets in NixOS?" "" \ - "I have been using sops-nix with age keys derived from SSH host keys. Works well but curious what others are doing. Anyone using vault or agenix?" \ - "2026-06-04T12:00:00Z" - -post "WireGuard is massively simpler than OpenVPN" \ - "https://www.wireguard.com/papers/wireguard.pdf" "" "2026-06-03T18:00:00Z" - -post "The small web is beautiful" \ - "https://benhoyt.com/writings/the-small-web-is-beautiful/" "" "2026-06-02T18:00:00Z" - -post "Nix flakes are not the future of Nix, they are the present" \ - "https://determinate.systems/posts/nix-and-flakes" "" "2026-06-02T12:00:00Z" - -post "Show: A minimal HN clone in under 2000 lines of Rust" "" \ - "Axum for routing, Askama for templates, Trailbase for the database and auth, rusqlite for FTS5 search. No JS framework, just HTMX for the interactive bits." \ - "2026-06-01T12:00:00Z" - -echo "Seeding tags..." -tag 1 1; tag 1 3 -tag 3 2 -tag 5 3 -tag 9 1; tag 9 3 -tag 11 2; tag 11 3 -tag 15 1; tag 15 3 - -echo "Done! Seeded 15 stories with tags." diff --git a/seed.sql b/seed.sql @@ -1,29 +0,0 @@ --- Categories -INSERT INTO category (id, name) VALUES - (1, 'Technology'), - (2, 'Science'), - (3, 'Politics'), - (4, 'Business'), - (5, 'Sports'); - --- News items -INSERT INTO news_item (id, url, title, text, published, author, language) VALUES - (1, 'https://example.com/1', 'New AI Model Breaks Records', 'Researchers have developed a new artificial intelligence model that significantly outperforms previous benchmarks in natural language understanding tasks.', '2026-04-21T10:00:00Z', 'Jane Smith', 'english'), - (2, 'https://example.com/2', 'SpaceX Launches New Satellite Constellation', 'SpaceX successfully launched another batch of satellites, expanding global internet coverage to remote areas.', '2026-04-21T09:30:00Z', 'John Doe', 'english'), - (3, 'https://example.com/3', 'Climate Summit Reaches Historic Agreement', 'World leaders have agreed on ambitious new targets for reducing carbon emissions over the next decade.', '2026-04-21T08:00:00Z', 'Alice Johnson', 'english'), - (4, 'https://example.com/4', 'Tech Giants Report Strong Quarterly Earnings', 'Major technology companies exceeded analyst expectations with robust revenue growth across all segments.', '2026-04-20T18:00:00Z', 'Bob Williams', 'english'), - (5, 'https://example.com/5', 'Breakthrough in Quantum Computing', 'Scientists achieve new milestone in quantum error correction, bringing practical quantum computers closer to reality.', '2026-04-20T14:00:00Z', 'Carol Davis', 'english'), - (6, 'https://example.com/6', 'Local Team Wins Championship', 'In a thrilling finale, the underdog team secured victory in the national championship after a dramatic overtime.', '2026-04-20T22:00:00Z', 'Dave Brown', 'english'), - (7, 'https://example.com/7', 'New Electric Vehicle Sets Range Record', 'An innovative battery design allows the latest EV model to travel over 600 miles on a single charge.', '2026-04-19T16:00:00Z', 'Eve Miller', 'english'), - (8, 'https://example.com/8', 'Researchers Discover New Species in Deep Ocean', 'Marine biologists have identified several previously unknown species during a deep-sea exploration mission.', '2026-04-19T12:00:00Z', 'Frank Wilson', 'english'); - --- Link news items to categories -INSERT INTO news_item_category (news_item_id, category_id) VALUES - (1, 1), (1, 2), - (2, 1), (2, 2), - (3, 3), - (4, 1), (4, 4), - (5, 1), (5, 2), - (6, 5), - (7, 1), (7, 4), - (8, 2);