Add required keys to the mappings.
This commit is contained in:
parent
16acf8751b
commit
276493e33d
|
@ -1,6 +1,7 @@
|
|||
import { Application } from "./types"
|
||||
import { RequiredKeys } from "@budibase/types"
|
||||
|
||||
function application(body: any): Application {
|
||||
function application(body: any): RequiredKeys<Application> {
|
||||
let app = body?.application ? body.application : body
|
||||
return {
|
||||
_id: app.appId,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Query, ExecuteQuery } from "./types"
|
||||
import { RequiredKeys } from "@budibase/types"
|
||||
|
||||
function query(body: any): Query {
|
||||
function query(body: any): RequiredKeys<Query> {
|
||||
return {
|
||||
_id: body._id,
|
||||
datasourceId: body.datasourceId,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Row, RowSearch } from "./types"
|
||||
import { RequiredKeys } from "@budibase/types"
|
||||
|
||||
function row(body: any): Row {
|
||||
function row(body: any): RequiredKeys<Row> {
|
||||
delete body._rev
|
||||
// have to input everything, since structure unknown
|
||||
return {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Table } from "./types"
|
||||
import { RequiredKeys } from "@budibase/types"
|
||||
|
||||
function table(body: any): Table {
|
||||
function table(body: any): RequiredKeys<Table> {
|
||||
return {
|
||||
_id: body._id,
|
||||
name: body.name,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { User } from "./types"
|
||||
import { RequiredKeys } from "@budibase/types"
|
||||
|
||||
function user(body: any): User {
|
||||
function user(body: any): RequiredKeys<User> {
|
||||
return {
|
||||
_id: body._id,
|
||||
email: body.email,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { View } from "./types"
|
||||
import { ViewV2, Ctx } from "@budibase/types"
|
||||
import { ViewV2, Ctx, RequiredKeys } from "@budibase/types"
|
||||
import { dataFilters } from "@budibase/shared-core"
|
||||
|
||||
function view(body: ViewV2): View {
|
||||
function view(body: ViewV2): RequiredKeys<View> {
|
||||
return {
|
||||
id: body.id,
|
||||
tableId: body.tableId,
|
||||
|
|
Loading…
Reference in New Issue