(
spaceUuids: string[],
filters?: {
recentlyUpdated?: boolean;
mostPopular?: boolean;
},
)
| 695 | } |
| 696 | |
| 697 | async getSpaceQueries( |
| 698 | spaceUuids: string[], |
| 699 | filters?: { |
| 700 | recentlyUpdated?: boolean; |
| 701 | mostPopular?: boolean; |
| 702 | }, |
| 703 | ): Promise<SpaceQuery[]> { |
| 704 | let spaceQueriesQuery = this.database(SavedChartsTableName) |
| 705 | .whereIn(`${SpaceTableName}.space_uuid`, spaceUuids) |
| 706 | .whereNull(`${SavedChartsTableName}.deleted_at`) |
| 707 | .leftJoin( |
| 708 | SpaceTableName, |
| 709 | `${SavedChartsTableName}.space_id`, |
| 710 | `${SpaceTableName}.space_id`, |
| 711 | ) |
| 712 | .leftJoin( |
| 713 | UserTableName, |
| 714 | `${SavedChartsTableName}.last_version_updated_by_user_uuid`, |
| 715 | `${UserTableName}.user_uuid`, |
| 716 | ) |
| 717 | .leftJoin( |
| 718 | PinnedChartTableName, |
| 719 | `${PinnedChartTableName}.saved_chart_uuid`, |
| 720 | `${SavedChartsTableName}.saved_query_uuid`, |
| 721 | ) |
| 722 | .leftJoin( |
| 723 | PinnedListTableName, |
| 724 | `${PinnedListTableName}.pinned_list_uuid`, |
| 725 | `${PinnedChartTableName}.pinned_list_uuid`, |
| 726 | ) |
| 727 | .leftJoin( |
| 728 | ProjectTableName, |
| 729 | `${ProjectTableName}.project_id`, |
| 730 | `${SpaceTableName}.project_id`, |
| 731 | ) |
| 732 | .leftJoin( |
| 733 | OrganizationTableName, |
| 734 | `${OrganizationTableName}.organization_id`, |
| 735 | `${ProjectTableName}.organization_id`, |
| 736 | ) |
| 737 | .leftJoin(DashboardsTableName, function nonDeletedDashboardJoin() { |
| 738 | this.on( |
| 739 | `${DashboardsTableName}.dashboard_uuid`, |
| 740 | '=', |
| 741 | `${SavedChartsTableName}.dashboard_uuid`, |
| 742 | ).andOnNull(`${DashboardsTableName}.deleted_at`); |
| 743 | }) |
| 744 | .select< |
| 745 | { |
| 746 | saved_query_uuid: string; |
| 747 | name: string; |
| 748 | description?: string; |
| 749 | created_at: Date; |
| 750 | user_uuid: string; |
| 751 | first_name: string; |
| 752 | last_name: string; |
| 753 | views_count: number; |
| 754 | first_viewed_at: Date | null; |
no test coverage detected