Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
underbluewaters committed Feb 6, 2024
1 parent b0c7f43 commit be2c39b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions packages/api/migrations/committed/000296.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--! Previous: sha1:2c3687f0ef3ad551ea52c7259f1e8ed52677b2d1
--! Hash: sha1:ab079f30cd7bd38724ad2f66c10fb1c4add93c5b

-- Enter migration here
drop function if exists projects_downloadable_layers_count;
create or replace function projects_downloadable_layers_count(p projects)
returns int
language sql
stable
as $$
select count(id)::int from table_of_contents_items where project_id = p.id and is_draft = true and is_folder = false and enable_download = true and table_of_contents_items_has_original_source_upload(table_of_contents_items.*);
$$;

drop function if exists projects_eligable_downloadable_layers_count;
create or replace function projects_eligable_downloadable_layers_count(p projects)
returns int
language sql
stable
as $$
select count(id)::int from table_of_contents_items where project_id = p.id and is_draft = true and is_folder = false and enable_download = false and table_of_contents_items_has_original_source_upload(table_of_contents_items.*);
$$;

grant execute on function projects_downloadable_layers_count(projects) to seasketch_user;

grant execute on function projects_eligable_downloadable_layers_count(projects) to seasketch_user;
4 changes: 2 additions & 2 deletions packages/api/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10307,7 +10307,7 @@ when users request layers be displayed on the map.
CREATE FUNCTION public.projects_downloadable_layers_count(p public.projects) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(id) from table_of_contents_items where project_id = p.id and is_draft = true and is_folder = false and enable_download = true and table_of_contents_items_has_original_source_upload(table_of_contents_items.*);
select count(id)::int from table_of_contents_items where project_id = p.id and is_draft = true and is_folder = false and enable_download = true and table_of_contents_items_has_original_source_upload(table_of_contents_items.*);
$$;


Expand Down Expand Up @@ -10345,7 +10345,7 @@ then use the `publishTableOfContents` mutation when it is ready for end-users.
CREATE FUNCTION public.projects_eligable_downloadable_layers_count(p public.projects) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(id) from table_of_contents_items where project_id = p.id and is_draft = true and is_folder = false and enable_download = false and table_of_contents_items_has_original_source_upload(table_of_contents_items.*);
select count(id)::int from table_of_contents_items where project_id = p.id and is_draft = true and is_folder = false and enable_download = false and table_of_contents_items_has_original_source_upload(table_of_contents_items.*);
$$;


Expand Down

0 comments on commit be2c39b

Please sign in to comment.