From 98576aa6a428c548d056c29f473f0486c4c5ee7c Mon Sep 17 00:00:00 2001 From: nostrdev-com <support@nostrdev.com> Date: Wed, 19 Mar 2025 15:07:17 +0300 Subject: [PATCH] docs: improved schema.md --- .gitignore | 2 + schema.md | 221 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 126 insertions(+), 97 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b0d69c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Mac OS system files +.DS_Store \ No newline at end of file diff --git a/schema.md b/schema.md index 7f16d12..a2674d0 100644 --- a/schema.md +++ b/schema.md @@ -1,128 +1,155 @@ -## Database Schema: +## Database Schema: preferably using Cassandra: A distributed NoSQL database 1. **Events** (Nostr protocol's core data structure): -* `id` (unique identifier) -* `pubkey` (public key of the event creator) -* `created_at` (timestamp) -* `kind` (event type, e.g., review, article, comment) -* `tags` (array of keywords or hashtags) -* `content` (text content of the event) + +- `id` (unique identifier) +- `pubkey` (public key of the event creator) +- `created_at` (timestamp) +- `kind` (event type, e.g., review, article, comment) +- `tags` (array of keywords or hashtags) +- `content` (text content of the event) This duplicates the relay, so should only be relevant kinds (eg nominated Review kind) 2. **User Reviews**: -* `event_id` (foreign key referencing the Events table) -* `product_id` (unique identifier for the product) -* `rating` (numerical rating, e.g., 1-100) -* `review_text` (text content of the review) -* `tasting_notes` (array of tasting notes, e.g., flavors, aromas) + +- `event_id` (foreign key referencing the Events table) +- `product_id` (unique identifier for the product) +- `rating` (numerical rating, e.g., 1-100) +- `review_text` (text content of the review) +- `tasting_notes` (array of tasting notes, e.g., flavors, aromas) 3. **Wines**: -* `product_id` (uuid) -* `wine_id` ( type/style/characteristic, EAN/UPC, sku) -* `type` (white, amber, rose, red) -* `style` (bubbles+fizz, table, dessert, fortified, vermouth) -* `characteristic` (light aromatic, textural, fruit forward, structural & savoury, powerful) -* `country` -* `region` (appellation, village, sub-region, vineyard) -* `name` (label) -* `producer` -* `varietal` (if more than one, listl as ‘blend’) -* `vintage` (year, nv, mv) -* `alcohol` -* `standard drinks` (Australia) -* `viticulture` (biodynamic, organic, conventional) -* `sulfites` (parts per million) -* `filtration` -* `vegan` -* `kosher` -* `closure` (cork, crown-seal, screwcap) -* `price` (NIP-89, NIP-99) -* `image` (optional image URL)cellar.social + +- `product_id` (uuid) +- `wine_id` ( type/style/characteristic, EAN/UPC, sku) +- `type` (white, amber, rose, red) +- `style` (bubbles+fizz, table, dessert, fortified, vermouth) +- `characteristic` (light aromatic, textural, fruit forward, structural & savoury, powerful) +- `country` +- `region` (appellation, village, sub-region, vineyard) +- `name` (label) +- `producer` +- `varietal` (if more than one, listl as 'blend') +- `vintage` (year, nv, mv) +- `alcohol` +- `standard drinks` (Australia) +- `viticulture` (biodynamic, organic, conventional) +- `sulfites` (parts per million) +- `filtration` +- `vegan` +- `kosher` +- `closure` (cork, crown-seal, screwcap) +- `price` (NIP-89, NIP-99) +- `image` (optional image URL)cellar.social +- `description` (detailed description of the product) +- `url` (e.g. producer's website) +- `availability` (in stock, out of stock, discontinued) 4. **Sake**: -* `product_id` (uuid) -* `sake_id` (designation, polish rate, starter, yeast, EAN/UPC, sku ) -*` country -* `region` -* `name` (label) -* `producer` -* `designation`(table, pure, blended, mirin: new/true/salt) -*` polish rate` (%) -*` starter` (koji) -*` yeast strain` -*` alcohol` -* `standard drinks` (Australia) -* `vintage` (year, nv, mv) -* `price` (NIP-89, NIP-99) -* `image` (optional image URL) + +- `product_id` (uuid) +- `sake_id` (designation, polish rate, starter, yeast, EAN/UPC, sku ) +- `country` +- `region` +- `name` (label) +- `producer` +- `designation` (table, pure, blended, mirin: new/true/salt) +- `polish rate` (%) +- `starter` (koji) +- `yeast strain` +- `alcohol` +- `standard drinks` (Australia) +- `vintage` (year, nv, mv) +- `price` (NIP-89, NIP-99) +- `image` (optional image URL) +- `description` (detailed description of the product) +- `url` (e.g. producer's website) +- `availability` (in stock, out of stock, discontinued) 5. **Spirits**: -* `product_id` (uuid) -* `spirit_id` (EAN/UPC, sku) -*` country -* `region` -* `name` (label) -* `producer` -* `type`(white, dark, liqueurs) -*` variant`(vodka, rum, liqueur cream, etc) -*` flavouring/ingredients` -*` alcohol` -* `standard drinks` (Australia) -* `vintage` (year, VS/VSOP/XO, age statement) -* `price` (NIP-89, NIP-99) -* `image` (optional image URL) + +- `product_id` (uuid) +- `spirit_id` (EAN/UPC, sku) +- `country` +- `region` +- `name` (label) +- `producer` +- `type`(white, dark, liqueurs) +- `variant`(vodka, rum, liqueur cream, etc) +- `flavouring/ingredients` +- `alcohol` +- `standard drinks` (Australia) +- `vintage` (year, VS/VSOP/XO, age statement) +- `price` (NIP-89, NIP-99) +- `image` (optional image URL) +- `description` (detailed description of the product) +- `url` (e.g. producer's website) +- `availability` (in stock, out of stock, discontinued) + 6. **Coffee**: -* `coffee_id` (unique identifier) -*` country -* `region` -* `origin` -* `variety` -*` processing` (type: de-caff/honey/semi-dry/swiss water/sundried/washed) -* `producer` (roaster) -* `roast` -* `price` (g/kg/ton, NIP-89, NIP-99)) -* `image` (optional image URL)cellar.social + +- `coffee_id` (unique identifier) +- `country` +- `region` +- `origin` +- `variety` +- `processing` (type: de-caff/honey/semi-dry/swiss water/sundried/washed) +- `producer` (roaster) +- `roast` +- `price` (g/kg/ton, NIP-89, NIP-99) +- `image` (optional image URL)cellar.social +- `description` (detailed description of the product) +- `url` (e.g. producer's website) +- `availability` (in stock, out of stock, discontinued) 7. **Articles**: -* `event_id` (foreign key referencing the Events table) -* `title` -* `content` (text content of the article) -* `author` (public key of the author) -* `tags` (array of keywords or hashtags) + +- `event_id` (foreign key referencing the Events table) +- `title` +- `content` (text content of the article) +- `author` (public key of the author) +- `tags` (array of keywords or hashtags) 8. **Comments**: -* `event_id` (foreign key referencing the Events table) -* `parent_event_id` (foreign key referencing the Events table) -* `content` (text content of the comment) +- `event_id` (foreign key referencing the Events table) +- `parent_event_id` (foreign key referencing the Events table) +- `content` (text content of the comment) ## Frontend Schema: 1. **Review Page**: -* Display details (name, producer, region, varietal, vintage) -* Display review text and rating -* Display tasting notes -* Allow users to create new reviews and comments -2. **Article Page**: -* Display article title and content -* Display author information (public key, profile picture) -* Allow users to create new comments -3. **Wine List Page**: -* Display a list of wines with basic information (name, producer, region) -* Allow users to filter by region, varietal, or vintage -* Allow users to create new wine reviews -4. **Tag Page**: -* Display a list of events (reviews, articles, comments) associated with a particular tag -* Allow users to create new events with the same tag +- Display details (name, producer, region, varietal, vintage) +- Display review text and rating +- Display tasting notes +- Allow users to create new reviews and comments + +2. **Article Page**: + +- Display article title and content +- Display author information (public key, profile picture) +- Allow users to create new comments + +3. **Wine List Page**: + +- Display a list of wines with basic information (name, producer, region) +- Allow users to filter by region, varietal, or vintage +- Allow users to create new wine reviews + +4. **Tag Page**: + +- Display a list of events (reviews, articles, comments) associated with a particular tag +- Allow users to create new events with the same tag ## Nostr Protocol Integration: + 1. Use a Nostr client library to connect to the Nostr network and retrieve events. 2. Use the `pubkey` field to authenticate users and authorize actions (e.g., creating new reviews -or comments). + or comments). 3. Use the `created_at` field to display events in chronological order. 4. Use the `kind` field to determine the type of event and render it accordingly (e.g., review, -article, comment).cellar.social \ No newline at end of file + article, comment).cellar.social