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

[TM-941] Audit Log request support #275

Merged
merged 10 commits into from
Jun 12, 2024

Conversation

pachonjcl
Copy link
Collaborator

@pachonjcl pachonjcl commented Jun 10, 2024

Task Link

Main focus of this PR is to add a update status method for AuditableModel .
Right now we are restricting the approval in Site and SitePolygon based on some conditions.

I also moved some CriteriaSite validation to GeometryHelper so I can reuse the code.

@pachonjcl pachonjcl changed the base branch from staging to epic/audit-log June 10, 2024 16:07
@pachonjcl pachonjcl marked this pull request as ready for review June 11, 2024 19:41
@pachonjcl pachonjcl requested a review from roguenet June 11, 2024 19:44
app/Helpers/GeometryHelper.php Outdated Show resolved Hide resolved
app/Helpers/GeometryHelper.php Outdated Show resolved Hide resolved
@pachonjcl pachonjcl requested a review from roguenet June 12, 2024 02:27
@pachonjcl pachonjcl merged commit 7130eb3 into epic/audit-log Jun 12, 2024
@pachonjcl pachonjcl deleted the feat/TM-941-request-support branch June 12, 2024 17:24
pachonjcl added a commit that referenced this pull request Jun 12, 2024
* add status table

* add attachment table

* add audit-status + site-polygon endpoints

* add swagger definitions for audit status and polygon endpoints

* fix: problem with parameter in open api definition

* fix openapi definitions and test execution

* implement polymorphic association in Audit Status

* fix merge errors and remove duplicated definition

* add AuditStatus attachments with MediaModel

* remove unused methods and files

* remove GetPolygonByProjectController

* replace auditable_id and auditable_type with entity_name

* add AuditStatusRequest to improve endpoint readability

* improve swagger definition

* update swagger definition

* replace EntityModel by AuditableModel

* rename variable

* remove unused table

* remove unused definition and update swagger

* change AuditStatus upload file policy

* address corrections on AuditableModel

* use ModelInterfaceBindingMiddleware on store audit controller

* fix typo and update references in swagger

* rename status table to audit-statuese

* change table name to use underscore

