[api] Added typings for pricelist API

This commit is contained in:
Ferdinand Thiessen 2021-05-26 21:29:08 +02:00
parent 840fcb56d1
commit 0d277d2fa6
2 changed files with 62 additions and 5 deletions

View File

@ -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"
}
}

57
src/api.d.ts vendored Normal file
View File

@ -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<string>;
tags?: Array<Tag>;
type?: DrinkType;
volumes: Array<DrinkPriceVolume>;
}
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<MinPrices>;
prices: Array<DrinkPrice>;
ingredients: Array<Ingredient>;
}
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;
}
}