diff --git a/docker/database/start-scripts/0-init.sql b/docker/database/start-scripts/0-init.sql index aedc214e..e18c9fac 100644 --- a/docker/database/start-scripts/0-init.sql +++ b/docker/database/start-scripts/0-init.sql @@ -162,7 +162,14 @@ create table sensor_history ( created_at timestamp default current_timestamp, foreign key (sensor_id) references sensors(id) ); + +create table pruning_types ( + id int auto_increment primary key, + name varchar(20) unique, + description varchar(255) +); + create table task_types ( id int auto_increment primary key, - name varchar(255) -) \ No newline at end of file + name varchar(255) unique +); diff --git a/docker/database/start-scripts/1-seed.sql b/docker/database/start-scripts/1-seed.sql index eb418368..9c3ca232 100644 --- a/docker/database/start-scripts/1-seed.sql +++ b/docker/database/start-scripts/1-seed.sql @@ -27,3 +27,9 @@ INSERT INTO task_types (name) VALUES ('Abono arbustos'), ('Podar setos'), ('Abono setos'); + +-- Insert sample pruning types +INSERT INTO pruning_types (name, description) VALUES +('A', 'Poda de mantenimiento en árbol tipo A, caduco, de p.c. entre 41/80 cm.'), +('B', 'Poda de mantenimiento en árbol tipo B, caduco, de p.c. mayor de 81 cm.'), +('C', 'Poda de mantenimiento en árbol tipo C, perenne, de p.c. entre 41/60 cm.'); \ No newline at end of file diff --git a/src/app/Controllers/PruningTypeController.php b/src/app/Controllers/PruningTypeController.php new file mode 100644 index 00000000..d3569d39 --- /dev/null +++ b/src/app/Controllers/PruningTypeController.php @@ -0,0 +1,25 @@ + "PruningType", + "title" => "Pruning Types", + "layout" => "MainLayout", + "data" => ["pruning_types" => $pruning_types] + ]); + } + + public function post() {} + public function put() {} + public function delete() {} +} \ No newline at end of file diff --git a/src/app/Models/PruningType.php b/src/app/Models/PruningType.php new file mode 100644 index 00000000..bbb2d33e --- /dev/null +++ b/src/app/Models/PruningType.php @@ -0,0 +1,26 @@ +id = $data['id']; + $pruning_type->name = $data['name']; + $pruning_type->description = $data['description']; + return $pruning_type; + } +} diff --git a/src/app/Views/PruningType.php b/src/app/Views/PruningType.php new file mode 100644 index 00000000..6d9b3de5 --- /dev/null +++ b/src/app/Views/PruningType.php @@ -0,0 +1,21 @@ +
ID | +Name | +Description | + +
---|---|---|
getId(); ?> | +name; ?> | +description; ?> | +