Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cookie notice #149

Conversation

XavierChao
Copy link
Contributor

No description provided.

@XavierChao XavierChao linked an issue Nov 28, 2024 that may be closed by this pull request
4 tasks
@0x1026 0x1026 added kind/feature Categorizes issue or PR as related to a new feature. lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. milestone/current Indicates an issue or PR that is being worked on at the current milestone. labels Nov 29, 2024
@0x1026 0x1026 force-pushed the main branch 2 times, most recently from f43896f to a6dd618 Compare December 2, 2024 21:12
0x1026 and others added 6 commits December 2, 2024 22:37
…ss (#141)

This pull request includes significant changes to the database schema
and the organization of the controller files. The most important changes
include the removal of the `roles` table, the modification of the
`users` table, and the reorganization of the controllers to an `Admin`
namespace.

Database schema changes:

* Removed the `roles` table from the database initialization script
(`database/start-scripts/0-init.sql`) and adjusted the `users` table to
include a `role` column instead of a `role_id` foreign key.
[[1]](diffhunk://#diff-72bf1e9917f27a912c8b0028f642b9f88128bcbff602cc0d9a40dea20d7cfc4fL11-R11)
[[2]](diffhunk://#diff-72bf1e9917f27a912c8b0028f642b9f88128bcbff602cc0d9a40dea20d7cfc4fL28-L33)
* Updated the seed script to reflect the removal of the `roles` table
and the changes in the `users` table
(`database/start-scripts/1-seed.sql`).
24Victor and others added 15 commits December 3, 2024 17:20
…raints, and adjusting seed data

Co-authored-by: 24Victor <[email protected]>
This pull request includes significant changes to the database schema
and seed data scripts, focusing on refactoring table structures,
updating foreign key relationships, and enhancing the seed data. The
most important changes include the renaming and restructuring of tables,
the addition of new columns, and the removal of certain tables and
columns.

### Database Schema Changes:

* `database/start-scripts/0-init.sql`: 
- Renamed `task_types` to `tasks`, `pruning_types` to `element_types`,
and added new columns such as `description` and `require_tree_type`.
Removed `photo_id` and associated foreign key constraints from multiple
tables.
- Updated the `zones` table structure by adding new columns and
modifying foreign key relationships. Removed the `zones_predefined` and
`routes` tables.
- Added `deleted_at` and `updated_at` timestamps to several tables
including `work_reports`, `work_report_photos`, `sensors`, and
`sensor_history`.
[[1]](diffhunk://#diff-72bf1e9917f27a912c8b0028f642b9f88128bcbff602cc0d9a40dea20d7cfc4fR209)
[[2]](diffhunk://#diff-72bf1e9917f27a912c8b0028f642b9f88128bcbff602cc0d9a40dea20d7cfc4fR218-R219)
[[3]](diffhunk://#diff-72bf1e9917f27a912c8b0028f642b9f88128bcbff602cc0d9a40dea20d7cfc4fR234-R235)
[[4]](diffhunk://#diff-72bf1e9917f27a912c8b0028f642b9f88128bcbff602cc0d9a40dea20d7cfc4fR249-R250)

### Seed Data Changes:

* `database/start-scripts/1-seed.sql`:
- Added seed data for `element_types`, `tasks`, `zones`, and `elements`.
Updated the seed data for `work_orders`, `work_orders_users`, and
`work_reports`.

These changes aim to streamline the database structure, improve data
integrity, and enhance the initial dataset for better testing and
development.
This pull request includes changes to the URLs in several files to
ensure they follow a consistent structure by adding the `/admin` prefix.
The most important changes include updates to the `Create`, `Edit`, and
`TreeTypes` views.

URL updates for consistency:

*
[`src/app/Views/Admin/TreeType/Create.php`](diffhunk://#diff-b5fc91cbc00701c4904cf5380e8153db0cb8385cb26d21626594cd6c5947df06L2-R2):
Updated the form action URL to `/admin/tree-type/store` and the back
link URL to `/tree-types/`.
[[1]](diffhunk://#diff-b5fc91cbc00701c4904cf5380e8153db0cb8385cb26d21626594cd6c5947df06L2-R2)
[[2]](diffhunk://#diff-b5fc91cbc00701c4904cf5380e8153db0cb8385cb26d21626594cd6c5947df06L14-R14)
*
[`src/app/Views/Admin/TreeType/Edit.php`](diffhunk://#diff-9d33f489f9fadfeea6be89d03ffc68c7262d2cd5622b87c8f986b4e05cd688a3L14-R14):
Updated the form action URL to `/admin/tree-type/<?php echo
htmlspecialchars($tree_type->getId()); ?>/update`.
*
[`src/app/Views/Admin/TreeTypes.php`](diffhunk://#diff-063db1f485a6804bc273aa41160539af023ba642015a5e863be861f5935ded2bL15-R15):
Updated the URLs for creating, editing, and deleting tree types to
include the `/admin` prefix.
[[1]](diffhunk://#diff-063db1f485a6804bc273aa41160539af023ba642015a5e863be861f5935ded2bL15-R15)
[[2]](diffhunk://#diff-063db1f485a6804bc273aa41160539af023ba642015a5e863be861f5935ded2bL49-R49)
[[3]](diffhunk://#diff-063db1f485a6804bc273aa41160539af023ba642015a5e863be861f5935ded2bL58-R58)
This pull request includes multiple changes aimed at enhancing the
project's configuration, dependencies, and workflows. The most
significant updates include modifications to environment variables,
GitHub Actions workflows, and the addition of new files for the API.

### Configuration and Environment Variables:
* Updated `DB_USER` and added `DB_ROOT_PASS` in `.env.example` for
better clarity and security.

### GitHub Actions Workflows:
* Introduced a new job to detect changes and added dependencies for
`pip` in `.github/dependabot.yml`.
* Added file filters in `.github/file-filters.yml` to categorize
changes.
* Enhanced the `main.yml` workflow by adding a job to detect changes,
caching for Python dependencies, and improved SSH deployment
configuration.
[[1]](diffhunk://#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3R17-R54)
[[2]](diffhunk://#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3R104)
[[3]](diffhunk://#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3L91-R114)
[[4]](diffhunk://#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3L113-R136)
[[5]](diffhunk://#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3L144-R177)
* Updated `tests.yml` to include inputs for images and added a new job
for API tests.
[[1]](diffhunk://#diff-1db27d93186e46d3b441ece35801b244db8ee144ff1405ca27a163bfe878957fR5-R14)
[[2]](diffhunk://#diff-1db27d93186e46d3b441ece35801b244db8ee144ff1405ca27a163bfe878957fR38-R43)
[[3]](diffhunk://#diff-1db27d93186e46d3b441ece35801b244db8ee144ff1405ca27a163bfe878957fR60-R104)

### API Development:
* Added `.dockerignore` and `.gitignore` files for the API to exclude
unnecessary files from the Docker build context and Git repository.
[[1]](diffhunk://#diff-378572971045a124a9ed97c06bb4cfbb988080d97b48d7066f78c9b7c135fc9cR1-R34)
[[2]](diffhunk://#diff-29170f7d39ee9a02f2f12814848e5e109bb0c0d48e9ac643e1e22dd5683cc72bR1-R176)
* Created a `Dockerfile` for the API with separate stages for
dependencies, development, testing, and production.
* Added `requirements.txt` and `requirements-dev.txt` for managing API
dependencies.
[[1]](diffhunk://#diff-f380e1392f38d13c3831f35c9f505277739b484c035bc791c21cc6d081845607R1-R14)
[[2]](diffhunk://#diff-db780fd4b730d61b6b337401dde9dd8019689d11865358769ed489c22aef7dcbR1-R5)
* Introduced a new FastAPI application in `api/src/app.py` with database
initialization and sample data insertion.

### Documentation:
* Updated `README.md` with clearer instructions for setting up
environment variables and running the application.

These changes collectively improve the project's setup, dependency
management, and continuous integration workflows, making it easier to
maintain and develop.


## Resources
-
https://github.com/codecov/example-php/blob/main/.github/workflows/ci.yml
-
https://github.com/codecov/example-python/blob/main/.github/workflows/ci.yml
-
https://docs.github.com/en/actions/sharing-automations/reusing-workflows
-
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-jobs-in-a-workflow#defining-prerequisite-jobs
-
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#hashfiles
-
https://gist.github.com/GuillaumeFalourd/1b3755612299523e2602bdc35df7441b
- https://github.com/codecov/codecov-action
- (Not yet)
https://github.com/iamtodor/demo-github-actions-python-linter-configuration/tree/main
-
https://github.com/php-actions/composer?tab=readme-ov-file#passing-arguments
- https://github.com/PhpGt/Database/blob/master/.github/workflows/ci.yml
- https://stackoverflow.com/a/75735736
-
https://github.com/dorny/paths-filter/?tab=readme-ov-file#paths-changes-filter
- (Not yet) https://dev.to/jackmiras/xdebug-in-vscode-with-docker-379l
- https://github.com/sebastianbergmann/phpunit/blob/main/phpunit.xml
-
https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yaml#L187-L226
- (Not yet) https://github.com/sebastianbergmann/php-code-coverage
-
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow
- https://github.com/reproducible-containers/buildkit-cache-dance
- (Not yet) https://docs.docker.com/engine/swarm/services/
- (Not yet) https://docs.docker.com/engine/swarm/stack-deploy/
@github-actions github-actions bot added area/database Categorizes issue or PR as related to database. area/app/views Categorizes issue or PR as related to app/views. area/routes Categorizes issue or PR as related to routes or router. labels Dec 3, 2024
@0x1026 0x1026 closed this Dec 3, 2024
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 9.13621% with 547 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/src/routes/admin.php 0.00% 89 Missing ⚠️
app/src/app/Layouts/Admin/AdminLayout.php 0.00% 50 Missing ⚠️
app/src/app/Layouts/Worker/WorkerLayout.php 0.00% 43 Missing ⚠️
api/src/config.py 0.00% 35 Missing ⚠️
api/src/app.py 0.00% 20 Missing ⚠️
app/src/app/Layouts/BlankLayout.php 0.00% 16 Missing ⚠️
app/src/app/Layouts/Customer/CustomerLayout.php 0.00% 16 Missing ⚠️
api/src/main.py 0.00% 15 Missing ⚠️
app/src/app/Core/View.php 0.00% 14 Missing ⚠️
app/src/app/Controllers/Admin/UserController.php 0.00% 12 Missing ⚠️
... and 37 more
Files with missing lines Coverage Δ Complexity Δ
api/src/schemas/sensor.py 100.00% <100.00%> (ø) 0.00 <0.00> (?)
app/src/app/Core/Logger.php 0.00% <ø> (ø) 2.00 <0.00> (?)
app/src/app/Core/Session.php 0.00% <ø> (ø) 6.00 <0.00> (?)
app/src/app/Layouts/AuthLayout.php 0.00% <ø> (ø) 0.00 <0.00> (?)
app/src/app/Models/BaseModel.php 0.00% <ø> (ø) 56.00 <0.00> (?)
app/src/app/Models/Contract.php 0.00% <ø> (ø) 5.00 <0.00> (?)
app/src/app/Models/Element.php 0.00% <ø> (ø) 5.00 <0.00> (?)
app/src/app/Models/Incidence.php 0.00% <ø> (ø) 5.00 <0.00> (?)
app/src/app/Models/Machine.php 0.00% <ø> (ø) 4.00 <0.00> (?)
app/src/app/Models/Photo.php 0.00% <ø> (ø) 9.00 <0.00> (?)
... and 82 more

@0x1026 0x1026 deleted the issue/105-implement-cookie-preference-storage-using-javascript branch December 12, 2024 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/app/views Categorizes issue or PR as related to app/views. area/database Categorizes issue or PR as related to database. area/routes Categorizes issue or PR as related to routes or router. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. milestone/current Indicates an issue or PR that is being worked on at the current milestone.
Projects
Status: Pendent de revisió o d'exposar
Development

Successfully merging this pull request may close these issues.

Implement Cookie Notice, Preference Storage, and Cookie Policy
6 participants