Move responsability
This commit is contained in:
parent
54f2c825fc
commit
88fc133f45
|
@ -77,10 +77,6 @@ export async function save(ctx: UserCtx<SaveTableRequest, SaveTableResponse>) {
|
||||||
const renaming = ctx.request.body._rename
|
const renaming = ctx.request.body._rename
|
||||||
|
|
||||||
const api = pickApi({ table })
|
const api = pickApi({ table })
|
||||||
// do not pass _rename or _add if saving to CouchDB
|
|
||||||
if (api === internal) {
|
|
||||||
delete ctx.request.body._rename
|
|
||||||
}
|
|
||||||
let savedTable = await api.save(ctx, renaming)
|
let savedTable = await api.save(ctx, renaming)
|
||||||
if (!table._id) {
|
if (!table._id) {
|
||||||
savedTable = sdk.tables.enrichViewSchemas(savedTable)
|
savedTable = sdk.tables.enrichViewSchemas(savedTable)
|
||||||
|
|
|
@ -16,7 +16,7 @@ export async function save(
|
||||||
ctx: UserCtx<SaveTableRequest, SaveTableResponse>,
|
ctx: UserCtx<SaveTableRequest, SaveTableResponse>,
|
||||||
renaming?: RenameColumn
|
renaming?: RenameColumn
|
||||||
) {
|
) {
|
||||||
const { rows, ...rest } = ctx.request.body
|
const { _rename, rows, ...rest } = ctx.request.body
|
||||||
let tableToSave: Table = {
|
let tableToSave: Table = {
|
||||||
_id: generateTableID(),
|
_id: generateTableID(),
|
||||||
...rest,
|
...rest,
|
||||||
|
|
Loading…
Reference in New Issue