Add repoTemplates and issueTemplates stores and types

cgen-bd92d45792654082b0f922a19efec799
This commit is contained in:
Builder.io 2025-09-18 04:40:45 +00:00
parent 110cca7f75
commit ecf9f1b837

View file

@ -44,6 +44,20 @@ export interface FsHandleRecord {
handle: FileSystemDirectoryHandle; handle: FileSystemDirectoryHandle;
} }
export interface RepoTemplateRecord {
id: string;
name: string;
fsHandleId: string;
}
export interface IssueTemplateRecord {
id: string;
name: string;
title: string;
body: string;
labels: string[];
}
export async function openDB(): Promise<IDBDatabase> { export async function openDB(): Promise<IDBDatabase> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const req = indexedDB.open(DB_NAME, DB_VERSION); const req = indexedDB.open(DB_NAME, DB_VERSION);
@ -72,6 +86,12 @@ export async function openDB(): Promise<IDBDatabase> {
if (!db.objectStoreNames.contains("settings")) { if (!db.objectStoreNames.contains("settings")) {
db.createObjectStore("settings", { keyPath: "id" }); db.createObjectStore("settings", { keyPath: "id" });
} }
if (!db.objectStoreNames.contains("repoTemplates")) {
db.createObjectStore("repoTemplates", { keyPath: "id" });
}
if (!db.objectStoreNames.contains("issueTemplates")) {
db.createObjectStore("issueTemplates", { keyPath: "id" });
}
}; };
req.onsuccess = () => resolve(req.result); req.onsuccess = () => resolve(req.result);
req.onerror = () => reject(req.error); req.onerror = () => reject(req.error);