feat(shopping): Repository-Skeleton mit Types
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m16s
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m16s
This commit is contained in:
67
src/lib/server/shopping/repository.ts
Normal file
67
src/lib/server/shopping/repository.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import type Database from 'better-sqlite3';
|
||||||
|
|
||||||
|
export type ShoppingCartRecipe = {
|
||||||
|
recipe_id: number;
|
||||||
|
title: string;
|
||||||
|
image_path: string | null;
|
||||||
|
servings: number;
|
||||||
|
servings_default: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ShoppingListRow = {
|
||||||
|
name_key: string;
|
||||||
|
unit_key: string;
|
||||||
|
display_name: string;
|
||||||
|
display_unit: string | null;
|
||||||
|
total_quantity: number | null;
|
||||||
|
from_recipes: string;
|
||||||
|
checked: 0 | 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ShoppingListSnapshot = {
|
||||||
|
recipes: ShoppingCartRecipe[];
|
||||||
|
rows: ShoppingListRow[];
|
||||||
|
uncheckedCount: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function addRecipeToCart(
|
||||||
|
_db: Database.Database,
|
||||||
|
_recipeId: number,
|
||||||
|
_profileId: number | null,
|
||||||
|
_servings?: number
|
||||||
|
): void {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeRecipeFromCart(_db: Database.Database, _recipeId: number): void {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setCartServings(
|
||||||
|
_db: Database.Database,
|
||||||
|
_recipeId: number,
|
||||||
|
_servings: number
|
||||||
|
): void {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listShoppingList(_db: Database.Database): ShoppingListSnapshot {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toggleCheck(
|
||||||
|
_db: Database.Database,
|
||||||
|
_nameKey: string,
|
||||||
|
_unitKey: string,
|
||||||
|
_checked: boolean
|
||||||
|
): void {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearCheckedItems(_db: Database.Database): void {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearCart(_db: Database.Database): void {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user