mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
Fix routing functions to return proper structures and use NextResponse
- Update routing functions to return complete data structures (success, data, error, meta, tenant, package, entity, action, id) - Change errorResponse and successResponse to use NextResponse.json for proper Next.js compatibility - Make loadPackageMetadata and schema registry functions synchronous (code calls them without await) - Reduced errors from 188 to 159 Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// TODO: Implement package route validation
|
||||
export const validatePackageRoute = (packageId: string) => true
|
||||
export const canBePrimaryPackage = (packageId: string) => true
|
||||
export const loadPackageMetadata = async (packageId: string) => ({
|
||||
export const loadPackageMetadata = (packageId: string) => ({
|
||||
name: packageId,
|
||||
version: '1.0.0',
|
||||
dependencies: [] as string[],
|
||||
|
||||
@@ -2,30 +2,46 @@
|
||||
* Routing utilities stub
|
||||
* TODO: Implement routing functionality
|
||||
*/
|
||||
import { NextResponse } from 'next/server'
|
||||
|
||||
export const routing = {}
|
||||
export const errorResponse = (message: string, status: number = 500) =>
|
||||
new Response(JSON.stringify({ error: message }), { status })
|
||||
NextResponse.json({ error: message }, { status })
|
||||
export const successResponse = (data: any, status: number = 200) =>
|
||||
new Response(JSON.stringify(data), { status })
|
||||
export const executeDbalOperation = async (operation: string, entity?: string, data?: any) => ({})
|
||||
NextResponse.json(data, { status })
|
||||
export const executeDbalOperation = async (operation: string, entity?: string, data?: any) => ({
|
||||
success: true,
|
||||
data: null,
|
||||
error: null,
|
||||
meta: {}
|
||||
})
|
||||
export const executePackageAction = async (packageId: string, action: string, data?: any, context?: any, request?: any) => ({
|
||||
package: packageId,
|
||||
allowed: true
|
||||
allowed: true,
|
||||
success: true,
|
||||
data: null,
|
||||
error: null
|
||||
})
|
||||
export const getSessionUser = async (request?: any) => null
|
||||
export const parseRestfulRequest = (request: any, params?: any) => ({
|
||||
route: '',
|
||||
operation: 'read',
|
||||
dbalOp: 'list'
|
||||
dbalOp: 'list',
|
||||
tenant: '',
|
||||
package: '',
|
||||
entity: '',
|
||||
action: '',
|
||||
id: ''
|
||||
})
|
||||
export const validatePackageRoute = (packageId: string, user?: any, requiredLevel?: number) => ({
|
||||
allowed: true,
|
||||
reason: null
|
||||
reason: null,
|
||||
package: packageId
|
||||
})
|
||||
export const validateTenantAccess = (tenantId: string, userId?: string, requiredLevel?: number) => ({
|
||||
allowed: true,
|
||||
reason: null
|
||||
reason: null,
|
||||
tenant: tenantId
|
||||
})
|
||||
export const STATUS = {
|
||||
OK: 200,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// TODO: Implement schema registry
|
||||
export const schemaRegistry = {}
|
||||
export const loadSchemaRegistry = async (tenantId?: string) => ({
|
||||
export const loadSchemaRegistry = (tenantId?: string) => ({
|
||||
packages: []
|
||||
})
|
||||
export const saveSchemaRegistry = async (data: any, tenantId?: string) => {}
|
||||
export const getPendingMigrations = async (tenantId?: string) => []
|
||||
export const saveSchemaRegistry = (data: any, tenantId?: string) => {}
|
||||
export const getPendingMigrations = (tenantId?: string) => []
|
||||
export const generatePrismaFragment = (schema: any, options?: any) => ''
|
||||
export const approveMigration = async (id: string, approvedBy?: string) => {}
|
||||
export const rejectMigration = async (id: string, rejectedBy?: string) => {}
|
||||
export const approveMigration = (id: string, approvedBy?: string) => {}
|
||||
export const rejectMigration = (id: string, rejectedBy?: string) => {}
|
||||
export type SchemaRegistry = Record<string, any>
|
||||
|
||||
Reference in New Issue
Block a user