* [TM-843] add endpoint to determine wether a site can be approved (#274)

* add endpoint to determine wether a site can be approved

* improve code for checking site approval

* [TM-944] Enable polygon audit log (#273)

* Add endpoint for listing SitePolygons for a given project

* fix problem with parameters missing in definition

* [TM-941] Audit Log request support (#275)

* add endpoint for updating status

* change EntityModel -> AuditableModel and add missing policy

* move criteria site to helper for reuse

* add criteria check for site polygon approval

* move endpoint to auditable path

* add a policy for updating Site Polygons

* fix problem with parameters missing in definitio

* improve query for criteria site
pachonjcl added a commit that referenced this pull request Jun 24, 2024
* [TM-799] All current validator tests now passing.

* [TM-799] Remove some more references to project_id on site polygon.

* [TM-799] Rename endpoint to sites/{id}/geometry to make it a little more shape agnostic.

* [TM-799] Test the geometry type validation.

* [TM-799] Finished polygon post endpoint.

* [TM-799] Fix use path for polygon validators.

* [TM-800] GH polygon validation endpoint implemented.

* [TM-801] Implement created_by field on site_polygon and polygon_geometry.

* [TM-801] Implement bulk delete of polygons for GH.

* [TM-801] Implement polygon update endpoint for GH

* [TM-838] Regenerate docs post merge

* Get tests and linter passing on staging again

* [TM-913] Add and sync a description text field to workday

* [TM-913] Implement description on workdays as a virtual property on SiteReport.

* [TM-913] Add the new virtual field to ProjectReport as well with a new trait.

* [TM-913] Lint fix

* [TM-913] Fix tests

* [TM-904] Add HBF as a framework permission and admin type.

* [TM-675] Rejigger the old_id / old_model columns on sites and projects.

* [TM-799] Corrected spelling error and verified existence of error attribute.

* [TM-675] Use the ppc_external_id field.

* [TM-838] Avoid breaking when an old update request is merged.

* [TM-838] Include the ppc_external_id on project/site resources.

* [TM-675] Fix up the migration after some testing with a fresh clone of prod.

* [TM-930] Don't attempt to create a permission that already exists.

* [TM-931] Use the ppc_external_id for site id on site report export.

* [TM-931] A migration to copy over the old "other" workdays description to the new virtual field.

* [TM-931] Calculate workday total amounts rather than relying on the report columns.

* [TM-931] Dry up totals calculation.

* [TM-931] Bring back the hasBeenSubmitted constraint

* [TM-931] Include the new workdays format in entity exports.

* [TM-674] Allow searching by ppc external id in the admin sites index.

* [TM-674] Allow searching by ppc external id in the project sites view.

* [TM-931] Lint fix

* [TM-931] Fix unit test that's covering the updated workdays_paid attribute getter.

* [TM-921] Improve the usefulness of this error.

* [TM-921] Add new fields to project pitch, project and site for HBF forms.

* [TM-921] Lint fix.

* [TM-680] Include sum of total seedlings grown to date in project report rows.

* [TM-921] Add states and proj_impact_biodiv

* [TM-738] Support fewer than 0 for "A natural regeneration"

* [TM-921] Update some more pitch mappings after testing.

* [TM-921] Test update

* [TM-898] Update application rejection email copy.

* [TM-928] Include a link to the TM Admin view of sites, nurseries, site reports and nursery reports in export.

* [TM-921] Sync relations on form submissions.

* [TM-921] Land use types and land systems are effectively duplicate fields, so just pull from whichever was used for this form.

* [TM-921] restoration strategy and tree restoration practices are effectively duplicate fields, so just pull from whichever was used for this form.

* [TM-921] Fix using syncRelations for form submissions.

* feat: create Point Geometry table

* fix: make lint-fix

* [TM-921] Fix land tenure property name from project pitch.

* [TM-921] Make sure to include names when copying over tree species.

* [TM-738] For the UI, round values greater than 1 to a whole int.

* [TM-846] Start up controller for Site Polygons data

* [TM-846] fix lint

* [TM-851] Modify Site Polygon table and change reference from est_area to calc_area

* [TM-851] Fix lint

* [TM-938] Aggregate demographics for the site and project workday_count attributes.

* [TM-851] remove unused properties from validate Site Polygon

* [TM-929] Support framework key on nursery index.

* [TM-929] Update test to match filter change.

* [TM-851] include siteId to create Site Polygon controller

* [TM-846] add definition - create Site Polygon controller

* [TM-846] get polygon bounding box

* [TM-853] add polygon and site validation controllers

* [TM-853] Add download functionality for single and complete geojsons

* [TM-846] fix lint

* [TM-853] fix lint

* [TM-853] endpoint to delete polygon and site polygon

* [TM-853] fix lint

* [TM-848] add site id when uploading polygon and recalculate calc_area

* [TM-621] start up jobs created controller

* [TM-658] export dashboard

* [TM-626] start up restoration strategies controller

* [TM-617] start up tree restoration goal controller

* fix lint

* [TM-621] add definition for jobs created controller

* [TM-626] add definition for restoration strategies controller

* [TM-617] add definition for tree restoartion goal  controller

* [TM-658] add definition for project list export controller

* [TM-950] Allow the collection for linked fields to get stored in the DB form question.

* [TM-671] return polygons, project and country data

* [TM-938] Send both the old count and the new count to the client as separate fields.

* [TM-920] Move geometry posting to an endpoint under /v2/geometry

* [TM-920] Create a PointGeometry PHP model class and share the geojson attribute getters from PolygonGeometry.

* [TM-853] add indentation

* [TM-853] remove redundance and nesting

* [TM-848] fix: remove site_id from createGeojsonModels function

* [TM-671] improve queries, remove superfluos code, update Project model from staging

* [TM-853] remove redundan query

* [TM-671] remove inappropiate code, make more idiomatic uses of queries

* [TM-920] Make the validation of Point and Polygon geojsons much more robust.

* [TM-920] Store individual Points in the DB.

* [TM-920] Implement unit tests of StoreGeometryRequest validations.

* [TM-920] Update docs

* [TM-920] Try storing logs as an artifact.

* [TM-920] Run the upload artifact step even if the test step fails.

* [TM-920] Give all steps a real name.

* [TM-920] Avoid a divide by 0 error.

* return fillable values from staging

* [TM-911] Update API responses for projects and sites and their reports to include seeding counts.

* [TM-851 fix merge conflict with createGeojsonModels function]

* [TM-617, 626, 627, 658] remove unnecesary class for activeprojecttableresource

* [TM-617, 626, 627, 658] remove unnecesary parse of class

* [TM-617, 626, 627, 658] move to constant of the class

* [TM-846] make lint fix

* [TM-617, 626, 627, 658] add filter for approved and submitted in PROJECT REPORT

* [TM-617, 626, 627, 658] add filter for approved only in PROJECT REPORT

* [TM-846] fix issues with definitions in openapi src folder

* [TM-617] make lint fix

* [TM-867] sort and filter

* [TM-867] restore view project controller

* [TM-866] fix definitions in openapi src folder

* [TM-866] add missing endpoints polygon uuid

* [TM-866] endpoints for polygon geojson

* [TM-866] Fix endpoints for php lint

* [TM-965] Retype the shared_drive_link columns in order to remove the 255 character limit.

* [TM-911] Update API responses for projects and sites and their reports to include seeding counts.

* [TM-848] fix for multipolygons validation

* [TM-850] openapi definition for polygon functionalities

* [TM-940] Support a new field on site reports to collect metrics on tree regeneration.

* [TM-970] Stop trying to call a script that doesn't exist.

* [TM-850] update polygon attributes definition

* [TM-939] Update timing of PPC report generation.

* [TM-939] Allow the day of the month to be specified.

* [TM-851] convert to post request for polygon validation

* [TM-851] Fix info log for updating centroids

* [TM-851] make lint fix

* [TM-851] remove createdby when saving criteria site

* [TM-886] implement sys_get_temp_dir for upload files

* [TM-886] return indentation

* [TM-754] Respect the filter query param on the tree species API

* [TM-754] Lint fix

* [TM-962] Get Python integrated with our PHP docker image.

* [TM-857] Audit Log and Comment Feature for Project/Site/Polygons (#254)

* add status table

* add attachment table

* add audit-status + site-polygon endpoints

* add swagger definitions for audit status and polygon endpoints

* fix: problem with parameter in open api definition

* fix openapi definitions and test execution

* implement polymorphic association in Audit Status

* fix merge errors and remove duplicated definition

* add AuditStatus attachments with MediaModel

* remove unused methods and files

* remove GetPolygonByProjectController

* replace auditable_id and auditable_type with entity_name

* add AuditStatusRequest to improve endpoint readability

* improve swagger definition

* update swagger definition

* replace EntityModel by AuditableModel

* rename variable

* remove unused table

* remove unused definition and update swagger

* change AuditStatus upload file policy

* address corrections on AuditableModel

* use ModelInterfaceBindingMiddleware on store audit controller

* fix typo and update references in swagger

* rename status table to audit-statuese

* change table name to use underscore

* [TM-843] add endpoint to determine wether a site can be approved (#274)

* add endpoint to determine wether a site can be approved

* improve code for checking site approval

* [TM-944] Enable polygon audit log (#273)

* Add endpoint for listing SitePolygons for a given project

* fix problem with parameters missing in definition

* [TM-941] Audit Log request support (#275)

* add endpoint for updating status

* change EntityModel -> AuditableModel and add missing policy

* move criteria site to helper for reuse

* add criteria check for site polygon approval

* move endpoint to auditable path

* add a policy for updating Site Polygons

* fix problem with parameters missing in definitio

* improve query for criteria site

* [TM-874] get monitoring partner

* [TM-874] make lint fix

* [TM-962] Implemented the PHP service to access the Python script.

* [TM-974] Add the ogr2ogr command as well

* [TM-962] Lint fix

* [TM-961] verify existence of workday_demographics table in migration

* [TM-964] Include UUID in organisation export.

* [TM-987] Enhance the create report took to accept a due date and generate reports for child models of Project.

* Epic/tm 671 dashboard endpoints (#287)

* [TM-631,655] feat: add footer: Country level aggregated data and project list view controller (#260)

* [TM-624,625] feat: add volunteers and average survival rate controller (#257)

* [TM-624,625] feat: add volunteers average survival rate controller

* [TM-624,625] feat: generate make doc

* [TM-624,625] remove the resource class

* [TM-616] feat: add summary statistics header controller (#258)

* [TM-616] feat: add summary statistics header controller

* [TM-616] remove the resource class

* [TM-631,655] feat: add footer: Country level aggregated data and project list view controller (#260)

* [TM-632] feat: add footer to connect to country profiles controller a… (#259)

* [TM-632] feat: add footer to connect to country profiles controller and add a controller to retrieve the list of countries with at least one project.

* [TM-632] remove the resource class

* [TM-968] feat: Add project location controller for centroids (#263)

* [TM-968] feat: Add project location controller for centroids

* [TM-968] remove the resource class

* [TM-967] feat: add project profile information controller (#262)

* [TM-967] feat: add project profile information controller

* [TM-967] remove the resource class and change /v2/dashboard/project-details -> /v2/dashboard/project-details/{project}

* [TM-967] change string uuid ->
Project project

* [TM-628,629] feat: add top 10 project with the most planted  and top … (#256)

* [TM-628,629] feat: add top 10 project with the most planted  and top 20 tree species planted controller

* [TM-628,629] Optimization of the method for retrieving top_tree_species_planted

* [TM-628,629] fix: change by ->groupBy(DB::raw('BINARY name'), 'name')

* [TM-844] feat: add project pipeline controllers (#265)

* [TM-844] feat: add project pipeline controllers

* [TM-631,655] feat: add footer: Country level aggregated data and project list view controller (#260)

* Revert "[TM-631,655] feat: add footer: Country level aggregated data and project list view controller (#260)"

This reverts commit 4a974f7.

* [TM-844] fix: change (Store, Update) request by ProjectPipelineRequest and fix attribute names in ProjectPipeline model

* [TM-844] fix: change attributes to snake_case

* [TM-844] change submittedBy = string -> submittedBy = foreignIdFor

* [TM-671] fixes and lint-fix

* [TM-671] fix lint

* [TM-671] fix lint

* fix openapi definition

* fix openapi definition

---------

Co-authored-by: Limber Mamani <[email protected]>
Co-authored-by: Limber Mamani <[email protected]>

* [TM-848] add execution limit to -1

* [TM-874] relocate view project controller

* [TM-874] add bbox polygon if not found

* [TM-874] fix lint and return bbox only

* [TM-599] Add new roles to users (#289)

* feat: add new roles to users and country and program fields

* feat: add country and program to UserResource

* feat: add isNewRoleUser Conditional to entity policy

* feat: add functions options to new roles

* feat: change primary_role -> user_type

* feat: add country and program to user model

* feat: add primary_role, country and program fields to swagger

---------

Co-authored-by: Jose Carlos Laura Ramirez <[email protected]>

* [TM-848] add memory limit to upload big files

* [TM-975] Add three new fields to project report.

* [TM-847] convert criteriaList to array

* [TM-847] make lint fix

---------

Co-authored-by: Nathan Curtis <[email protected]>
Co-authored-by: cesarLima1 <[email protected]>
Co-authored-by: cesarLima1 <[email protected]>
Co-authored-by: JORGE <[email protected]>
Co-authored-by: Limber Mamani <[email protected]>
Co-authored-by: Limber Mamani <[email protected]>
egrojMonroy pushed a commit that referenced this pull request Nov 1, 2024
* add status table

* add attachment table

* add audit-status + site-polygon endpoints

* add swagger definitions for audit status and polygon endpoints

* fix: problem with parameter in open api definition

* fix openapi definitions and test execution

* implement polymorphic association in Audit Status

* fix merge errors and remove duplicated definition

* add AuditStatus attachments with MediaModel

* remove unused methods and files

* remove GetPolygonByProjectController

* replace auditable_id and auditable_type with entity_name

* add AuditStatusRequest to improve endpoint readability

* improve swagger definition

* update swagger definition

* replace EntityModel by AuditableModel

* rename variable

* remove unused table

* remove unused definition and update swagger

* change AuditStatus upload file policy

* address corrections on AuditableModel

* use ModelInterfaceBindingMiddleware on store audit controller

* fix typo and update references in swagger

* rename status table to audit-statuese

* change table name to use underscore

* [TM-843] add endpoint to determine wether a site can be approved (#274)

* add endpoint to determine wether a site can be approved

* improve code for checking site approval

* [TM-944] Enable polygon audit log (#273)

* Add endpoint for listing SitePolygons for a given project

* fix problem with parameters missing in definition

* [TM-941] Audit Log request support (#275)

* add endpoint for updating status

* change EntityModel -> AuditableModel and add missing policy

* move criteria site to helper for reuse

* add criteria check for site polygon approval

* move endpoint to auditable path

* add a policy for updating Site Polygons

* fix problem with parameters missing in definitio

* improve query for criteria site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants