server: Implement color theme migration based on existing theme

This commit is contained in:
Elian Doran
2024-11-02 00:39:22 +02:00
parent 5c66e3fd04
commit 92c588dc98
2 changed files with 31 additions and 6 deletions

View File

@@ -3,6 +3,11 @@ import BOption from "../becca/entities/boption.js";
import { OptionRow } from '../becca/entities/rows.js';
import sql from "./sql.js";
/**
* A dictionary where the keys are the option keys (e.g. `theme`) and their corresponding values.
*/
export type OptionMap = Record<string | number, string>;
function getOptionOrNull(name: string): string | null {
let option;
@@ -82,7 +87,7 @@ function getOptions() {
}
function getOptionMap() {
const map: Record<string | number, string> = {};
const map: OptionMap = {};
for (const option of Object.values(becca.options)) {
map[option.name] = option.value;