Reorganize app workspaces and align Admin architecture
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
const typeMap: Record<string, any> = {
|
||||
number: { type: 'integer', format: 'int64' },
|
||||
string: { type: 'string' },
|
||||
Date: { type: 'string', format: 'date-time' },
|
||||
boolean: { type: 'boolean' },
|
||||
}
|
||||
export async function modelToSchema(model: any) {
|
||||
const properties: Record<string, any> = {}
|
||||
for (const [key, meta] of model.$columnsDefinitions.entries()) {
|
||||
const tsType = meta.meta?.designType?.name || 'string'
|
||||
const mapped = typeMap[tsType] ?? { type: 'string' }
|
||||
properties[meta?.serializeAs || key] = {
|
||||
...mapped,
|
||||
description: key.replace(/([A-Z])/g, ' $1').trim(),
|
||||
}
|
||||
}
|
||||
return JSON.stringify(properties)
|
||||
}
|
||||
Reference in New Issue
Block a user