1
0
Fork 0
mirror of synced 2024-06-28 02:50:50 +12:00

Improvement from PR comments

This commit is contained in:
Pedro Silva 2022-10-20 15:31:10 +01:00
parent 50aaacb903
commit 312e766414
2 changed files with 6 additions and 10 deletions

View file

@ -49,10 +49,6 @@ export interface Table extends Document {
sourceId?: string sourceId?: string
relatedFormula?: string[] relatedFormula?: string[]
constrained?: string[] constrained?: string[]
_id?: string
_rev?: string
createdAt?: string
updatedAt?: string
indexes?: { [key: string]: any } indexes?: { [key: string]: any }
dataImport?: { [key: string]: any } dataImport?: { [key: string]: any }
} }

View file

@ -9,19 +9,19 @@ export default class RowsApi {
this.api = apiClient this.api = apiClient
} }
async getAll(id: string): Promise<[Response, Row[]]> { async getAll(tableId: string): Promise<[Response, Row[]]> {
const response = await this.api.get(`/${id}/rows`) const response = await this.api.get(`/${tableId}/rows`)
const json = await response.json() const json = await response.json()
return [response, json] return [response, json]
} }
async add(id: string, body: any): Promise<[Response, Row]> { async add(tableId: string, body: any): Promise<[Response, Row]> {
const response = await this.api.post(`/${id}/rows`, { body }) const response = await this.api.post(`/${tableId}/rows`, { body })
const json = await response.json() const json = await response.json()
return [response, json] return [response, json]
} }
async delete(id: string, body: any): Promise<[Response, Row[]]> { async delete(tableId: string, body: any): Promise<[Response, Row[]]> {
const response = await this.api.del(`/${id}/rows/`, { body }) const response = await this.api.del(`/${tableId}/rows/`, { body })
const json = await response.json() const json = await response.json()
return [response, json] return [response, json]
} }