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

[IMPORT] Embed reusable import module into GeoNature core #2833

Merged
merged 521 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
521 commits
Select commit Hold shift + click to select a range
cbd8456
feat (import,check): replace remaining error code string to enum
jacquesfize Jun 19, 2024
683e835
restore to previous state (mapping update, parent check)
jacquesfize Jun 19, 2024
bef376f
fix test
jacquesfize Jun 19, 2024
bb17165
feat (import,check): move add occhab requirement migration to occhab …
jacquesfize Jun 19, 2024
7406273
wip
jacquesfize Jun 28, 2024
03e08c5
change test import occhab with expected errors
jacquesfize Jul 1, 2024
202f908
feat(check) parent and unique column to entity
Pierre-Narcisi Jul 3, 2024
2215f8a
feat(check) adapt init_validity_row
Pierre-Narcisi Jul 4, 2024
0989263
Fix(checks) move generate uuid at the beginning
Pierre-Narcisi Jul 4, 2024
bf99838
Fix(check) fix the checks, and the uuid gen
Pierre-Narcisi Jul 8, 2024
02a953a
Fix(mapping) fix synthese mapping
Pierre-Narcisi Jul 8, 2024
44aa095
fix(mapping) remove console.log
Pierre-Narcisi Jul 8, 2024
0c7f71d
Fix(mapping) mapped and unmapped number
Pierre-Narcisi Jul 8, 2024
22ca26c
Feat(checks) update test file
Pierre-Narcisi Jul 8, 2024
5a56869
fix(tests) datetime
Pierre-Narcisi Jul 8, 2024
b897eae
Fix(checks) fix datetime error
Pierre-Narcisi Jul 9, 2024
8556401
Fix(checks) fix datetime for real this time
Pierre-Narcisi Jul 9, 2024
4d36502
Fix(checks) fix existing uuid
Pierre-Narcisi Jul 9, 2024
5930562
add boolean type in the import check
jacquesfize May 3, 2024
cf37a21
debug interfields optional condition
jacquesfize May 30, 2024
8714d00
change generate missing uuid call
jacquesfize May 30, 2024
6b97c1c
add requirement in occhab import
jacquesfize May 30, 2024
cc9c4fb
refact migration
jacquesfize May 30, 2024
4c45338
fix the jsonschema
jacquesfize May 30, 2024
834609a
debug inter-field condition between different entities
jacquesfize May 31, 2024
5b1f6ad
Adding duplicate check
Pierre-Narcisi Jun 4, 2024
37fcad9
add comments
Pierre-Narcisi Jun 4, 2024
4d0723c
feat(check) improve check consitancy
Pierre-Narcisi Jun 5, 2024
4328601
fix uuid_generation (in progress)
jacquesfize Jun 5, 2024
76b866a
debug field mapping
jacquesfize Jun 6, 2024
a87f0f7
change update mapping
jacquesfize Jun 6, 2024
3e2b364
update preview valid data route to show list of unique entities
jacquesfize Jun 10, 2024
5b33d17
fix(import,report): correct number of entities imported
jacquesfize Jun 10, 2024
3183f38
fix(import,check) : debug missing uuid
jacquesfize Jun 11, 2024
2659b0f
fix(import,check): fix boolean check
jacquesfize Jun 11, 2024
8f786b3
update test to work with new id checks
jacquesfize Jun 12, 2024
cc32965
feat(import-occhab, check) : start of refactorisation
jacquesfize Jun 14, 2024
92e42f5
feat(import, doc): add docstring and type annotation
jacquesfize Jun 14, 2024
3e2e397
fix(import, naming) : drop 'geography' in geometry related function n…
jacquesfize Jun 14, 2024
d23eb76
feat(import, mapping) : predefined mapping selection is hidden if non…
jacquesfize Jun 14, 2024
0ca7daf
feat(import, check): add docstring + simplify a method signature
jacquesfize Jun 14, 2024
246f4c7
feat(import, check): add numeric type
jacquesfize Jun 14, 2024
36be58d
fix(import,occhab, test) : error source -> datasets were checked befo…
jacquesfize Jun 14, 2024
71663ec
feat (import,occhab,check) rename dfchecks to dataframe_check
jacquesfize Jun 17, 2024
cd6ce80
feat (import, check) add function to get list of required columns for…
jacquesfize Jun 17, 2024
a2c5498
feat(import, error) : create an "enum" to list import error
jacquesfize Jun 18, 2024
1380f22
feat (import,check): move `init_rows_validity` and `check_orphan_rows`
jacquesfize Jun 19, 2024
64964a7
feat (import,check): replace remaining error code string to enum
jacquesfize Jun 19, 2024
0304ee7
restore to previous state (mapping update, parent check)
jacquesfize Jun 19, 2024
7bf1280
feat (import,check): move add occhab requirement migration to occhab …
jacquesfize Jun 19, 2024
16562a4
change test import occhab with expected errors
jacquesfize Jul 1, 2024
991ab4f
feat(check) parent and unique column to entity
Pierre-Narcisi Jul 3, 2024
c710565
feat(check) adapt init_validity_row
Pierre-Narcisi Jul 4, 2024
0da07c5
Fix(checks) move generate uuid at the beginning
Pierre-Narcisi Jul 4, 2024
f8ea7d9
Fix(check) fix the checks, and the uuid gen
Pierre-Narcisi Jul 8, 2024
8c89acb
Fix(mapping) fix synthese mapping
Pierre-Narcisi Jul 8, 2024
7cda766
Fix(mapping) mapped and unmapped number
Pierre-Narcisi Jul 8, 2024
ba6c3f9
Feat(checks) update test file
Pierre-Narcisi Jul 8, 2024
42354f8
Fix(checks) fix datetime error
Pierre-Narcisi Jul 9, 2024
c7cd9c1
Fix(checks) fix existing uuid
Pierre-Narcisi Jul 9, 2024
fb2d8e4
Feat(mapping) adaptating required in form
Pierre-Narcisi Jul 15, 2024
4b6e5d7
merge
Pierre-Narcisi Jul 19, 2024
b865d38
Fix(fields) remove useless fields
Pierre-Narcisi Jul 22, 2024
4b8ebb8
import schema
bouttier Dec 3, 2023
b562ee3
import to synthese
bouttier Dec 3, 2023
c305b7b
import to occhab
bouttier Dec 11, 2023
1227321
add imports backend code from gn_module_import
bouttier Dec 18, 2023
01429e7
add dependencies required for imports
bouttier Dec 18, 2023
4a1f3cc
feat(import) moving import frontend into the core
Pierre-Narcisi Dec 20, 2023
bfd97fa
Fix(destination) add type occhab to module occhab
Pierre-Narcisi Dec 21, 2023
dda5896
fix(celery): move session.remove() in app context
bouttier Jan 9, 2024
9dbff00
permissions: skip caching when no request context
bouttier Jan 9, 2024
35ef7cb
fix(occhab): defaults nomenclature for 'ALL' orga
bouttier Jan 9, 2024
e74a75e
chore(occhab): complete models
bouttier Jan 9, 2024
17aba57
fix(tests/imports): determinist ordering
bouttier Jan 10, 2024
33fa55a
fix(imports): several checks corrections
bouttier Jan 9, 2024
3f7f46b
tests(import/occhab): improve coverage
bouttier Dec 28, 2023
e3e655e
feat(imports/occhab): preprocess transient data
bouttier Jan 9, 2024
557b919
add merge revision following rebase on develop
bouttier Jan 11, 2024
808dc1b
tests: propagates eager task exceptions
bouttier Jan 16, 2024
4446114
tests(import/occhab): assert processed
bouttier Jan 16, 2024
21c46ed
fix(import/occhab): insert fields comment
bouttier Jan 16, 2024
3f87d8c
import: rm synthese specific column on list
bouttier Jan 17, 2024
caa66db
feat(back): list all imports
andriacap Jan 16, 2024
bb31276
fix(tests/import): fixtures
bouttier Jan 25, 2024
ec9544e
fix(occhab): fix edit habitats
Pierre-Narcisi Jan 25, 2024
ae23a31
Fix(occhab) remove import error du to default value creating a non su…
Pierre-Narcisi Jan 25, 2024
49152ed
Feat(destinations) adding destination to modal and moving jdd to uplo…
Pierre-Narcisi Jan 11, 2024
c97c64c
Feat(datasets) managing datasets controls
Pierre-Narcisi Jan 12, 2024
11447b1
Feat(import) fetch module in destination for datasets
Pierre-Narcisi Jan 15, 2024
a922d0d
Feat(destinations) adding destination to modal and moving jdd to uplo…
Pierre-Narcisi Jan 11, 2024
efcdae6
Feat(import) fetch module in destination for datasets
Pierre-Narcisi Jan 15, 2024
6f2f7eb
Feat(destination) add destination tu api calls in frontend, using rou…
Pierre-Narcisi Jan 17, 2024
2a4192f
Feat(destination) Multilingue and fix navigation
Pierre-Narcisi Jan 18, 2024
979f9ba
feat(notifications): make notifs for import-done destination-generic
VincentCauchois Jan 23, 2024
84bffca
feat: add tab to handle multiple entities in fields-mapping-step
edelclaux Feb 2, 2024
a2e64d5
lint: apply prettier to fields-mapping-step.component.html
edelclaux Feb 2, 2024
ab08385
fix(import): access to import report from several places
Pierre-Narcisi Feb 1, 2024
d32ffe1
fix(import): download file and delete import from imports list
Pierre-Narcisi Feb 1, 2024
f4587b0
feat: remove specific id_source col
andriacap Jan 30, 2024
6620159
feat: add optional destination to getImportList
andriacap Jan 30, 2024
13decf8
feat: add select destination component
andriacap Jan 30, 2024
c4b635e
feat: add column destination to list import
andriacap Jan 30, 2024
d982b40
test(back): add test on sort destination.code
andriacap Jan 31, 2024
bf8579c
style: change ux filter destination and language
andriacap Jan 31, 2024
089e22a
feat: fieldmapping synchro
edelclaux Feb 2, 2024
9daed5d
fix backend test
jacquesfize Feb 14, 2024
13bf71b
feat: remove taxa_count and add stats in report
andriacap Feb 13, 2024
870f242
front: add upload to config i18n
andriacap Feb 13, 2024
5b30d72
feat: add btn "Upload" to synthese component
andriacap Feb 13, 2024
d10c4cf
fix(style): html and css for occhab page
andriacap Feb 13, 2024
56fbe6c
refact: use different way to use module_code
andriacap Feb 14, 2024
f8063cf
feat: add conditional display btn based on cruved
andriacap Feb 14, 2024
8ef2655
feat(front): add cruved Import srvc into occhab and synthese
andriacap Feb 19, 2024
765d248
Feat(destination) getting destination in modules
andriacap Feb 19, 2024
0b436e9
feat(import): add statistics display in import list
edelclaux Feb 13, 2024
896e857
feat(import): move geom_from_area_code to synthese imports
edelclaux Feb 20, 2024
6db4d50
feat: group field by entity in report
andriacap Feb 7, 2024
f179c9d
feat(import): use geom_4326 instead of transform(geom, 4326)
edelclaux Feb 20, 2024
3717cdb
feat(import): add statistics labels
bouttier Feb 5, 2024
09d156c
import: geo checks fixes
bouttier Feb 21, 2024
ac02ae0
feat/add-constraint-t_habitats.id_nomenclature_community_interest
edelclaux Feb 7, 2024
09c28e4
feat(checks) manage multi in checks
Pierre-Narcisi Feb 12, 2024
8fb8394
feat(metadata) fix import button
Pierre-Narcisi Feb 14, 2024
c55b88e
feat: add test for line number errors
andriacap Feb 15, 2024
cc49c79
import: simplify errors csv test
bouttier Feb 21, 2024
45bacc9
feat(import): add entity handling in error report
edelclaux Feb 22, 2024
df3a653
fix(import): entity & errors
bouttier Feb 22, 2024
0ecceef
feat(import): enum based error in import step component + remove comm…
edelclaux Feb 12, 2024
bebb0e9
feat(import): improve error displayed
edelclaux Feb 12, 2024
80515cc
fix search on import list
jacquesfize Feb 22, 2024
67c14f2
debug import list filters
jacquesfize Feb 29, 2024
ef4fac4
fix lint
jacquesfize Mar 6, 2024
5679e7a
doc(test): add todos for occhab impor test
edelclaux Feb 20, 2024
28146aa
fix: label stats in report pdf
andriacap Feb 28, 2024
74454dc
merge alembic branch
jacquesfize Mar 8, 2024
2c16232
fix rebase error
jacquesfize Mar 8, 2024
ae998ad
feat (mapping, import) renaming data service and variables (less ambi…
jacquesfize Mar 18, 2024
abb746d
add CruvedWithScope interface + function to parse the latter to boole…
jacquesfize Mar 18, 2024
d049cd9
Feat(mapping) controling entities controls and adding a badge
Pierre-Narcisi Mar 18, 2024
7ac0d60
(fix) badge computation no longer block the from validation process
jacquesfize Mar 18, 2024
2678d9b
remove last trace of synthese in fields-mapping component
jacquesfize Mar 19, 2024
d2a6f85
feat(import list, statistic): enable generic tooltip in the import list
jacquesfize Mar 15, 2024
e23a96f
feat(import report filename) : add item in import configuration
jacquesfize Mar 15, 2024
8c7d141
feat(import report filename) : add function to generate report filename
jacquesfize Mar 15, 2024
d57fb58
feat(import report filename) : add import default value in default_co…
jacquesfize Mar 15, 2024
fa8586c
fix lint + refact
jacquesfize Mar 15, 2024
5abcd00
indicate unused import configuration variable
jacquesfize Mar 15, 2024
3ed8d31
update defaut_config toml
jacquesfize Mar 15, 2024
052e0af
Feat(mapping) sort mapping and put a ng-select
Pierre-Narcisi Mar 15, 2024
61ec426
debug rebase
jacquesfize Apr 8, 2024
ec76b67
apply lint
jacquesfize Apr 8, 2024
accbc18
Feat(mapping) skip content mapping if not necessary
Pierre-Narcisi Apr 16, 2024
912b30a
add imports backend code from gn_module_import
bouttier Dec 18, 2023
bc8e4c3
feat: add btn "Upload" to synthese component
andriacap Feb 13, 2024
c546b2a
Feat(import) add mapping_condition
Pierre-Narcisi Mar 20, 2024
80fdba6
Fix rebase
Pierre-Narcisi Apr 11, 2024
7b84c43
(import,mapping): debug on next step
jacquesfize Apr 12, 2024
a14df7f
add new column to store field -to-field condition in the DB
jacquesfize Apr 15, 2024
ba07c85
feat(mapping,import) : add field to field condition
jacquesfize Apr 15, 2024
ba92768
fix(mapping) stepper
Pierre-Narcisi Apr 15, 2024
d3f18df
hint on conditional fields
jacquesfize Apr 15, 2024
562ae8f
Fix(mapping) fix migrations downgrade
Pierre-Narcisi Apr 16, 2024
c41c02a
feat(import, mapping): Change Required and Optional message
jacquesfize Apr 16, 2024
a6910fe
delete last code line for hiding automatically associated
jacquesfize Apr 16, 2024
c63cc79
debug test backend
jacquesfize Apr 16, 2024
faaa2c3
Feat(mapping) put back the lines with the number of remaining sources…
Pierre-Narcisi Apr 18, 2024
495ab79
Feat(mapping) Modify translation
Pierre-Narcisi Apr 18, 2024
8e913c7
feat(conditional mapping fields) : add constraint check
jacquesfize Apr 19, 2024
edcc56d
feat(import, conditional-fields): add comment
jacquesfize Apr 22, 2024
82db59e
fix check error due to new requirement rules + add docstring
jacquesfize Apr 24, 2024
d316ed3
debug ci
jacquesfize Apr 24, 2024
6d204dd
feat: add the display destination into the import process wizard
edelclaux Apr 24, 2024
9586eb7
feat(import): add generic plot
jacquesfize Apr 24, 2024
37d9d56
add documentation from gn_module_import
jacquesfize Apr 16, 2024
c169c01
fix: regenerate requirements.txt for prod and dev after the addition …
edelclaux Apr 26, 2024
6eb8e60
feat(import, test) : add test
edelclaux Apr 25, 2024
43a0d10
feat(report,import): replace the barplot by a piechart
jacquesfize Apr 30, 2024
d5ef823
chore: refacto pdf report map and chart handling on frontend
edelclaux Apr 30, 2024
80ef2a8
add imports backend code from gn_module_import
bouttier Dec 18, 2023
26bd726
Add destination dataset in the header stepper
jacquesfize May 2, 2024
4df9329
fix rebase
jacquesfize May 6, 2024
4880270
feat(import, stepper): add filename in the infobox
jacquesfize May 6, 2024
937d7bb
fix lint scss
jacquesfize May 6, 2024
5a2ba7a
add occhab plot
jacquesfize May 13, 2024
f3adf56
feat: add "description" column in Correspondances > Champs array
edelclaux May 10, 2024
d65527d
feat(import): modify display logic of map for imported data
VincentCauchois Apr 26, 2024
6b5d18d
refact(route): document and clarify preview_valid_data route
VincentCauchois Apr 26, 2024
4995908
feat(import,module+bbox) new bbox computation + change ImportModule s…
edelclaux Apr 29, 2024
7b96bb7
add missing import due to rebase
jacquesfize May 24, 2024
db8f98f
allow negative altitude
Pierre-Narcisi May 29, 2024
e6282af
fix: statistics tooltip display
edelclaux May 28, 2024
4087502
feat(import,synthese): add the possibility to declare jdd in the impo…
andriacap Mar 5, 2024
fd291fc
fix rebase
jacquesfize Jul 25, 2024
64bd4ee
Merge remote-tracking branch 'origin/feat/import' into feat/occhab-check
jacquesfize Jul 26, 2024
fd5e3e2
modification due to merge
jacquesfize Jul 26, 2024
e83324f
chore: repalce abc abstract by raise NotImplementedError in ImportMixin
edelclaux Jul 26, 2024
62274c9
add SKIP_EXISTING_UUID and change requirement of occhab import
jacquesfize Jul 26, 2024
0cf4473
add depthmax and altitude_max requirements
jacquesfize Jul 26, 2024
362f97f
fix migrations: remove usage of models
bouttier Aug 8, 2024
ba3c9fd
import: fix fields conditions
bouttier Aug 8, 2024
c1c2550
synthese_import_mixin.py -> mixins.py
bouttier Jul 11, 2024
72d0a36
rework occhab checks and UUID handling
bouttier Jul 15, 2024
93a44dd
fix occhab checks to handle GEN_MISSING_UUID=False
bouttier Jul 16, 2024
8e21e65
rename types to cast to avoid conflict with lib
bouttier Jul 23, 2024
f5fcdf2
rework check_required_values
bouttier Jul 23, 2024
dd55c5e
remove renamed old file geography.py
bouttier Aug 9, 2024
038a491
enable CI for PR on feat/occhab-check
bouttier Aug 10, 2024
41867e9
fix(import): per dataset uuid check
bouttier Aug 10, 2024
975ddd9
fix(occhab): add server_default=FetchedValue()
bouttier Aug 10, 2024
52b5723
import: add Entity.childs relationship
bouttier Aug 10, 2024
0475f62
import occhab: check foreign habs before deletion
bouttier Aug 10, 2024
2de725b
Merge remote-tracking branch 'origin/feat/import' into feat/occhab-check
bouttier Aug 14, 2024
3cc485f
Merge remote-tracking branch 'origin/develop' into feat/occhab-check
bouttier Aug 14, 2024
513a2b9
adapt check_cd_nom to taxhub v2 model changes
jacquesfize Aug 7, 2024
0ed2149
import_mixin -> actions
bouttier Aug 18, 2024
8eb917f
add merge revision following develop merge
bouttier Sep 13, 2024
e738c06
ci: enable pytest & cypress on branch feat/import
bouttier Sep 13, 2024
6a258b0
fix test following taxhub v2 merge
bouttier Sep 13, 2024
5b73ada
fixup! import_mixin -> actions
bouttier Sep 13, 2024
50d271d
add clue on possible exception
bouttier Sep 19, 2024
d64cff9
Fix(mapping) fix mapping
Pierre-Narcisi Sep 16, 2024
785bbb3
Merge remote-tracking branch 'origin/develop' into feat/import
bouttier Sep 19, 2024
86d3620
fix "1+n" issue in import list
bouttier Sep 19, 2024
9979383
import: factorize bounding box
bouttier Sep 13, 2024
8502838
fix(import) remove mandatory from nom_cite
Pierre-Narcisi Sep 24, 2024
08413bd
feat(import,occhab): add default mapping
jacquesfize Jul 19, 2024
60b69af
feat (mapping, import) : hide jdd selection form
jacquesfize Sep 30, 2024
a1385a9
fix(test) : add temp fixture to set gn_imports.unique_dataset_id.disp…
jacquesfize Oct 1, 2024
5e42ac1
fix (test): move new fixture in test import synthese
jacquesfize Oct 1, 2024
523f48d
Feat(import) add check and tests (#3200)
Pierre-Narcisi Oct 1, 2024
9d58d07
[IMPORT] update import report (#3223)
jacquesfize Oct 11, 2024
0a459e9
[IMPORT] Extending jdd checks by verifying its active status (#3221)
jacquesfize Oct 11, 2024
cd74e5f
fix(import, list) : debug hidden icon + debub error file download
jacquesfize Oct 11, 2024
c7bb770
[IMPORT] add permission check for habitat imported on existing statio…
jacquesfize Oct 15, 2024
c98a1cc
feat: uniformize import report and list design
edelclaux May 16, 2024
ae9bb1a
feat(import) : Filter destinations based on a user's permissions (#3211)
jacquesfize Oct 17, 2024
6debe10
feat(report,synthese): move sources to id_import for imported obs + g…
Pierre-Narcisi Oct 17, 2024
615eb73
[IMPORT] Migration adjustement for import v3 (#3234)
jacquesfize Oct 21, 2024
bfc16e2
feat(import): move import count to statistics (#3235)
jacquesfize Oct 21, 2024
bfcdfb3
Fix(backend) fix used path for link tosee import in destination
Pierre-Narcisi Oct 21, 2024
433b4a9
fix(import): revert scope removal for the `IMPORT`+`C` permission
jacquesfize Oct 22, 2024
17e1906
feat(import, occhab) : Extend the bbox computation to habitat importe…
jacquesfize Oct 22, 2024
74ed265
Merge remote-tracking branch 'origin/develop' into feat/import
jacquesfize Oct 22, 2024
da9eea4
Fix/synthese scrolls (#3233)
Pierre-Narcisi Oct 23, 2024
a487cfa
fix(celery): make new FlaskCelery class work with import tests (#3237)
jacquesfize Oct 23, 2024
c1b99c3
feat(jdd) check private jdd blurring
Pierre-Narcisi Oct 24, 2024
33caae6
feat(import) : Clean code before merge (#3238)
jacquesfize Oct 28, 2024
28f1811
feat(ci): remove feat/import from pytest CI
jacquesfize Oct 28, 2024
c08661d
Feat(migration) linearisation of the geonature branch (for import)
Pierre-Narcisi Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 17 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ on:
- master
- hotfixes
- develop
- fixtestfront
- feat/import
pull_request:
branches:
- master
- hotfixes
- develop
- feat/import

jobs:
mount_app_and_run_cypress:
Expand All @@ -31,6 +32,15 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Add postgis_raster database extension
Expand Down Expand Up @@ -110,12 +120,18 @@ jobs:
geonature db upgrade occhab-samples@head
geonature install-gn-module contrib/gn_module_validation VALIDATION --build=false
geonature permissions supergrant --group --nom "Grp_admin" --yes
geonature db upgrade import-samples@head
Pierre-Narcisi marked this conversation as resolved.
Show resolved Hide resolved
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Run GeoNature backend
run: geonature dev_back &
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Run celery
run: celery -A geonature.celery_app:app worker &
working-directory: ./backend/geonature/
env:
GEONATURE_CONFIG_FILE: "${{ github.workspace }}/config/test_config.toml"
- name: Cypress run
uses: cypress-io/github-action@v5
with:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ on:
- master
- hotfixes
- develop
- feat/import
pull_request:
branches:
- master
- hotfixes
- develop
- feat/import

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -46,6 +47,15 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
jacquesfize marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion backend/geonature/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def create_app(with_external_mods=True):
if "CELERY" in app.config:
from geonature.utils.celery import celery_app

celery_app.init_app(app)
# celery_app.init_app(app)
celery_app.conf.update(app.config["CELERY"])

# Emails configuration
Expand Down Expand Up @@ -218,6 +218,7 @@ def set_sentry_context():
("geonature.core.gn_profiles.routes:routes", "/gn_profiles"),
("geonature.core.sensitivity.routes:routes", None),
("geonature.core.notifications.routes:routes", "/notifications"),
("geonature.core.imports.blueprint:blueprint", "/import"),
]:
module_name, blueprint_name = blueprint_path.split(":")
blueprint = getattr(import_module(module_name), blueprint_name)
Expand Down
5 changes: 4 additions & 1 deletion backend/geonature/celery_app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .app import create_app
from .utils.celery import celery_app as app
from .utils.module import iter_modules_dist
from .utils.env import db

Check warning on line 4 in backend/geonature/celery_app.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/celery_app.py#L4

Added line #L4 was not covered by tests


flask_app = create_app()
Expand All @@ -9,7 +10,9 @@
class ContextTask(app.Task):
def __call__(self, *args, **kwargs):
with flask_app.app_context():
return self.run(*args, **kwargs)
result = self.run(*args, **kwargs)
db.session.remove()
return result

Check warning on line 15 in backend/geonature/celery_app.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/celery_app.py#L13-L15

Added lines #L13 - L15 were not covered by tests


app.Task = ContextTask
Expand Down
3 changes: 2 additions & 1 deletion backend/geonature/core/gn_commons/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def list_modules():
query = (
select(TModules)
.options(joinedload(TModules.objects))
.options(joinedload(TModules.destination))
.where(TModules.module_code.notin_(exclude))
.order_by(TModules.module_order.asc())
.order_by(TModules.module_label.asc())
Expand All @@ -80,7 +81,7 @@ def list_modules():
# HACK : on a besoin d'avoir le module GeoNature en front pour l'URL de la doc
if module.module_code == "GEONATURE":
module_allowed = True
module_dict = module.as_dict(fields=["objects"])
module_dict = module.as_dict(fields=["objects", "destination.code"])
# TODO : use has_any_permissions instead - must refactor the front
module_dict["cruved"] = {
action: get_scope(action, module_code=module.module_code, bypass_warning=True)
Expand Down
14 changes: 2 additions & 12 deletions backend/geonature/core/gn_meta/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from geonature.utils.env import DB, db
from geonature.core.gn_synthese.models import (
Synthese,
TSources,
CorAreaSynthese,
)
from geonature.core.gn_permissions.decorators import login_required
Expand Down Expand Up @@ -244,14 +243,9 @@ def uuid_report():
select(Synthese)
.where(Synthese.id_module == id_module if id_module is not None else True)
.where(Synthese.id_dataset == ds_id if ds_id is not None else True)
.where(Synthese.id_import == id_import if id_import is not None else True)
)

# TODO test in module import ?
if id_import:
query = query.outerjoin(TSources, TSources.id_source == Synthese.id_source).where(
TSources.name_source == f"Import(id={id_import})"
)

query = query.order_by(Synthese.id_synthese)

data = [
Expand Down Expand Up @@ -323,13 +317,9 @@ def sensi_report(ds_id=None):
.where(LAreas.id_type == func.ref_geo.get_id_area_type("DEP"))
.where(Synthese.id_module == id_module if id_module else True)
.where(Synthese.id_dataset == ds_id)
.where(Synthese.id_import == id_import if id_import else True)
)

if id_import:
query = query.outerjoin(TSources, TSources.id_source == Synthese.id_source).where(
TSources.name_source == "Import(id={})".format(id_import)
)

query = query.group_by(
Synthese.id_synthese, TNomenclatures.cd_nomenclature, TNomenclatures.label_fr
)
Expand Down
1 change: 1 addition & 0 deletions backend/geonature/core/gn_monitoring/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def get_site_areas(id_site):
params = request.args

query = (
# TODO@LAreas.geom_4326
select(corSiteArea, func.ST_Transform(LAreas.geom, 4326))
.join(LAreas, LAreas.id_area == corSiteArea.c.id_area)
.where(corSiteArea.c.id_base_site == id_site)
Expand Down
20 changes: 13 additions & 7 deletions backend/geonature/core/gn_permissions/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import sqlalchemy as sa
from sqlalchemy.orm import joinedload
from flask import g
from flask import has_request_context, g

from geonature.core.gn_commons.models import TModules
from geonature.core.gn_permissions.models import (
Expand Down Expand Up @@ -50,9 +50,12 @@
def get_user_permissions(id_role=None):
if id_role is None:
id_role = g.current_user.id_role
if id_role not in g._permissions_by_user:
g._permissions_by_user[id_role] = _get_user_permissions(id_role)
return g._permissions_by_user[id_role]
if has_request_context():
if id_role not in g._permissions_by_user:
g._permissions_by_user[id_role] = _get_user_permissions(id_role)
return g._permissions_by_user[id_role]
else:
return _get_user_permissions(id_role)

Check warning on line 58 in backend/geonature/core/gn_permissions/tools.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/core/gn_permissions/tools.py#L58

Added line #L58 was not covered by tests


def _get_permissions(id_role, module_code, object_code, action_code):
Expand Down Expand Up @@ -93,9 +96,12 @@
object_code = "ALL"

ident = (id_role, module_code, object_code, action_code)
if ident not in g._permissions:
g._permissions[ident] = _get_permissions(*ident)
return g._permissions[ident]
if has_request_context():
if ident not in g._permissions:
g._permissions[ident] = _get_permissions(*ident)
return g._permissions[ident]
else:
return _get_permissions(*ident)

Check warning on line 104 in backend/geonature/core/gn_permissions/tools.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/core/gn_permissions/tools.py#L104

Added line #L104 was not covered by tests


def get_scope(action_code, id_role=None, module_code=None, object_code=None, bypass_warning=False):
Expand Down
1 change: 1 addition & 0 deletions backend/geonature/core/gn_synthese/imports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Loading