mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 14:54:55 +00:00
config: nextjs,frontends,index (5 files)
This commit is contained in:
4
frontends/nextjs/.env.example
Normal file
4
frontends/nextjs/.env.example
Normal file
@@ -0,0 +1,4 @@
|
||||
# Database connection URL
|
||||
# For SQLite (default): file:./dev.db
|
||||
# For PostgreSQL: postgresql://user:password@localhost:5432/metabuilder
|
||||
DATABASE_URL="file:./dev.db"
|
||||
@@ -3,9 +3,6 @@
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"prisma": {
|
||||
"schema": "../../prisma/schema.prisma"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build --webpack",
|
||||
|
||||
@@ -20,6 +20,7 @@ export * from './pages'
|
||||
export * from './schemas'
|
||||
export * from './comments'
|
||||
export * from './app-config'
|
||||
export * from './system-config'
|
||||
export * from './components'
|
||||
export * from './css-classes'
|
||||
export * from './dropdown-configs'
|
||||
@@ -42,6 +43,7 @@ import * as pages from './pages'
|
||||
import * as schemas from './schemas'
|
||||
import * as comments from './comments'
|
||||
import * as appConfig from './app-config'
|
||||
import * as systemConfig from './system-config'
|
||||
import * as components from './components'
|
||||
import * as cssClasses from './css-classes'
|
||||
import * as dropdownConfigs from './dropdown-configs'
|
||||
@@ -121,6 +123,9 @@ export class Database {
|
||||
static getAppConfig = appConfig.getAppConfig
|
||||
static setAppConfig = appConfig.setAppConfig
|
||||
|
||||
// System Config
|
||||
static getSystemConfigValue = systemConfig.getSystemConfigValue
|
||||
|
||||
// Components
|
||||
static getComponentHierarchy = components.getComponentHierarchy
|
||||
static setComponentHierarchy = components.setComponentHierarchy
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { getAdapter } from '../dbal-client'
|
||||
|
||||
/**
|
||||
* Fetch a SystemConfig value by key.
|
||||
*/
|
||||
export async function getSystemConfigValue(key: string): Promise<string | null> {
|
||||
const adapter = getAdapter()
|
||||
const config = await adapter.findFirst('SystemConfig', {
|
||||
where: { key },
|
||||
}) as { value?: string } | null
|
||||
|
||||
return typeof config?.value === 'string' ? config.value : null
|
||||
}
|
||||
1
frontends/nextjs/src/lib/db/system-config/index.ts
Normal file
1
frontends/nextjs/src/lib/db/system-config/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { getSystemConfigValue } from './get-system-config-value'
|
||||
Reference in New Issue
Block a user