feat: more work on stores
This commit is contained in:
@ -56,7 +56,7 @@ export const db = await openDB<TCDB>("tc", 1, {
|
||||
export async function syncStores() {
|
||||
const changes = await Promise.all(await db.getAll("changes").then(changes => changes.map(async change => {
|
||||
const storeData = await db.get("stores", change.id);
|
||||
return { id: change.id, operation: change.operation, data: storeData?.data || null, modified_at: storeData?.modified_at || new Date().toISOString() };
|
||||
return { id: change.id, operation: change.operation, data: storeData?.data || null, modified_at: storeData?.modified_at || new Date().toISOString(), type: storeData?.type || "location", name: storeData?.name || "" };
|
||||
})));
|
||||
const stores = await db.getAll("stores").then(stores => stores.map(store => ({ id: store.id, modified_at: store.modified_at })));
|
||||
const res = await authFetch(LNV_SERVER + "/stores/sync", {
|
||||
@ -92,7 +92,7 @@ async function createStore(info: StoreInfo, data: object) {
|
||||
const id = crypto.randomUUID();
|
||||
const store: Store = {
|
||||
id,
|
||||
name: info.name,
|
||||
name: info.name, // TODO: do we need a name?
|
||||
type: info.type,
|
||||
owner_id: "", // TODO
|
||||
data: JSON.stringify(data),
|
||||
|
||||
Reference in New Issue
Block a user