Infrastructure: Implement master/dev/vX branching, save git path, and fix username casing
This commit is contained in:
41
frontend/lib/db.ts
Normal file
41
frontend/lib/db.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import Dexie, { Table } from 'dexie';
|
||||
|
||||
export interface Item {
|
||||
id?: number;
|
||||
barcode: string;
|
||||
name: string;
|
||||
category: string;
|
||||
part_number?: string;
|
||||
color?: string;
|
||||
specs?: string;
|
||||
quantity: number;
|
||||
min_quantity: number;
|
||||
image_url?: string;
|
||||
labels_data?: string;
|
||||
}
|
||||
|
||||
export interface PendingOperation {
|
||||
id?: number;
|
||||
type: 'CHECK_IN' | 'CHECK_OUT' | 'TRASH';
|
||||
barcode: string;
|
||||
quantity: number;
|
||||
timestamp: number;
|
||||
synced: 0 | 1; // 0 for false, 1 for true
|
||||
uuid: string;
|
||||
details?: string;
|
||||
}
|
||||
|
||||
export class InventoryDatabase extends Dexie {
|
||||
items!: Table<Item>;
|
||||
pendingOperations!: Table<PendingOperation>;
|
||||
|
||||
constructor() {
|
||||
super('InventoryDatabase');
|
||||
this.version(3).stores({
|
||||
items: '++id, barcode, name, category, part_number, color',
|
||||
pendingOperations: '++id, barcode, timestamp, synced, uuid'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const db = new InventoryDatabase();
|
||||
Reference in New Issue
Block a user