156 lines
4.5 KiB
Markdown
156 lines
4.5 KiB
Markdown
## 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)
|
|
|
|
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)
|
|
|
|
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
|
|
- `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)
|
|
- `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)
|
|
- `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
|
|
- `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)
|
|
|
|
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)
|
|
|
|
## 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
|
|
|
|
## 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).
|
|
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
|