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/
output/
*.sqlite
.vscode

View File

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

View File

@@ -12,7 +12,6 @@ export enum values {
twitch_client_secret,
}
const namesOfValues: string[] = ["", "pass", "omdb_key", "twitch_client_id", "twitch_client_secret"];
function getValue(name: values): string | undefined {
try {
@@ -26,31 +25,7 @@ function getValue(name: values): string | undefined {
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 {
getValue,
updateValue,
getAll,
namesOfValues
getValue
};