diff --git a/demo/demo.sql b/demo/demo.sql index 6964f7f..2cc51bf 100644 --- a/demo/demo.sql +++ b/demo/demo.sql @@ -114,23 +114,23 @@ values (77, 'en', 'Tent') ; alter table campsite_type alter column campsite_type_id restart with 72; -select add_campsite_type(52, 62, 'Parceŀles', '
Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Parcel·les amples amb serveis a prop d’on ets per fer allò que vols.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', 6, true); -select add_campsite_type(52, 63, 'Safari Tents', 'Un luxe de tendes per viure aventures.
Dues tendes amb terra de fusta, llits, cuina i tot de comoditats per gaudir de les teves vacances.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', 6, false); -select add_campsite_type(52, 64, 'Bungalous', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', 5, false); -select add_campsite_type(52, 65, 'Bungalous prèmium', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', 5, false); -select add_campsite_type(52, 66, 'Cabanes de fusta', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', 5, false); +select add_campsite_type(52, 62, 'Parceŀles', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Parcel·les amples amb serveis a prop d’on ets per fer allò que vols.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '', 6, true); +select add_campsite_type(52, 63, 'Safari Tents', 'Un luxe de tendes per viure aventures.
Dues tendes amb terra de fusta, llits, cuina i tot de comoditats per gaudir de les teves vacances.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '', 6, false); +select add_campsite_type(52, 64, 'Bungalous', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '', 5, false); +select add_campsite_type(52, 65, 'Bungalous prèmium', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '', 5, false); +select add_campsite_type(52, 66, 'Cabanes de fusta', 'Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.
Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.
', '* Tovalloles: preu extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '', 5, false); -insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description) -values (72, 'en', 'Plots', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Large plots with serivces close to where you are to do what you want.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (72, 'es', 'Parcelas', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Parcelas amplias con servicios cerca de donde eres para hacer aquello que quieres.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (73, 'en', 'Safari Tents', 'A luxury of tent for unforgettable adventures.
Two tents with wooden floors, beds, kitchen, and all the amenities to enjoy your vacation.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (73, 'es', 'Tiendas Safari', 'Un lujo de tiendas para vivir aventuras.
Dos tiendas con suelo de madera, camas, cocina y todo de comodidades para disfrutar de tus vacanciones.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (74, 'en', 'Bungalows', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Two two-story solid wood cabins with a covered porch to enjoy among the trees.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (74, 'es', 'Bungalós', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (75, 'en', 'Bungalows premium', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Two two-story solid wood cabins with a covered porch to enjoy among the trees.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (75, 'es', 'Bungalós prémium', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (76, 'en', 'Wooden Lodges', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Two two-story solid wood cabins with a covered porch to enjoy among the trees.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') - , (76, 'es', 'Cabañas de madera', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
') +insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description, additional_info) +values (72, 'en', 'Plots', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Large plots with serivces close to where you are to do what you want.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (72, 'es', 'Parcelas', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Parcelas amplias con servicios cerca de donde eres para hacer aquello que quieres.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (73, 'en', 'Safari Tents', 'A luxury of tent for unforgettable adventures.
Two tents with wooden floors, beds, kitchen, and all the amenities to enjoy your vacation.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (73, 'es', 'Tiendas Safari', 'Un lujo de tiendas para vivir aventuras.
Dos tiendas con suelo de madera, camas, cocina y todo de comodidades para disfrutar de tus vacanciones.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (74, 'en', 'Bungalows', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Two two-story solid wood cabins with a covered porch to enjoy among the trees.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (74, 'es', 'Bungalós', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (75, 'en', 'Bungalows premium', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Two two-story solid wood cabins with a covered porch to enjoy among the trees.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (75, 'es', 'Bungalós prémium', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (76, 'en', 'Wooden Lodges', 'Located on the campground’s mountain-side and overlooking the nature that surrounds us.
Two two-story solid wood cabins with a covered porch to enjoy among the trees.
', '* Towels: extra cost
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') + , (76, 'es', 'Cabañas de madera', 'Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.
Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.
', '* Toallas: precio extra
', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
', '') ; alter table campsite_type_feature alter column campsite_type_feature_id restart with 82; diff --git a/deploy/add_campsite_type.sql b/deploy/add_campsite_type.sql index 5f4081d..2304815 100644 --- a/deploy/add_campsite_type.sql +++ b/deploy/add_campsite_type.sql @@ -8,16 +8,18 @@ begin; set search_path to camper, public; -create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, max_campers integer, dogs_allowed boolean) returns uuid as +drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean); + +create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, max_campers integer, dogs_allowed boolean) returns uuid as $$ - insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, max_campers, dogs_allowed) - values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), max_campers, dogs_allowed) + insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, max_campers, dogs_allowed) + values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), max_campers, dogs_allowed) returning slug; $$ language sql ; -revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean) from public; -grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean) to admin; +revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean) from public; +grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean) to admin; commit; diff --git a/deploy/add_campsite_type@v0.sql b/deploy/add_campsite_type@v0.sql new file mode 100644 index 0000000..5f4081d --- /dev/null +++ b/deploy/add_campsite_type@v0.sql @@ -0,0 +1,23 @@ +-- Deploy camper:add_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type +-- requires: company + +begin; + +set search_path to camper, public; + +create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, max_campers integer, dogs_allowed boolean) returns uuid as +$$ + insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, max_campers, dogs_allowed) + values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), max_campers, dogs_allowed) + returning slug; +$$ + language sql +; + +revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean) from public; +grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean) to admin; + +commit; diff --git a/deploy/campsite_type__additional_info.sql b/deploy/campsite_type__additional_info.sql new file mode 100644 index 0000000..f773189 --- /dev/null +++ b/deploy/campsite_type__additional_info.sql @@ -0,0 +1,10 @@ +-- Deploy camper:campsite_type__additional_info to pg +-- requires: campsite_type + +begin; + +alter table camper.campsite_type +add column additional_info xml not null default '' +; + +commit; diff --git a/deploy/campsite_type_i18n__additional_info.sql b/deploy/campsite_type_i18n__additional_info.sql new file mode 100644 index 0000000..2db00e4 --- /dev/null +++ b/deploy/campsite_type_i18n__additional_info.sql @@ -0,0 +1,14 @@ +-- Deploy camper:campsite_type_i18n__additional_info to pg +-- requires: campsite_type_i18n + +begin; + +alter table camper.campsite_type_i18n +add column additional_info xml not null default '' +; + +alter table camper.campsite_type_i18n +alter column additional_info drop default +; + +commit; diff --git a/deploy/edit_campsite_type.sql b/deploy/edit_campsite_type.sql index ba605ff..b248a61 100644 --- a/deploy/edit_campsite_type.sql +++ b/deploy/edit_campsite_type.sql @@ -8,13 +8,16 @@ begin; set search_path to camper, public; -create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as +drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean); + +create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as $$ update campsite_type set name = edit_campsite_type.name , spiel = xmlparse(content edit_campsite_type.spiel) , description = xmlparse(content edit_campsite_type.description) , info = xmlparse(content edit_campsite_type.info) + , additional_info = xmlparse(content edit_campsite_type.additional_info) , facilities = xmlparse(content edit_campsite_type.facilities) , media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id) , max_campers = edit_campsite_type.max_campers @@ -26,7 +29,7 @@ $$ language sql ; -revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean) from public; -grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean) to admin; +revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean) from public; +grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean) to admin; commit; diff --git a/deploy/edit_campsite_type@v0.sql b/deploy/edit_campsite_type@v0.sql new file mode 100644 index 0000000..ba605ff --- /dev/null +++ b/deploy/edit_campsite_type@v0.sql @@ -0,0 +1,32 @@ +-- Deploy camper:edit_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type +-- requires: company + +begin; + +set search_path to camper, public; + +create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, max_campers integer, dogs_allowed boolean, active boolean) returns uuid as +$$ + update campsite_type + set name = edit_campsite_type.name + , spiel = xmlparse(content edit_campsite_type.spiel) + , description = xmlparse(content edit_campsite_type.description) + , info = xmlparse(content edit_campsite_type.info) + , facilities = xmlparse(content edit_campsite_type.facilities) + , media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id) + , max_campers = edit_campsite_type.max_campers + , dogs_allowed = edit_campsite_type.dogs_allowed + , active = edit_campsite_type.active + where slug = edit_campsite_type.slug + returning slug; +$$ +language sql +; + +revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean) from public; +grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean) to admin; + +commit; diff --git a/deploy/translate_campsite_type.sql b/deploy/translate_campsite_type.sql index 6bdbf85..e4d6883 100644 --- a/deploy/translate_campsite_type.sql +++ b/deploy/translate_campsite_type.sql @@ -7,10 +7,12 @@ begin; set search_path to camper, public; -create or replace function translate_campsite_type (slug uuid, lang_tag text, name text, spiel text, info text, facilities text, description text) returns void as +drop function if exists translate_campsite_type (uuid, text, text, text, text, text, text); + +create or replace function translate_campsite_type (slug uuid, lang_tag text, name text, spiel text, info text, facilities text, description text, additional_info text) returns void as $$ - insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description) - select campsite_type_id, translate_campsite_type.lang_tag, translate_campsite_type.name, xmlparse(content coalesce(translate_campsite_type.spiel, '')), xmlparse(content coalesce(translate_campsite_type.info, '')), xmlparse(content coalesce(translate_campsite_type.facilities, '')), xmlparse(content coalesce(translate_campsite_type.description, '')) + insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description, additional_info) + select campsite_type_id, translate_campsite_type.lang_tag, translate_campsite_type.name, xmlparse(content coalesce(translate_campsite_type.spiel, '')), xmlparse(content coalesce(translate_campsite_type.info, '')), xmlparse(content coalesce(translate_campsite_type.facilities, '')), xmlparse(content coalesce(translate_campsite_type.description, '')), xmlparse(content coalesce(translate_campsite_type.additional_info, '')) from campsite_type where slug = translate_campsite_type.slug on conflict (campsite_type_id, lang_tag) do update @@ -19,11 +21,12 @@ $$ , info = excluded.info , facilities = excluded.facilities , description = excluded.description + , additional_info = excluded.additional_info $$ language sql ; -revoke execute on function translate_campsite_type (uuid, text, text, text, text, text, text) from public; -grant execute on function translate_campsite_type(uuid, text, text, text, text, text, text) to admin; +revoke execute on function translate_campsite_type (uuid, text, text, text, text, text, text, text) from public; +grant execute on function translate_campsite_type(uuid, text, text, text, text, text, text, text) to admin; commit; diff --git a/deploy/translate_campsite_type@v0.sql b/deploy/translate_campsite_type@v0.sql new file mode 100644 index 0000000..6bdbf85 --- /dev/null +++ b/deploy/translate_campsite_type@v0.sql @@ -0,0 +1,29 @@ +-- Deploy camper:translate_campsite_type to pg +-- requires: roles +-- requires: schema_camper +-- requires: campsite_type_i18n + +begin; + +set search_path to camper, public; + +create or replace function translate_campsite_type (slug uuid, lang_tag text, name text, spiel text, info text, facilities text, description text) returns void as +$$ + insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description) + select campsite_type_id, translate_campsite_type.lang_tag, translate_campsite_type.name, xmlparse(content coalesce(translate_campsite_type.spiel, '')), xmlparse(content coalesce(translate_campsite_type.info, '')), xmlparse(content coalesce(translate_campsite_type.facilities, '')), xmlparse(content coalesce(translate_campsite_type.description, '')) + from campsite_type + where slug = translate_campsite_type.slug + on conflict (campsite_type_id, lang_tag) do update + set name = excluded.name + , spiel = excluded.spiel + , info = excluded.info + , facilities = excluded.facilities + , description = excluded.description +$$ + language sql +; + +revoke execute on function translate_campsite_type (uuid, text, text, text, text, text, text) from public; +grant execute on function translate_campsite_type(uuid, text, text, text, text, text, text) to admin; + +commit; diff --git a/pkg/campsite/types/admin.go b/pkg/campsite/types/admin.go index 3b30ad7..75c8c08 100644 --- a/pkg/campsite/types/admin.go +++ b/pkg/campsite/types/admin.go @@ -167,14 +167,15 @@ func addType(w http.ResponseWriter, r *http.Request, user *auth.User, company *a panic(err) } processTypeForm(w, r, user, company, conn, f, func(ctx context.Context, tx *database.Tx) error { - slug, err := tx.AddCampsiteType(ctx, company.ID, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked) + var err error + f.Slug, err = tx.AddCampsiteType(ctx, company.ID, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked) if err != nil { return err } if err := translateTypes(ctx, tx, company, f); err != nil { return err } - return setTypePrices(ctx, tx, slug, f.Prices) + return setTypePrices(ctx, tx, f.Slug, f.Prices) }) } @@ -184,7 +185,7 @@ func translateTypes(ctx context.Context, tx *database.Tx, company *auth.Company, if l == f.DefaultLang { continue } - if err := tx.TranslateCampsiteType(ctx, f.Slug, lang, f.Name[l].Val, f.Spiel[l].Val, f.Info[l].Val, f.Facilities[l].Val, f.Description[l].Val); err != nil { + if err := tx.TranslateCampsiteType(ctx, f.Slug, lang, f.Name[l].Val, f.Spiel[l].Val, f.Info[l].Val, f.Facilities[l].Val, f.Description[l].Val, f.AdditionalInfo[l].Val); err != nil { return err } } @@ -202,7 +203,7 @@ func setTypePrices(ctx context.Context, tx *database.Tx, slug string, prices map func editType(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company, conn *database.Conn, f *typeForm) { processTypeForm(w, r, user, company, conn, f, func(ctx context.Context, tx *database.Tx) error { - if _, err := tx.EditCampsiteType(ctx, f.Slug, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked, f.Active.Checked); err != nil { + if _, err := tx.EditCampsiteType(ctx, f.Slug, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.MaxCampers.Int(), f.DogsAllowed.Checked, f.Active.Checked); err != nil { return err } if err := translateTypes(ctx, tx, company, f); err != nil { @@ -270,18 +271,19 @@ func processTypeForm(w http.ResponseWriter, r *http.Request, user *auth.User, co } type typeForm struct { - DefaultLang string - Slug string - Active *form.Checkbox - Media *form.Media - Name form.I18nInput - MaxCampers *form.Input - DogsAllowed *form.Checkbox - Spiel form.I18nInput - Info form.I18nInput - Facilities form.I18nInput - Description form.I18nInput - Prices map[int]*typePriceForm + DefaultLang string + Slug string + Active *form.Checkbox + Media *form.Media + Name form.I18nInput + MaxCampers *form.Input + DogsAllowed *form.Checkbox + Spiel form.I18nInput + Info form.I18nInput + Facilities form.I18nInput + Description form.I18nInput + AdditionalInfo form.I18nInput + Prices map[int]*typePriceForm } type typePriceForm struct { @@ -311,10 +313,11 @@ func newTypeForm(ctx context.Context, company *auth.Company, conn *database.Conn DogsAllowed: &form.Checkbox{ Name: "dogs_allowed", }, - Spiel: form.NewI18nInput(company.Locales, "spiel"), - Info: form.NewI18nInput(company.Locales, "info"), - Facilities: form.NewI18nInput(company.Locales, "facilities"), - Description: form.NewI18nInput(company.Locales, "description"), + Spiel: form.NewI18nInput(company.Locales, "spiel"), + Info: form.NewI18nInput(company.Locales, "info"), + Facilities: form.NewI18nInput(company.Locales, "facilities"), + Description: form.NewI18nInput(company.Locales, "description"), + AdditionalInfo: form.NewI18nInput(company.Locales, "additional_info"), } rows, err := conn.Query(ctx, "select season_id, name from season where active and company_id = $1", company.ID) @@ -353,12 +356,14 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl var info database.RecordArray var facilities database.RecordArray var description database.RecordArray + var additionalInfo database.RecordArray row := conn.QueryRow(ctx, ` select campsite_type.name , campsite_type.spiel::text , campsite_type.info::text , campsite_type.facilities::text , campsite_type.description::text + , campsite_type.additional_info::text , media_id::text , max_campers::text , dogs_allowed @@ -368,6 +373,7 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl , array_agg((lang_tag, i18n.info::text)) , array_agg((lang_tag, i18n.facilities::text)) , array_agg((lang_tag, i18n.description::text)) + , array_agg((lang_tag, i18n.additional_info::text)) from campsite_type left join campsite_type_i18n as i18n using (campsite_type_id) where slug = $1 @@ -376,12 +382,13 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl , campsite_type.info::text , campsite_type.facilities::text , campsite_type.description::text + , campsite_type.additional_info::text , media_id::text , max_campers::text , dogs_allowed , active `, pgx.QueryResultFormats{pgx.BinaryFormatCode}, slug) - if err := row.Scan(&f.Name[f.DefaultLang].Val, &f.Spiel[f.DefaultLang].Val, &f.Info[f.DefaultLang].Val, &f.Facilities[f.DefaultLang].Val, &f.Description[f.DefaultLang].Val, &f.Media.Val, &f.MaxCampers.Val, &f.DogsAllowed.Checked, &f.Active.Checked, &name, &spiel, &info, &facilities, &description); err != nil { + if err := row.Scan(&f.Name[f.DefaultLang].Val, &f.Spiel[f.DefaultLang].Val, &f.Info[f.DefaultLang].Val, &f.Facilities[f.DefaultLang].Val, &f.Description[f.DefaultLang].Val, &f.AdditionalInfo[f.DefaultLang].Val, &f.Media.Val, &f.MaxCampers.Val, &f.DogsAllowed.Checked, &f.Active.Checked, &name, &spiel, &info, &facilities, &description, &additionalInfo); err != nil { return err } if err := f.Name.FillArray(name); err != nil { @@ -399,6 +406,9 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl if err := f.Description.FillArray(description); err != nil { return err } + if err := f.AdditionalInfo.FillArray(additionalInfo); err != nil { + return err + } rows, err := conn.Query(ctx, ` select season_id @@ -440,6 +450,7 @@ func (f *typeForm) Parse(r *http.Request) error { f.Info.FillValue(r) f.Facilities.FillValue(r) f.Description.FillValue(r) + f.AdditionalInfo.FillValue(r) f.Media.FillValue(r) for _, p := range f.Prices { p.PricePerNight.FillValue(r) diff --git a/pkg/campsite/types/public.go b/pkg/campsite/types/public.go index bd64633..352c764 100644 --- a/pkg/campsite/types/public.go +++ b/pkg/campsite/types/public.go @@ -62,16 +62,17 @@ func (h *PublicHandler) Handler(user *auth.User, company *auth.Company, conn *da type publicPage struct { *template.PublicPage - Slug string - Name string - Carousel []*carousel.Slide - Prices []*typePrice - Features []*typeFeature - Calendar *season.Calendar - Spiel gotemplate.HTML - Info gotemplate.HTML - Facilities gotemplate.HTML - Description gotemplate.HTML + Slug string + Name string + Carousel []*carousel.Slide + Prices []*typePrice + Features []*typeFeature + Calendar *season.Calendar + Spiel gotemplate.HTML + Info gotemplate.HTML + Facilities gotemplate.HTML + Description gotemplate.HTML + AdditionalInfo gotemplate.HTML } type typePrice struct { @@ -120,12 +121,13 @@ func newPublicPage(ctx context.Context, company *auth.Company, conn *database.Co , coalesce(i18n.info, campsite_type.info)::text as l10n_info , coalesce(i18n.facilities, campsite_type.facilities)::text as l10n_facilities , coalesce(i18n.description, campsite_type.description)::text as l10n_description + , coalesce(i18n.additional_info, campsite_type.additional_info)::text as l10n_description from campsite_type left join campsite_type_i18n as i18n on campsite_type.campsite_type_id = i18n.campsite_type_id and i18n.lang_tag = $1 where slug = $2 and active `, loc.Language, slug) - if err := row.Scan(&page.Name, &page.Spiel, &page.Info, &page.Facilities, &page.Description); err != nil { + if err := row.Scan(&page.Name, &page.Spiel, &page.Info, &page.Facilities, &page.Description, &page.AdditionalInfo); err != nil { return nil, err } diff --git a/pkg/database/funcs.go b/pkg/database/funcs.go index ecc155c..3616342 100644 --- a/pkg/database/funcs.go +++ b/pkg/database/funcs.go @@ -11,12 +11,12 @@ import ( "golang.org/x/text/language" ) -func (tx *Tx) AddCampsiteType(ctx context.Context, companyID int, mediaID int, name string, spiel string, info string, facilities string, description string, maxCampers int, dogsAllowed bool) (string, error) { - return tx.GetText(ctx, "select add_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9)", companyID, mediaID, name, spiel, info, facilities, description, maxCampers, dogsAllowed) +func (tx *Tx) AddCampsiteType(ctx context.Context, companyID int, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, maxCampers int, dogsAllowed bool) (string, error) { + return tx.GetText(ctx, "select add_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", companyID, mediaID, name, spiel, info, facilities, description, additionalInfo, maxCampers, dogsAllowed) } -func (tx *Tx) EditCampsiteType(ctx context.Context, slug string, mediaID int, name string, spiel string, info string, facilities string, description string, maxCampers int, dogsAllowed bool, active bool) (string, error) { - return tx.GetText(ctx, "select edit_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", slug, mediaID, name, spiel, info, facilities, description, maxCampers, dogsAllowed, active) +func (tx *Tx) EditCampsiteType(ctx context.Context, slug string, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, maxCampers int, dogsAllowed bool, active bool) (string, error) { + return tx.GetText(ctx, "select edit_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)", slug, mediaID, name, spiel, info, facilities, description, additionalInfo, maxCampers, dogsAllowed, active) } func (c *Conn) OrderCampsiteTypes(ctx context.Context, slugs []string) error { @@ -24,8 +24,8 @@ func (c *Conn) OrderCampsiteTypes(ctx context.Context, slugs []string) error { return err } -func (tx *Tx) TranslateCampsiteType(ctx context.Context, slug string, langTag language.Tag, name string, spiel string, info string, facilities string, description string) error { - _, err := tx.Exec(ctx, "select translate_campsite_type($1, $2, $3, $4, $5, $6, $7)", slug, langTag, name, spiel, info, facilities, description) +func (tx *Tx) TranslateCampsiteType(ctx context.Context, slug string, langTag language.Tag, name string, spiel string, info string, facilities string, description string, additionalInfo string) error { + _, err := tx.Exec(ctx, "select translate_campsite_type($1, $2, $3, $4, $5, $6, $7, $8)", slug, langTag, name, spiel, info, facilities, description, additionalInfo) return err } func (tx *Tx) SetCampsiteTypeCost(ctx context.Context, slug string, seasonID int, minNights int, costPerNight string) error { diff --git a/po/ca.po b/po/ca.po index cca291a..eb9a5ce 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-01-14 02:01+0100\n" +"POT-Creation-Date: 2024-01-15 00:21+0100\n" "PO-Revision-Date: 2023-07-22 23:45+0200\n" "Last-Translator: jordi fita masFeatures
', '', 'Dunno
', 5, true) $$, + $$ select add_campsite_type(1, 3, 'Type A', '', 'Features
', '', 'Dunno
', '', 5, true) $$, 'Should be able to add a campsite type to the first company' ); select lives_ok( - $$ select add_campsite_type(2, 4, 'Type B', 'One
Two
', '', 'Pricing
', '', 2, false) $$, + $$ select add_campsite_type(2, 4, 'Type B', 'One
Two
', '', 'Pricing
', '', 'More
', 2, false) $$, 'Should be able to add a campsite type to the second company' ); select bag_eq( - $$ select company_id, media_id, name, spiel::text, info::text, facilities::text, description::text, active, max_campers, dogs_allowed from campsite_type $$, - $$ values (1, 3, 'Type A', '', 'Features
', '', 'Dunno
', true, 5, true) - , (2, 4, 'Type B', 'One
Two
', '', 'Pricing
', '', true, 2, false) + $$ select company_id, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, active, max_campers, dogs_allowed from campsite_type $$, + $$ values (1, 3, 'Type A', '', 'Features
', '', 'Dunno
', '', true, 5, true) + , (2, 4, 'Type B', 'One
Two
', '', 'Pricing
', '', 'More
', true, 2, false) $$, 'Should have added all two campsite type' ); diff --git a/test/campsite_type.sql b/test/campsite_type.sql index aa48991..69bb647 100644 --- a/test/campsite_type.sql +++ b/test/campsite_type.sql @@ -5,7 +5,7 @@ reset client_min_messages; begin; -select plan(82); +select plan(86); set search_path to camper, public; @@ -72,6 +72,12 @@ select col_not_null('campsite_type', 'description'); select col_has_default('campsite_type', 'description'); --select col_default_is('campsite_type', 'description', ''); +select has_column('campsite_type', 'additional_info'); +select col_type_is('campsite_type', 'additional_info', 'xml'); +select col_not_null('campsite_type', 'additional_info'); +select col_has_default('campsite_type', 'additional_info'); +--select col_default_is('campsite_type', 'additional_info', ''); + select has_column('campsite_type', 'max_campers'); select col_type_is('campsite_type', 'max_campers', 'integer'); select col_not_null('campsite_type', 'max_campers'); diff --git a/test/campsite_type_i18n.sql b/test/campsite_type_i18n.sql index f59e2ca..ee5201f 100644 --- a/test/campsite_type_i18n.sql +++ b/test/campsite_type_i18n.sql @@ -5,7 +5,7 @@ reset client_min_messages; begin; -select plan(39); +select plan(43); set search_path to camper, public; @@ -56,6 +56,11 @@ select col_type_is('campsite_type_i18n', 'description', 'xml'); select col_not_null('campsite_type_i18n', 'description'); select col_hasnt_default('campsite_type_i18n', 'description'); +select has_column('campsite_type_i18n', 'additional_info'); +select col_type_is('campsite_type_i18n', 'additional_info', 'xml'); +select col_not_null('campsite_type_i18n', 'additional_info'); +select col_hasnt_default('campsite_type_i18n', 'additional_info'); + select * from finish(); diff --git a/test/edit_campsite_type.sql b/test/edit_campsite_type.sql index f4daac8..385f5ba 100644 --- a/test/edit_campsite_type.sql +++ b/test/edit_campsite_type.sql @@ -9,15 +9,15 @@ set search_path to camper, public; select plan(12); -select has_function('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean']); -select function_lang_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'sql'); -select function_returns('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'uuid'); -select isnt_definer('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean']); -select volatility_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'volatile'); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'guest', array[]::text[]); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'employee', array[]::text[]); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'admin', array['EXECUTE']); -select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'authenticator', array[]::text[]); +select has_function('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean']); +select function_lang_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'sql'); +select function_returns('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'uuid'); +select isnt_definer('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean']); +select volatility_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'volatile'); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'guest', array[]::text[]); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'employee', array[]::text[]); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'admin', array['EXECUTE']); +select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'boolean', 'boolean'], 'authenticator', array[]::text[]); set client_min_messages to warning; truncate campsite_type cascade; @@ -43,25 +43,25 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a , (4, 1, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffff00","a"};')) ; -insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, max_campers, dogs_allowed, active) -values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', 'info 1
', 'facilities A
', 'A
', 5, false, true) - , (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', 'info 2
', 'facilities B
', 'B
', 4, true, false) +insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, max_campers, dogs_allowed, active) +values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', 'info 1
', 'facilities A
', 'A
', 'Additional A
', 5, false, true) + , (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', 'info 2
', 'facilities B
', 'B
', 'Additional B
', 4, true, false) ; select lives_ok( - $$ select edit_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', 'Features A
', 'Pricing 1
', '1
', 2, true, false) $$, + $$ select edit_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', 'Features A
', 'Pricing 1
', '1
', 'Additional 1
', 2, true, false) $$, 'Should be able to edit the first type' ); select lives_ok( - $$ select edit_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', null, 'Type 2', 'Features B
', 'Pricing 2
', '2
', 9, false, true) $$, + $$ select edit_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', null, 'Type 2', 'Features B
', 'Pricing 2
', '2
', 'Additional 2
', 9, false, true) $$, 'Should be able to edit the second type' ); select bag_eq( - $$ select slug::text, media_id, name, spiel::text, info::text, facilities::text, description::text, max_campers, dogs_allowed, active from campsite_type $$, - $$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', 'Features A
', 'Pricing 1
', '1
', 2, true, false) - , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type 2', 'Features B
', 'Pricing 2
', '2
', 9, false, true) + $$ select slug::text, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, max_campers, dogs_allowed, active from campsite_type $$, + $$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', 'Features A
', 'Pricing 1
', '1
', 'Additional 1
', 2, true, false) + , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type 2', 'Features B
', 'Pricing 2
', '2
', 'Additional 2
', 9, false, true) $$, 'Should have updated all campsite types.' ); diff --git a/test/translate_campsite_type.sql b/test/translate_campsite_type.sql index 219db8f..8dce5aa 100644 --- a/test/translate_campsite_type.sql +++ b/test/translate_campsite_type.sql @@ -9,15 +9,15 @@ select plan(13); set search_path to camper, public; -select has_function('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text']); -select function_lang_is('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'sql'); -select function_returns('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'void'); -select isnt_definer('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text']); -select volatility_is('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'volatile'); -select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'guest', array[]::text[]); -select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'employee', array[]::text[]); -select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'admin', array['EXECUTE']); -select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text'], 'authenticator', array[]::text[]); +select has_function('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text']); +select function_lang_is('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'sql'); +select function_returns('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'void'); +select isnt_definer('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text']); +select volatility_is('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'volatile'); +select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'guest', array[]::text[]); +select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'employee', array[]::text[]); +select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'admin', array['EXECUTE']); +select function_privs_are('camper', 'translate_campsite_type', array['uuid', 'text', 'text', 'text', 'text', 'text', 'text', 'text'], 'authenticator', array[]::text[]); set client_min_messages to warning; @@ -43,36 +43,36 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a , (4, 1, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffff00","a"};')) ; -insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, active, dogs_allowed, max_campers) -values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', 'Features A
', 'Pricing A
', 'A
', true, false, 4) - , (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', 'Features B
', 'Pricing B
', 'B
', false, true, 5) +insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, active, dogs_allowed, max_campers) +values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', 'Features A
', 'Pricing A
', 'A
', 'Additional A
', true, false, 4) + , (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', 'Features B
', 'Pricing B
', 'B
', 'Additional B
', false, true, 5) ; -insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description) -select campsite_type_id, 'ca', 'tipusb', 'característiques b
', 'preus b
', 'B
' from campsite_type +insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description, additional_info) +select campsite_type_id, 'ca', 'tipusb', 'característiques b
', 'preus b
', 'B
', 'B addicional
' from campsite_type where slug = '9b6370f7-f941-46f2-bc6e-de455675bd0a' ; select lives_ok( - $$ select translate_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 'ca', 'Tipus A', null, 'Característiques A
', null, 'a
') $$, + $$ select translate_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 'ca', 'Tipus A', null, 'Característiques A
', null, 'a
', null) $$, 'Should be able to translate the first type' ); select lives_ok( - $$ select translate_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'es', 'Tipo B', 'Precios B
', null) $$, + $$ select translate_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'es', 'Tipo B', 'Precios B
', null, 'B adicional
') $$, 'Should be able to translate the second type' ); select lives_ok( - $$ select translate_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'ca', 'Tipus B', 'Característiques B
', 'Preus B
', '2
') $$, + $$ select translate_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'ca', 'Tipus B', 'Característiques B
', 'Preus B
', '2
', '2 addicional
') $$, 'Should be able to overwrite the catalan translation of the second type' ); select bag_eq( - $$ select slug::text, lang_tag, i18n.name, i18n.spiel::text, i18n.info::text, i18n.facilities::text, i18n.description::text from campsite_type_i18n as i18n join campsite_type using (campsite_type_id) $$, - $$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 'ca', 'Tipus A', '', 'Característiques A
', '', 'a
') - , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'ca', 'Tipus B', 'Característiques B
', 'Preus B
', '2
') - , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'es', 'Tipo B', 'Precios B
', '') + $$ select slug::text, lang_tag, i18n.name, i18n.spiel::text, i18n.info::text, i18n.facilities::text, i18n.description::text, i18n.additional_info::text from campsite_type_i18n as i18n join campsite_type using (campsite_type_id) $$, + $$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 'ca', 'Tipus A', '', 'Característiques A
', '', 'a
', '') + , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'ca', 'Tipus B', 'Característiques B
', 'Preus B
', '2
', '2 addicional
') + , ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 'es', 'Tipo B', 'Precios B
', '', 'B adicional
') $$, 'Should have added and updated all translations.' ); diff --git a/verify/add_campsite_type.sql b/verify/add_campsite_type.sql index 40d9133..df37c7d 100644 --- a/verify/add_campsite_type.sql +++ b/verify/add_campsite_type.sql @@ -2,6 +2,6 @@ begin; -select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean)', 'execute'); +select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, text, integer, boolean)', 'execute'); rollback; diff --git a/verify/add_campsite_type@v0.sql b/verify/add_campsite_type@v0.sql new file mode 100644 index 0000000..40d9133 --- /dev/null +++ b/verify/add_campsite_type@v0.sql @@ -0,0 +1,7 @@ +-- Verify camper:add_campsite_type on pg + +begin; + +select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, integer, boolean)', 'execute'); + +rollback; diff --git a/verify/campsite_type__additional_info.sql b/verify/campsite_type__additional_info.sql new file mode 100644 index 0000000..806d5eb --- /dev/null +++ b/verify/campsite_type__additional_info.sql @@ -0,0 +1,9 @@ +-- Verify camper:campsite_type__additional_info on pg + +begin; + +select additional_info +from camper.campsite_type +where false; + +rollback; diff --git a/verify/campsite_type_i18n__additional_info.sql b/verify/campsite_type_i18n__additional_info.sql new file mode 100644 index 0000000..9f63273 --- /dev/null +++ b/verify/campsite_type_i18n__additional_info.sql @@ -0,0 +1,9 @@ +-- Verify camper:campsite_type_i18n__additional_info on pg + +begin; + +select additional_info +from camper.campsite_type_i18n +where false; + +rollback; diff --git a/verify/edit_campsite_type.sql b/verify/edit_campsite_type.sql index 0c0f89d..35112d0 100644 --- a/verify/edit_campsite_type.sql +++ b/verify/edit_campsite_type.sql @@ -2,6 +2,6 @@ begin; -select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean)', 'execute'); +select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, text, integer, boolean, boolean)', 'execute'); rollback; diff --git a/verify/edit_campsite_type@v0.sql b/verify/edit_campsite_type@v0.sql new file mode 100644 index 0000000..0c0f89d --- /dev/null +++ b/verify/edit_campsite_type@v0.sql @@ -0,0 +1,7 @@ +-- Verify camper:edit_campsite_type on pg + +begin; + +select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, integer, boolean, boolean)', 'execute'); + +rollback; diff --git a/verify/translate_campsite_type.sql b/verify/translate_campsite_type.sql index 349da25..6c63455 100644 --- a/verify/translate_campsite_type.sql +++ b/verify/translate_campsite_type.sql @@ -2,6 +2,6 @@ begin; -select has_function_privilege('camper.translate_campsite_type(uuid, text, text, text, text, text, text)', 'execute'); +select has_function_privilege('camper.translate_campsite_type(uuid, text, text, text, text, text, text, text)', 'execute'); rollback; diff --git a/verify/translate_campsite_type@v0.sql b/verify/translate_campsite_type@v0.sql new file mode 100644 index 0000000..349da25 --- /dev/null +++ b/verify/translate_campsite_type@v0.sql @@ -0,0 +1,7 @@ +-- Verify camper:translate_campsite_type on pg + +begin; + +select has_function_privilege('camper.translate_campsite_type(uuid, text, text, text, text, text, text)', 'execute'); + +rollback; diff --git a/web/templates/admin/campsite/type/form.gohtml b/web/templates/admin/campsite/type/form.gohtml index 1a43886..96dceef 100644 --- a/web/templates/admin/campsite/type/form.gohtml +++ b/web/templates/admin/campsite/type/form.gohtml @@ -151,6 +151,19 @@ {{ template "error-message" . }} {{- end }} + {{ with .AdditionalInfo -}} + + {{- end }}