clean up user

This commit is contained in:
2026-03-17 14:44:20 +01:00
parent 661d5a2a77
commit ad1cb50d94
3 changed files with 5 additions and 28 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules/ node_modules/
output/ output/
*.sqlite *.sqlite
.vscode

View File

@@ -15,7 +15,8 @@ interface omdbRes {
function fromStringToTable(input: string | string[]): (Table | undefined) { function fromStringToTable(input: string | string[]): (Table | undefined) {
var value = ""; var value = "";
if (Array.isArray(input)) { if (Array.isArray(input)) {
value = input[0]; if (input.length > 0)
value = input[0];
} }
else { else {
value = input; value = input;

View File

@@ -12,7 +12,6 @@ export enum values {
twitch_client_secret, twitch_client_secret,
} }
const namesOfValues: string[] = ["", "pass", "omdb_key", "twitch_client_id", "twitch_client_secret"];
function getValue(name: values): string | undefined { function getValue(name: values): string | undefined {
try { try {
@@ -26,31 +25,7 @@ function getValue(name: values): string | undefined {
return; return;
} }
function updateValue(name: string, value: string): number {
try {
const result = pool.query("UPDATE userData SET value = ? WHERE name = ?").run(value, name);
return result.changes;
}
catch (err) {
console.log(err);
}
return 0;
}
function getAll(): UserD[] {
try {
const rows = pool.query("SELECT name, value FROM userData;").as(UserD).all();
return rows;
}
catch (err) {
console.log(err);
}
return [];
}
export default { export default {
getValue, getValue
updateValue,
getAll,
namesOfValues
}; };