32 lines
495 B
TypeScript
32 lines
495 B
TypeScript
import pool from 'backend/miscellaneous/db'
|
|
|
|
class UserD {
|
|
name?: string;
|
|
value?: string;
|
|
}
|
|
|
|
export enum values {
|
|
pass = 1,
|
|
omdb_key,
|
|
twitch_client_id,
|
|
twitch_client_secret,
|
|
}
|
|
|
|
|
|
function getValue(name: values): string | undefined {
|
|
try {
|
|
const rows = pool.query("SELECT name, value FROM userData where id = ?;").as(UserD).all(name);
|
|
if (rows.length > 0)
|
|
return rows[0].value;
|
|
}
|
|
catch (err) {
|
|
console.log(err);
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
export default {
|
|
getValue
|
|
};
|