Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 11d2f22

Browse files
committed
CQL: Apply lint fixes [skip ci]
1 parent fe9fd19 commit 11d2f22

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

src/core/database/database.ts

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ const uid = userInfo().uid;
1313
export let db: Database;
1414

1515
try {
16-
const databasePath = path.join(dataFolder, "dockstatapi.db");
17-
console.log("Database path:", databasePath);
18-
console.log(`Running as: ${username} (${uid}:${gid})`);
16+
const databasePath = path.join(dataFolder, "dockstatapi.db");
17+
console.log("Database path:", databasePath);
18+
console.log(`Running as: ${username} (${uid}:${gid})`);
1919

20-
if (!existsSync(dataFolder)) {
21-
await mkdir(dataFolder, { recursive: true, mode: 0o777 });
22-
console.log("Created data directory:", dataFolder);
23-
}
20+
if (!existsSync(dataFolder)) {
21+
await mkdir(dataFolder, { recursive: true, mode: 0o777 });
22+
console.log("Created data directory:", dataFolder);
23+
}
2424

25-
db = new Database(databasePath, { create: true });
26-
console.log("Database opened successfully");
25+
db = new Database(databasePath, { create: true });
26+
console.log("Database opened successfully");
2727

28-
db.exec("PRAGMA journal_mode = WAL;");
28+
db.exec("PRAGMA journal_mode = WAL;");
2929
} catch (error) {
30-
console.error(`Cannot start DockStatAPI: ${error}`);
31-
process.exit(500);
30+
console.error(`Cannot start DockStatAPI: ${error}`);
31+
process.exit(500);
3232
}
3333

3434
export function init() {
35-
db.exec(`
35+
db.exec(`
3636
CREATE TABLE IF NOT EXISTS backend_log_entries (
3737
timestamp STRING NOT NULL,
3838
level TEXT NOT NULL,
@@ -105,11 +105,11 @@ export function init() {
105105
)
106106
`);
107107

108-
const themeRows = db
109-
.prepare("SELECT COUNT(*) AS count FROM themes")
110-
.get() as { count: number };
108+
const themeRows = db
109+
.prepare("SELECT COUNT(*) AS count FROM themes")
110+
.get() as { count: number };
111111

112-
const defaultCss = `
112+
const defaultCss = `
113113
.root,
114114
#root,
115115
#docs-root {
@@ -131,42 +131,42 @@ export function init() {
131131
}
132132
`;
133133

134-
if (themeRows.count === 0) {
135-
db.prepare(
136-
"INSERT INTO themes (name, creator, vars, tags) VALUES (?,?,?,?)",
137-
).run("default", "Its4Nik", defaultCss, "[default]");
138-
}
139-
140-
const configRow = db
141-
.prepare("SELECT COUNT(*) AS count FROM config")
142-
.get() as { count: number };
143-
144-
if (configRow.count === 0) {
145-
db.prepare(
146-
"INSERT INTO config (keep_data_for, fetching_interval) VALUES (7, 5)",
147-
).run();
148-
}
149-
150-
const hostRow = db
151-
.prepare("SELECT COUNT(*) AS count FROM docker_hosts")
152-
.get() as { count: number };
153-
154-
if (hostRow.count === 0) {
155-
db.prepare(
156-
"INSERT INTO docker_hosts (name, hostAddress, secure) VALUES (?, ?, ?)",
157-
).run("Localhost", "localhost:2375", false);
158-
}
159-
160-
const storeRow = db
161-
.prepare("SELECT COUNT(*) AS count FROM store_repos")
162-
.get() as { count: number };
163-
164-
if (storeRow.count === 0) {
165-
db.prepare("INSERT INTO store_repos (slug, base) VALUES (?, ?)").run(
166-
"DockStacks",
167-
"https://raw.githubusercontent.com/Its4Nik/DockStacks/refs/heads/main/Index.json",
168-
);
169-
}
134+
if (themeRows.count === 0) {
135+
db.prepare(
136+
"INSERT INTO themes (name, creator, vars, tags) VALUES (?,?,?,?)",
137+
).run("default", "Its4Nik", defaultCss, "[default]");
138+
}
139+
140+
const configRow = db
141+
.prepare("SELECT COUNT(*) AS count FROM config")
142+
.get() as { count: number };
143+
144+
if (configRow.count === 0) {
145+
db.prepare(
146+
"INSERT INTO config (keep_data_for, fetching_interval) VALUES (7, 5)",
147+
).run();
148+
}
149+
150+
const hostRow = db
151+
.prepare("SELECT COUNT(*) AS count FROM docker_hosts")
152+
.get() as { count: number };
153+
154+
if (hostRow.count === 0) {
155+
db.prepare(
156+
"INSERT INTO docker_hosts (name, hostAddress, secure) VALUES (?, ?, ?)",
157+
).run("Localhost", "localhost:2375", false);
158+
}
159+
160+
const storeRow = db
161+
.prepare("SELECT COUNT(*) AS count FROM store_repos")
162+
.get() as { count: number };
163+
164+
if (storeRow.count === 0) {
165+
db.prepare("INSERT INTO store_repos (slug, base) VALUES (?, ?)").run(
166+
"DockStacks",
167+
"https://raw.githubusercontent.com/Its4Nik/DockStacks/refs/heads/main/Index.json",
168+
);
169+
}
170170
}
171171

172172
init();

0 commit comments

Comments
 (0)