16 lines
498 B
TypeScript
16 lines
498 B
TypeScript
import type { Database } from "../client.js";
|
|
import { websiteSettings } from "../schema/website-settings.js";
|
|
import type { SettingRow } from "@atomcms/settings";
|
|
|
|
export function makeSettingsRepo(db: Database) {
|
|
return {
|
|
// Shaped to match @atomcms/settings SettingsFetcher.
|
|
all: async (): Promise<SettingRow[]> => {
|
|
const rows = await db
|
|
.select({ key: websiteSettings.key, value: websiteSettings.value })
|
|
.from(websiteSettings);
|
|
return rows;
|
|
},
|
|
};
|
|
}
|