31_API #90

Merged
mpeltriaux merged 36 commits from 31_API into master 2022-01-28 16:38:11 +01:00
Owner

Implements #31

Provides full API support for all main data types (Intervention, Compensation, EcoAccount, EMA) as well as EcoAccountDeduction.

Provides sharing via API functionality.

Provides intervention checking via API functionality.

# Implements #31 Provides full API support for all main data types (Intervention, Compensation, EcoAccount, EMA) as well as EcoAccountDeduction. Provides sharing via API functionality. Provides intervention checking via API functionality.
mpeltriaux added 36 commits 2022-01-28 16:36:40 +01:00
* adds new app to project
* adds relation between User model and new APIUserToken model
* adds first implementation for GET of intervention
* adds basic code layout for future extension by having new versions
* adds token checking to AbstractModelAPIView
* adds user accessibility filtering for intervention API v1
* extends fetch_and_serialize() method to take a dict for db filtering instead of a single field and value
* organizes urlnames into supporting formats like "api:v1:intervention"
* enhances intervention fetching and serialization
* adds compensation fetching for API v1
* refactors filter into predefined lookup dict of super class (needs to be customized on subclasses)
* outsources json creation of modified_on an created_on to superclass
* adds API support for fetching ecoaccount data
* adds API support for fetching EMA
* cleans code
* reworks many code fragments into smaller methods and split into super class
* reorganizes code into proper api/utils/serializer subclasses to keep serialization logic away from regular view logic
* adds support for proper POST of intervention
* makes /<id> optional (required for Post)
* adds check for deserializing of konova codes
* splits code in smaller, reusable methods
* adds put method to view
* adds update_model_from_json() method
* cleans code
* reworks many code fragments into smaller methods and split into super class
* adds support for POST of new compensations
* adds shared_users property to BaseObject and Compensation to simplify fetching of shared users (Compensation inherits from intervention)
* extends compensation admin index
* modifies compensation manager which led to invisibility of deleted entries in the admin backend
* fixes bug in sanitize_db.py where CREATED useractions would be removed if they are not found on any log but still are used on the .created attribute of the objects
* adds initialize_objects to an abstractmethod of the super class to be implemented in subclasses
* differentiates error messages if intervention does not exist or is just not shared with the user
* adds documentations
* adds check for valid deadline type
* splits large AbstractModelAPISerializer into different reusable Mixins to increase reusability of code for similar models
* adds support for PUT compensation (Update)
* improves updating of related objects
* adds missing payment PUT support for intervention API
* adds support for returning all shared data
* adds documentation
* adds support for PUT and POST of Ema
* moves set_responsibility() and set_legal() from Intervention API Serializer into proper Mixins where they belong to
* adds support for PUT and POST of EcoAccount API
* adds support for GET /check on intervention to run checks automatically via API
* adds support for GET and PUT of sharing users for all data types (compensation is shared via intervention)
* adds frontend settings for users to create API tokens on their user settings
* sends an email to the support address if a new token has been generated
* writes test for sharing using the API
* fixes bug on frontend form where an exception occured on generating a new API token if no token existed, yet
* adds permission constraint (default group) for using the api in general
* fixes default-group-only behaviour for sharing-API, so users can only add new users and not removing them, as long as they do not have any other group membership like registration or conservation office
* changes 'ksptoken' to 'Ksptoken' to match CGI standard for http header keys
* moves setupTestData in BaseAPITestCase class
* adds creation tests with minimum data for intervention, compensation, ema and ecoaccount
* fixes bug where empty geometry would not be created properly using the API
* reworks key fetching from POST data, so inproperly stated keys will lead to an error for the API user, instead of silently working and use default data
* adds some logical checks for deductable_surface of eco account creation using api
* fixes bug that would have occured on creating compensations via api
* adds support for DELETE method for all relevant objects
* improves get_obj_from_db functionality
* drops custom compensation logic for get_obj_from_db due to improvement of base method
* adds tests for DELETE method of all major data types
* reworks most internal API methods for de/serializing from public to protected visibility
* moves test_api_sharing.py into /share subfolder of tests
* adds tests for api GET method
* fixes bug where non existing geometry could not be serialized properly
* adds tests for PUT method in api
* adds GET/POST/PUT/DELETE support for EcoAccountDeductions
* adds intervention check state reset to all deduction-changing API routes
* adds tests for deduction API
* adds Kspuser as another expected header data to resolve the api user
* adds/updates translations
mpeltriaux merged commit 14a38b43de into master 2022-01-28 16:38:11 +01:00
Sign in to join this conversation.
No description provided.