Type query fields

This commit is contained in:
Adria Navarro 2025-03-26 09:48:46 +01:00
parent 7d8476b7b0
commit 561add01c2
2 changed files with 22 additions and 2 deletions

View File

@ -764,7 +764,7 @@ if (descriptions.length) {
const verbs = ["read", "create", "update", "delete"]
for (const verb of verbs) {
const query = await createQuery({
fields: { json: {}, extra: { actionType: "invalid" } },
fields: { json: {}, extra: { actionType: "invalid" as any } },
queryVerb: verb,
})
await config.api.query.execute(query._id!, undefined, { status: 400 })

View File

@ -12,7 +12,7 @@ export interface Query extends Document {
datasourceId: string
name: string
parameters: QueryParameter[]
fields: RestQueryFields
fields: RestQueryFields & SQLQueryFields & MongoQueryFields
transformer: string | null
schema: Record<string, QuerySchema | string>
nestedSchemaFields?: Record<string, Record<string, QuerySchema | string>>
@ -60,9 +60,29 @@ export interface RestQueryFields {
authConfigType?: RestAuthType
pagination?: PaginationConfig
paginationValues?: PaginationValues
}
export interface SQLQueryFields {
sql?: string
}
export interface MongoQueryFields {
extra?: {
collection?: string
actionType:
| "findOne"
| "find"
| "updateOne"
| "updateMany"
| "findOneAndUpdate"
| "count"
| "distinct"
| "insertOne"
| "deleteOne"
| "deleteMany"
}
json?: object | string
}
export interface PaginationConfig {
type: string
location: string