Enrich view columns
This commit is contained in:
parent
68678235d6
commit
30e31e1254
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
FieldSchema,
|
||||||
FieldType,
|
FieldType,
|
||||||
RelationSchemaField,
|
RelationSchemaField,
|
||||||
RenameColumn,
|
RenameColumn,
|
||||||
|
@ -176,7 +177,7 @@ export async function enrichSchema(
|
||||||
}
|
}
|
||||||
const relTable = tableCache[tableId]
|
const relTable = tableCache[tableId]
|
||||||
|
|
||||||
const result: Record<string, RelationSchemaField> = {}
|
const result: Record<string, FieldSchema & RelationSchemaField> = {}
|
||||||
|
|
||||||
for (const relTableFieldName of Object.keys(relTable.schema)) {
|
for (const relTableFieldName of Object.keys(relTable.schema)) {
|
||||||
const relTableField = relTable.schema[relTableFieldName]
|
const relTableField = relTable.schema[relTableFieldName]
|
||||||
|
@ -191,6 +192,7 @@ export async function enrichSchema(
|
||||||
const isVisible = !!viewFields[relTableFieldName]?.visible
|
const isVisible = !!viewFields[relTableFieldName]?.visible
|
||||||
const isReadonly = !!viewFields[relTableFieldName]?.readonly
|
const isReadonly = !!viewFields[relTableFieldName]?.readonly
|
||||||
result[relTableFieldName] = {
|
result[relTableFieldName] = {
|
||||||
|
...relTableField,
|
||||||
visible: isVisible,
|
visible: isVisible,
|
||||||
readonly: isReadonly,
|
readonly: isReadonly,
|
||||||
}
|
}
|
||||||
|
@ -211,6 +213,7 @@ export async function enrichSchema(
|
||||||
...tableSchema[key],
|
...tableSchema[key],
|
||||||
...ui,
|
...ui,
|
||||||
order: anyViewOrder ? ui?.order ?? undefined : tableSchema[key].order,
|
order: anyViewOrder ? ui?.order ?? undefined : tableSchema[key].order,
|
||||||
|
columns: undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schema[key].type === FieldType.LINK) {
|
if (schema[key].type === FieldType.LINK) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { FieldSchema, RelationSchemaField, ViewV2 } from "../documents"
|
||||||
export interface ViewV2Enriched extends ViewV2 {
|
export interface ViewV2Enriched extends ViewV2 {
|
||||||
schema?: {
|
schema?: {
|
||||||
[key: string]: FieldSchema & {
|
[key: string]: FieldSchema & {
|
||||||
columns?: Record<string, RelationSchemaField>
|
columns?: Record<string, FieldSchema & RelationSchemaField>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue