Handle primaryDisplay on controller
This commit is contained in:
parent
3d2954e1d5
commit
398cf99b4f
|
@ -66,13 +66,14 @@ export async function create(ctx: Ctx<CreateViewRequest, ViewResponse>) {
|
||||||
|
|
||||||
const schemaUI = await parseSchemaUI(ctx, view)
|
const schemaUI = await parseSchemaUI(ctx, view)
|
||||||
|
|
||||||
const parsedView: Omit<ViewV2, "id" | "version"> = {
|
const parsedView: Omit<RequiredKeys<ViewV2>, "id" | "version"> = {
|
||||||
name: view.name,
|
name: view.name,
|
||||||
tableId: view.tableId,
|
tableId: view.tableId,
|
||||||
query: view.query,
|
query: view.query,
|
||||||
sort: view.sort,
|
sort: view.sort,
|
||||||
columns: view.schema && Object.keys(view.schema),
|
columns: view.schema && Object.keys(view.schema),
|
||||||
schemaUI,
|
schemaUI,
|
||||||
|
primaryDisplay: view.primaryDisplay,
|
||||||
}
|
}
|
||||||
const result = await sdk.views.create(tableId, parsedView)
|
const result = await sdk.views.create(tableId, parsedView)
|
||||||
ctx.status = 201
|
ctx.status = 201
|
||||||
|
@ -95,7 +96,7 @@ export async function update(ctx: Ctx<UpdateViewRequest, ViewResponse>) {
|
||||||
const { tableId } = view
|
const { tableId } = view
|
||||||
|
|
||||||
const schemaUI = await parseSchemaUI(ctx, view)
|
const schemaUI = await parseSchemaUI(ctx, view)
|
||||||
const parsedView: ViewV2 = {
|
const parsedView: RequiredKeys<ViewV2> = {
|
||||||
id: view.id,
|
id: view.id,
|
||||||
name: view.name,
|
name: view.name,
|
||||||
version: view.version,
|
version: view.version,
|
||||||
|
@ -104,6 +105,7 @@ export async function update(ctx: Ctx<UpdateViewRequest, ViewResponse>) {
|
||||||
sort: view.sort,
|
sort: view.sort,
|
||||||
columns: view.schema && Object.keys(view.schema),
|
columns: view.schema && Object.keys(view.schema),
|
||||||
schemaUI,
|
schemaUI,
|
||||||
|
primaryDisplay: view.primaryDisplay,
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await sdk.views.update(tableId, parsedView)
|
const result = await sdk.views.update(tableId, parsedView)
|
||||||
|
|
Loading…
Reference in New Issue