diff --git a/.vscode/settings.json b/.vscode/settings.json index 20a0eaa..6fa3cc4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,58 @@ { "cSpell.words": [ + "Abuelo", + "amarela", + "Amaro", + "Amarula", + "Añejo", + "Arabica", + "Baijiu", "biodynamic", + "Blanco", + "Cachaça", + "Caturra", + "Coren", + "espadín", + "Genever", + "Jägermeister", + "Jaune", + "Joven", + "Kimoto", "koji", + "Kona", + "Kouillou", + "Licor", + "Maragogype", + "Metaxa", + "Mirabelle", + "Nganda", "Nostr", "npub", + "ouro", + "Pacamara", + "Pacas", + "Pêche", + "Pisco", + "Platino", + "Poire", + "Pomme", + "Rakia", + "Reposado", + "Reserva", + "Robusta", "RRP", "screwcap", - "sundried" + "Soju", + "Sokujō", + "Solera", + "sundried", + "tepeztate", + "Tequilana", + "tobalá", + "Typica", + "Verte", + "VSOP", + "Yamahai", + "Yuzu" ] } diff --git a/src/models/coffee.ts b/src/models/coffee.ts index 951517a..47daf9c 100644 --- a/src/models/coffee.ts +++ b/src/models/coffee.ts @@ -1,5 +1,5 @@ import { ObjectId } from 'mongodb' -import { CoffeeProcessingType } from '../types' +import { CoffeeProcessingType, CoffeeVariety, CoffeeRoast } from '../types' import { Alpha2Code } from 'i18n-iso-countries' import { CurrencyCode } from 'currency-codes-ts/dist/types' @@ -11,11 +11,11 @@ export class Coffee { public country: Alpha2Code, // two-letter country codes defined in ISO 3166-1 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) public region: string, // appellation, village, sub-region, vineyard public origin: string, // origin - public variety: string, // ? + public variety: CoffeeVariety, // variety type and kind public processingType: CoffeeProcessingType, // processing type public name: string, // label public producerId: ObjectId, // product producer - public roast: string, // ? + public roast: CoffeeRoast, // roast level public RRPamount: number, // 20 public RRPcurrency: CurrencyCode, // USD public description: string, // detailed description of the product diff --git a/src/models/sake.ts b/src/models/sake.ts index 07c268e..ec107ff 100644 --- a/src/models/sake.ts +++ b/src/models/sake.ts @@ -1,5 +1,5 @@ import { ObjectId } from 'mongodb' -import { SakeDesignation } from '../types' +import { SakeDesignation, SakeStarter, Vintage } from '../types' import { Alpha2Code } from 'i18n-iso-countries' import { CurrencyCode } from 'currency-codes-ts/dist/types' @@ -14,11 +14,11 @@ export class Sake { public producerId: ObjectId, // product producer public designation: SakeDesignation, // table, pure, blended, mirin: new/true/salt public polishRate: number, // % - public starter: string, // koji + public starter: SakeStarter, // sake starter public yeastStrain: number, public alcohol: number, // alcohol percentage - public standardDrinks: number, // number representing an amount of standard drinks per bottle - public vintage: string, // year, nv (non-vintage) or mv (multi-vintage) + public standardDrinks100ml: number, // number representing an amount of standard drinks per bottle per 100ml + public vintage: Vintage, // year, nv (non-vintage) or mv (multi-vintage) public RRPamount: number, // 20 public RRPcurrency: CurrencyCode, // USD public description: string, // detailed description of the product diff --git a/src/models/spirit.ts b/src/models/spirit.ts index 819778b..45c0d53 100644 --- a/src/models/spirit.ts +++ b/src/models/spirit.ts @@ -1,5 +1,5 @@ import { ObjectId } from 'mongodb' -import { SpiritType } from '../types' +import { SpiritType, SpiritVariant, Ingredient, Vintage } from '../types' import { Alpha2Code } from 'i18n-iso-countries' import { CurrencyCode } from 'currency-codes-ts/dist/types' @@ -13,12 +13,11 @@ export class Spirit { public name: string, // label public producerId: ObjectId, // product producer public type: SpiritType, // spirit type - // TODO: add SpiritVariant type - public variant: string, // vodka, rum, liqueur cream, etc - public ingredients: string[], // an array of ingredients(flavouring) + public variant: SpiritVariant, // vodka, rum, liqueur cream, etc + public ingredients: Ingredient[], // an array of ingredients(flavouring) public alcohol: number, // alcohol percentage - public standardDrinks: number, // number representing an amount of standard drinks per bottle - public vintage: string, // year, nv (non-vintage) or mv (multi-vintage) + public standardDrinks100ml: number, // number representing an amount of standard drinks per bottle + public vintage: Vintage, // year, nv (non-vintage) or mv (multi-vintage) public RRPamount: number, // 20 public RRPcurrency: CurrencyCode, // USD public description: string, // detailed description of the product diff --git a/src/models/wine.ts b/src/models/wine.ts index 9a9ebc5..1bc19cb 100644 --- a/src/models/wine.ts +++ b/src/models/wine.ts @@ -1,5 +1,5 @@ import { ObjectId } from 'mongodb' -import { WineType, Viticulture, BottleClosure } from '../types' +import { WineType, Viticulture, BottleClosure, Vintage } from '../types' import { Alpha2Code } from 'i18n-iso-countries' import { CurrencyCode } from 'currency-codes-ts/dist/types' @@ -16,9 +16,9 @@ export class Wine { public name: string, // label public producerId: ObjectId, // product producer public varietal: string, // if more than one, list as 'blend' - public vintage: string, // year, nv (non-vintage) or mv (multi-vintage) + public vintage: Vintage, // year, nv (non-vintage) or mv (multi-vintage) public alcohol: number, // alcohol percentage - public standardDrinks: number, // number representing an amount of standard drinks per bottle + public standardDrinks100ml: number, // number representing an amount of standard drinks per bottle public viticulture: Viticulture, // two-letter country codes public sulfites: number, // parts per million public filtered: boolean, // is wine filtered (fined (egg or fish)) diff --git a/src/types/coffee.ts b/src/types/coffee.ts new file mode 100644 index 0000000..b212920 --- /dev/null +++ b/src/types/coffee.ts @@ -0,0 +1,38 @@ +export type CoffeeProcessingType = + | 'de-caff' + | 'honey' + | 'semi-dry' + | 'swiss water' + | 'sundried' + | 'washed' + +type CoffeeVarietyType = 'Robusta' | 'Arabica' + +type ArabicaVarietyKind = + | 'Typica' + | 'Bourbon' + | 'Caturra' + | 'Geisha' + | 'SL28' + | 'SL34' + | 'Maragogype' + | 'Pacas' + | 'Pacamara' + | 'Kona' + +type RobustaVarietyKind = + | 'Congolese' + | 'Nganda' + | 'Kouillou' + | 'Vietnamese Robusta' + +export type CoffeeVariety = { + [key in CoffeeVarietyType]?: ArabicaVarietyKind | RobustaVarietyKind +} + +export type CoffeeRoast = + | 'Light' + | 'Medium' + | 'Medium-Dark' + | 'Dark' + | 'Very Dark' diff --git a/src/types/index.ts b/src/types/index.ts index 19a0935..36fa0a5 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,8 @@ export * from './database' export * from './routes' -export * from './products' +export * from './product' export * from './user' +export * from './wine' +export * from './sake' +export * from './spirit' +export * from './coffee' diff --git a/src/types/product.ts b/src/types/product.ts new file mode 100644 index 0000000..653a622 --- /dev/null +++ b/src/types/product.ts @@ -0,0 +1,64 @@ +export type Availability = 'in stock' | 'out of stock' | 'discontinued' + +export type Ingredient = + | 'Blanche' + | 'Anise' + | 'Fennel' + | 'Hyssop' + | 'Mint' + | 'Citrus Peel' + | 'Coriander Seeds' + | 'Angelica Root' + | 'Cinnamon' + | 'Clove' + | 'Wheat' + | 'Rye' + | 'Corn' + | 'Potato' + | 'Barley' + | 'Sugarcane' + | 'Fruits' + | 'Grains' + | 'Juniper' + | 'Coriander' + | 'Lemon peel' + | 'Orange peel' + | 'Orris root' + | 'Cassia bark' + | 'Licorice root' + | 'Grapefruit peel' + | 'Elderflower' + | 'Apple' + | 'Blackcurrant' + | 'Butterscotch' + | 'Peach' + | 'Pear' + | 'Plum' + | 'Raspberries' + | 'Sorghum' + | 'Rice' + | 'Millet' + | 'Brown sugar' + | 'Buckwheat' + | 'Sweet Potato' + | 'Oat' + | 'Egg (Advocaat)' + | 'Strawberry' + | 'Almond' + | 'Banana' + | 'Chocolate' + | 'Sour Cherry' + | 'Violet' + | 'Lemon' + | 'Melon' + | 'Orange' + | 'Raspberry' + | 'Yuzu' + | 'Almond' + | 'Apricot Kernel' + | 'Hazelnut' + | 'Peanut' + | 'Pecan' + | 'Walnut' + +export type Vintage = number | 'nv' | 'mv' diff --git a/src/types/products.ts b/src/types/products.ts deleted file mode 100644 index 5652fe9..0000000 --- a/src/types/products.ts +++ /dev/null @@ -1,25 +0,0 @@ -export type WineType = 'white' | 'amber' | 'rose' | 'red' - -export type Viticulture = 'biodynamic' | 'organic' | 'conventional' - -export type BottleClosure = 'cork' | 'crown-seal' | 'screwcap' - -export type Availability = 'in stock' | 'out of stock' | 'discontinued' - -export type SakeDesignation = - | 'table' - | 'pure' - | 'blended' - | 'mirin:new' - | 'mirin:true' - | 'mirin:salt' - -export type SpiritType = 'white' | 'dark' | 'liqueurs' - -export type CoffeeProcessingType = - | 'de-caff' - | 'honey' - | 'semi-dry' - | 'swiss water' - | 'sundried' - | 'washed' diff --git a/src/types/sake.ts b/src/types/sake.ts new file mode 100644 index 0000000..c23877f --- /dev/null +++ b/src/types/sake.ts @@ -0,0 +1,9 @@ +export type SakeDesignation = + | 'table' + | 'pure' + | 'blended' + | 'mirin:new' + | 'mirin:true' + | 'mirin:salt' + +export type SakeStarter = 'Kimoto' | 'Sokujō' | 'Yamahai' diff --git a/src/types/spirit.ts b/src/types/spirit.ts new file mode 100644 index 0000000..fe649aa --- /dev/null +++ b/src/types/spirit.ts @@ -0,0 +1,172 @@ +export type SpiritType = 'white' | 'dark' | 'liqueurs' + +export type SpiritVariant = + | 'Absinthe' + | 'Pastis' + | 'Vodka' + | 'Genever' + | 'Gin' + | 'Mezcal' + | 'Rum' + | 'Eau de Vie' + | 'Grappa' + | 'Baijiu' + | 'Soju' + | 'Absinthe' + | 'Brandy' + | 'Calvados' + | 'Chartreuse' + | 'Genever' + | 'Mezcal' + | 'Rum' + | 'Slivovitz' + | 'Whiskey' + | 'Amaro' + | 'Coffee' + | 'Cream' + | 'Creme' + | 'Flowers' + | 'Fruit' + | 'Herb' + | 'Honey' + | 'Nut' + +export interface WhiteSpiritKind { + Absinthe: ['Blanche'] + Pastis: [ + 'Anise', + 'Fennel', + 'Licorice Root', + 'Hyssop', + 'Mint', + 'Citrus Peel', + 'Coriander Seeds', + 'Angelica Root', + 'Cinnamon', + 'Clove' + ] + Vodka: [ + 'Wheat', + 'Rye', + 'Corn', + 'Potato', + 'Barley', + 'Sugarcane', + 'Fruits', + 'Grains' + ] + Genever: [ + { + Young: 'Juniper' + } + ] + Gin: [ + { + 'London Dry': [ + 'Juniper', + 'Coriander', + 'Angelica root', + 'Lemon peel', + 'Orange peel', + 'Orris root', + 'Cassia bark', + 'Licorice root', + 'Grapefruit peel', + 'Elderflower' + ] + }, + 'Plymouth' + ] + Mezcal: [{ Joven: ['espadín', 'tepeztate', 'Tequilana (blue)', 'tobalá'] }] + Rum: ['Blanco', 'Cachaça', 'Platino', 'Agricole'] + 'Eau de Vie': [ + 'Apple (Pomme)', + 'Blackcurrant (Kirsch)', + 'Butterscotch (Schnapps)', + 'Peach (Pêche, Schnapps)', + 'Pear (Poire William)', + 'Plum (Mirabelle, Slivovitz, Rakia)', + 'Raspberries (Framboise)' + ] + Grappa: ['Marc', 'Pisco'] + Baijiu: ['Sorghum', 'Wheat', 'Barley', 'Rice', 'Millet'] + Soju: ['Barley', 'Brown sugar', 'Buckwheat', 'Rice', 'Sweet Potato'] +} + +export interface DarkSpiritKind { + Absinthe: ['Jaune', 'Verte'] + Brandy: [ + { + Grape: [ + 'VS', + 'VSOP', + 'XO', + 'Beyond Age', + 'Solera', + 'Solera Reserva', + 'Solera Gran Reserva' + ] + } + ] + Calvados: ['Apple', 'Pear'] + Chartreuse: ['Green', 'Yellow'] + Genever: [{ Old: ['Juniper'] }, { Coren: ['Juniper'] }] + Mezcal: ['Reposado', 'Abuelo', 'Añejo', 'Extra Añejo'] + Rum: [ + { + Sugar: [ + 'Cachaca (amarela/ouro)', + 'Dark Rum', + 'Gold Rum', + 'Over-proof', + 'Premium', + 'Spiced' + ] + } + ] + Slivovitz: [] + Whiskey: ['Barley', 'Rye', 'Wheat', 'Corn', 'Oat', 'Rice'] +} + +export interface LiqueursSpiritKind { + Amaro: [] + Coffee: [] + Cream: [ + 'Egg (Advocaat)', + 'Amarula', + 'Rum', + 'Strawberry', + 'Whiskey (Baileys etc)' + ] + Creme: [ + 'Almond', + 'Banana', + 'Blackcurrant', + 'Chocolate', + 'Peach', + 'Sour Cherry', + 'Violet' + ] + Flowers: ['Rose', 'Violet', 'Elderflower'] + Fruit: [ + 'Blackcurrant', + 'Lemon', + 'Melon', + 'Orange', + 'Peach', + 'Plum', + 'Raspberry', + 'Yuzu' + ] + Herb: [ + 'Anise', + 'Dom Benedictine', + 'Bitters', + 'Ginger', + 'Jägermeister', + 'Metaxa', + 'Mint' + ] + Honey: ['Licor 43', 'Rum', 'Vodka', 'Whiskey'] + Nut: ['Almond', 'Apricot Kernel', 'Hazelnut', 'Peanut', 'Pecan', 'Walnut'] +} diff --git a/src/types/wine.ts b/src/types/wine.ts new file mode 100644 index 0000000..fabc693 --- /dev/null +++ b/src/types/wine.ts @@ -0,0 +1,5 @@ +export type WineType = 'white' | 'amber' | 'rose' | 'red' + +export type Viticulture = 'biodynamic' | 'organic' | 'conventional' + +export type BottleClosure = 'cork' | 'crown-seal' | 'screwcap'