absmach / magistrala

Industrial IoT Messaging and Device Management Platform

Home Page:https://www.abstractmachines.fr/magistrala.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Failure to fetch domains using status and permissions as query params.

wambui-pixel opened this issue · comments

What were you trying to achieve?

Fetching of Domains using both the status and permissions as queryparams

What are the expected results?

A list of domains with the specified status and permissions

What are the received results?

This is the error gotten on magistrala:

ERROR: missing FROM-clause entry for table "pc" at character 269 magistrala-auth-db | 2024-05-16 13:13:24.133 UTC [29] STATEMENT: SELECT d.id as id, d.name as name, d.tags as tags, d.alias as alias, d.metadata as metadata, d.created_at as created_at, d.updated_at as updated_at, d.updated_by as updated_by, d.created_by as created_by, d.status as status

Steps To Reproduce

No response

In what environment did you encounter the issue?

Magistrala New UI.

Running this code:-

const query = searchParams?.query || "";
  // const domainsPage = await GetDomains({
  let queryParams: PageMetadata = {
    offset: (page > 0 ? page - 1 : 0) * limit,
    limit,
    name: query.trim(),
    status: "enabled",
    permission: "administrator",
  }

  if (user.role === "administrator") {
    queryParams = {
      offset: (page > 0 ? page - 1 : 0) * limit,
      limit,
      name: query.trim(),
      status: "all",
    }
  }

  const domainsPage = await GetDomains({
    queryParams,
  });

ERROR: missing FROM-clause entry for table "pc" at character 269 magistrala-auth-db | 2024-05-16 13:13:24.133 UTC [29] STATEMENT: SELECT d.id as id, d.name as name, d.tags as tags, d.alias as alias, d.metadata as metadata, d.created_at as created_at, d.updated_at as updated_at, d.updated_by as updated_by, d.created_by as created_by, d.status as status

Additional information you deem important

No response