Convert UserFetch

This commit is contained in:
Adria Navarro 2025-01-02 13:38:38 +01:00
parent c7255362b0
commit 54d5047b34
1 changed files with 8 additions and 3 deletions

View File

@ -2,9 +2,10 @@ import { get } from "svelte/store"
import DataFetch from "./DataFetch.js"
import { TableNames } from "../constants"
import { utils } from "@budibase/shared-core"
import { Table, UIFetchAPI } from "@budibase/types"
export default class UserFetch extends DataFetch {
constructor(opts) {
export default class UserFetch extends DataFetch<{ tableId: string }, {}> {
constructor(opts: { API: UIFetchAPI; datasource: Table; options?: {} }) {
super({
...opts,
datasource: {
@ -27,12 +28,16 @@ export default class UserFetch extends DataFetch {
}
}
getSchema(_datasource: any, definition: Table | null) {
return definition?.schema
}
async getData() {
const { limit, paginate } = this.options
const { cursor, query } = get(this.store)
// Convert old format to new one - we now allow use of the lucene format
const { appId, paginated, ...rest } = query || {}
const { appId, paginated, ...rest } = query || ({} as any) // TODO
const finalQuery = utils.isSupportedUserSearch(rest)
? query
: { string: { email: null } }