From 0d277d2fa6449a0da20c4ef70c76707d77048ee6 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 26 May 2021 21:29:08 +0200 Subject: [PATCH] [api] Added typings for pricelist API --- package.json | 10 ++++----- src/api.d.ts | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 src/api.d.ts diff --git a/package.json b/package.json index 2e63349..320eed0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { - "private": true, "license": "MIT", "version": "1.0.0-alpha.1", "name": "@flaschengeist/pricelist", @@ -7,22 +6,23 @@ "homepage": "https://flaschengeist.dev/Flaschengeist", "description": "Flaschengeist pricelist plugin", "bugs": { - "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist/issues" + "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-pricelist/issues" }, "repository": { "type": "git", "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-pricelist" }, "main": "src/index.ts", + "types": "src/api.d.ts", "scripts": { - "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'", + "format": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'", "lint": "eslint --ext .js,.ts,.vue ./src" }, "dependencies": { "vuedraggable": "^4.0.1" }, "devDependencies": { - "@flaschengeist/types": "git+https://flaschengeist.dev/ferfissimo/flaschengeist-types.git#develop", + "@flaschengeist/types": "^1.0.0-alpha.1", "@quasar/app": "^3.0.0-beta.26", "@typescript-eslint/eslint-plugin": "^4.24.0", "@typescript-eslint/parser": "^4.24.0", @@ -42,7 +42,7 @@ "prettier": { "singleQuote": true, "semi": true, - "printWidth": 100, + "printWidth": 120, "arrowParens": "always" } } diff --git a/src/api.d.ts b/src/api.d.ts new file mode 100644 index 0000000..645bf29 --- /dev/null +++ b/src/api.d.ts @@ -0,0 +1,57 @@ +declare namespace FG { + interface Drink { + id: number; + article_id?: string; + package_size?: number; + name: string; + volume?: number; + cost_per_volume?: number; + cost_per_package?: number; + uuid: string; + receipt?: Array; + tags?: Array; + type?: DrinkType; + volumes: Array; + } + interface DrinkIngredient { + id: number; + volume: number; + ingredient_id: number; + } + interface DrinkPrice { + id: number; + price: number; + public: boolean; + description?: string; + } + interface DrinkPriceVolume { + id: number; + volume: number; + min_prices: Array; + prices: Array; + ingredients: Array; + } + interface DrinkType { + id: number; + name: string; + } + interface ExtraIngredient { + id: number; + name: string; + price: number; + } + interface Ingredient { + id: number; + drink_ingredient?: DrinkIngredient; + extra_ingredient?: ExtraIngredient; + } + interface MinPrices { + percentage: number; + price: number; + } + interface Tag { + id: number; + name: string; + color: string; + } +}