camper/test
jordi fita mas f746c82b46 Make home page’s carousel manageable via the database
I debated with myself whether to create the home_carousel relation or
rather if it would be better to have a single carousel relation for all
pages.  However, i thought that it would be actually harder to maintain
a single relation because i would need an additional column to tell one
carrousel from another, and what would that column be? An enum? A
foreign key to another relation? home_carousel carries no such issues.

I was starting to duplicate logic all over the packages, such as the
way to encode media paths or “localization” (l10n) input fields.
Therefore, i refactorized them.

In the case of media path, i added a function that accepts rows of
media, because always need the same columns from the row, and it was
yet another repetition if i needed to pass them all the time.  Plus,
these kind of functions can be called as `table.function`, that make
them look like columns from the table; if PostgreSQL implemented virtual
generated columns, i would have used that instead.

I am not sure whether that media_path function can be immutable. An
immutable function is “guaranteed to return the same results given the
same arguments forever”, which would be true if the inputs where the
hash and the original_filename columns, instead of the whole rows, but
i left it as static because i did not know whether PostgreSQL interprets
the “same row but with different values” as a different input.  That is,
whether PostgreSQL’s concept of row is the actual tuple or the space
that has a rowid, irrespective of contents; in the latter case, the
function can not be immutable.  Just to be in the safe side, i left it
stable.

The home page was starting to grow a bit too much inside the app
package, new that it has its own admin handler, and moved it all to a
separate package.
2023-09-15 01:05:38 +02:00
..
add_campsite.sql Add cover media to campsite types 2023-09-10 03:04:18 +02:00
add_campsite_type.sql Add internationalization and localization of campsite types 2023-09-12 20:20:23 +02:00
add_home_carousel_slide.sql Make home page’s carousel manageable via the database 2023-09-15 01:05:38 +02:00
add_media.sql Add media relation and add_media function 2023-09-08 20:03:26 +02:00
add_season.sql Add seasons’ relation, functions, and admin section 2023-08-16 20:15:57 +02:00
build_cookie.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
campsite.sql Add cover media to campsite types 2023-09-10 03:04:18 +02:00
campsite_type.sql Add cover media to campsite types 2023-09-10 03:04:18 +02:00
campsite_type_i18n.sql Add internationalization and localization of campsite types 2023-09-12 20:20:23 +02:00
change_password.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
check_cookie.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
color.sql Add seasons’ relation, functions, and admin section 2023-08-16 20:15:57 +02:00
company.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
company_host.sql Use HTTP Host to establish the request’s company 2023-08-03 20:21:21 +02:00
company_user.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
country.sql Add company and company_user relations, along with their dependencies 2023-07-29 04:25:56 +02:00
country_code.sql Add company and company_user relations, along with their dependencies 2023-07-29 04:25:56 +02:00
country_i18n.sql Add company and company_user relations, along with their dependencies 2023-07-29 04:25:56 +02:00
currency.sql Add company and company_user relations, along with their dependencies 2023-07-29 04:25:56 +02:00
currency_code.sql Add company and company_user relations, along with their dependencies 2023-07-29 04:25:56 +02:00
current_company_id.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
current_user_cookie.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
current_user_email.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
edit_campsite.sql Add cover media to campsite types 2023-09-10 03:04:18 +02:00
edit_campsite_type.sql Add cover media to campsite types 2023-09-10 03:04:18 +02:00
edit_season.sql Add seasons’ relation, functions, and admin section 2023-08-16 20:15:57 +02:00
email.sql Add authentication relations, views, and functions for PostgreSQL 2023-07-22 01:59:12 +02:00
encrypt_password.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
ensure_role_exists.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
extensions.sql Add company and company_user relations, along with their dependencies 2023-07-29 04:25:56 +02:00
home_carousel.sql Make home page’s carousel manageable via the database 2023-09-15 01:05:38 +02:00
home_carousel_i18n.sql Make home page’s carousel manageable via the database 2023-09-15 01:05:38 +02:00
input_is_valid.sql Add the form to update company’s tax details 2023-08-15 22:35:21 +02:00
input_is_valid_phone.sql Add the form to update company’s tax details 2023-08-15 22:35:21 +02:00
language.sql Add authentication relations, views, and functions for PostgreSQL 2023-07-22 01:59:12 +02:00
login.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
login_attempt.sql Add authentication relations, views, and functions for PostgreSQL 2023-07-22 01:59:12 +02:00
logout.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
media.sql Add media relation and add_media function 2023-09-08 20:03:26 +02:00
media_path.sql Make home page’s carousel manageable via the database 2023-09-15 01:05:38 +02:00
media_type.sql Add media relation and add_media function 2023-09-08 20:03:26 +02:00
remove_home_carousel_slide.sql Make home page’s carousel manageable via the database 2023-09-15 01:05:38 +02:00
roles.sql Add authentication relations, views, and functions for PostgreSQL 2023-07-22 01:59:12 +02:00
schemas.sql Add authentication relations, views, and functions for PostgreSQL 2023-07-22 01:59:12 +02:00
season.sql Add seasons’ relation, functions, and admin section 2023-08-16 20:15:57 +02:00
set_cookie.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
to_color.sql Add seasons’ relation, functions, and admin section 2023-08-16 20:15:57 +02:00
to_integer.sql Add seasons’ relation, functions, and admin section 2023-08-16 20:15:57 +02:00
translate_home_carousel_slide.sql Make home page’s carousel manageable via the database 2023-09-15 01:05:38 +02:00
user.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00
user_profile.sql Move the user role down to company_user relation 2023-08-08 02:22:16 +02:00