camper/deploy/order_surroundings_highlights.sql
jordi fita mas a0f9c10193 Add management of surroundings’ highlights (points of interest)
Customer does not want the new “masonry-like” design of the surroundings
page, and wants the same style they already had: a regular list with
text and photo, alternating the photo’s side.

And, of course, they want to be able to add and edit them themselves. It
is like another carousel, but with an additional rich-text description.

The photos that we had in that page are no longer of use.
2024-01-16 01:26:35 +01:00

25 lines
719 B
PL/PgSQL

-- Deploy camper:order_surroundings_highlights to pg
-- requires: roles
-- requires: schema_camper
-- requires: surroundings_highlight
begin;
set search_path to camper, public;
create or replace function order_surroundings_highlights(positions integer[]) returns void as
$$
update surroundings_highlight
set position = cast(temp.position as integer)
from unnest(positions) with ordinality as temp(surroundings_highlight_id, position)
where surroundings_highlight.surroundings_highlight_id = temp.surroundings_highlight_id
;
$$
language sql
;
revoke execute on function order_surroundings_highlights(integer[]) from public;
grant execute on function order_surroundings_highlights(integer[]) to admin;
commit;