feat: integrate barcode scanning functionality and enhance Appwrite setup
- Added a new `barcode_products` collection to the Appwrite setup for managing barcode data. - Implemented barcode scanning feature with a dedicated modal for scanning and adding products. - Introduced new components for barcode product preview and management. - Updated the setup script to seed verified barcode products from a JSON file. - Enhanced the application state management to handle barcode-related actions and user interactions.
This commit is contained in:
@@ -34,6 +34,57 @@ export type EntryDraft = Omit<
|
||||
source?: RedBullEntry["source"];
|
||||
};
|
||||
|
||||
export type BarcodeFormatName = "ean-13" | "ean-8" | "upc-a" | "upc-e" | "unknown";
|
||||
|
||||
export type BarcodeProductDraft = {
|
||||
flavourName: string;
|
||||
sizeMl: number;
|
||||
pricePerCan: number;
|
||||
sugarFree?: boolean;
|
||||
caffeineMgPerCan?: number;
|
||||
};
|
||||
|
||||
export type ResolvedBarcodeProduct = BarcodeProductDraft & {
|
||||
flavourAccent: string;
|
||||
source: "built-in" | "user";
|
||||
};
|
||||
|
||||
export type BarcodeSeedProduct = BarcodeProductDraft & {
|
||||
verifiedBy: string;
|
||||
sourceName?: string;
|
||||
sourceUrl?: string;
|
||||
notes?: string;
|
||||
variant?: string;
|
||||
};
|
||||
|
||||
export type UserBarcodeMapping = BarcodeProductDraft & {
|
||||
barcode: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type BarcodeLookupCatalog = {
|
||||
verifiedProducts?: Record<string, BarcodeSeedProduct>;
|
||||
userMappings?: UserBarcodeMapping[];
|
||||
};
|
||||
|
||||
export type BarcodeLookupResult =
|
||||
| {
|
||||
status: "known" | "user";
|
||||
barcode: string;
|
||||
product: ResolvedBarcodeProduct;
|
||||
}
|
||||
| {
|
||||
status: "partial";
|
||||
barcode: string;
|
||||
product: BarcodeProductDraft;
|
||||
reason: string;
|
||||
}
|
||||
| {
|
||||
status: "unknown";
|
||||
barcode: string;
|
||||
};
|
||||
|
||||
export type Filters = {
|
||||
flavour: string;
|
||||
dateRange: DateFilter;
|
||||
|
||||
Reference in New Issue
Block a user