Skip to content

Commit

Permalink
#1: Add patch to endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Jun 20, 2019
1 parent 9b08dc6 commit 02e44d2
Show file tree
Hide file tree
Showing 37 changed files with 74 additions and 76 deletions.
4 changes: 2 additions & 2 deletions src/resources/entities/applications_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string


Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(APPLICATION, request.json))), 200


class ApplicationsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datacollection_datafiles_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATACOLLECTIONDATAFILE

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATACOLLECTIONDATAFILE, request.json))), 200


class DataCollectionDatafilesWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datacollection_datasets_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATACOLLECTIONDATASET

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATACOLLECTIONDATASET, request.json))), 200


class DataCollectionDatasetsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datacollection_parameters_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATACOLLECTIONPARAMETER

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATACOLLECTIONPARAMETER, request.json))), 200


class DataCollectionParametersWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datacollections_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATACOLLECTION

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATACOLLECTION, request.json))), 200


class DataCollectionsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datafile_formats_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATAFILEFORMAT

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATAFILEFORMAT, request.json))), 200


class DatafileFormatsWithID(Resource):
Expand Down
5 changes: 2 additions & 3 deletions src/resources/entities/datafile_parameters_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATAFILEPARAMETER

Expand All @@ -22,8 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass

return list(map(lambda x: x.to_dict(), patch_entities(DATAFILEPARAMETER, request.json))), 200

class DatafileParametersWithID(Resource):
@requires_session_id
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datafiles_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATAFILE

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATAFILE, request.json))), 200


class DatafilesWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/dataset_type_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATASETTYPE

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATASETTYPE, request.json))), 200


class DatasetTypesWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/datasets_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import DATASET

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(DATASET, request.json))), 200


class DatasetsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/facilities_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import FACILITY

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(FACILITY, request.json))), 200


class FacilitiesWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/facility_cycles_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import FACILITYCYCLE

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(FACILITYCYCLE, request.json))), 200


class FacilityCyclesWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/groupings_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import GROUPING

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(GROUPING, request.json))), 200


class GroupingsWithID(Resource):
Expand Down
5 changes: 2 additions & 3 deletions src/resources/entities/instrument_scientists_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INSTRUMENTSCIENTIST

Expand All @@ -22,8 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass

return list(map(lambda x: x.to_dict(), patch_entities(INSTRUMENTSCIENTIST, request.json))), 200

class InstrumentScientistsWithID(Resource):
@requires_session_id
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/instruments_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INSTRUMENT

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INSTRUMENT, request.json))), 200


class InstrumentsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/investigation_groups_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INVESTIGATIONGROUP

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INVESTIGATIONGROUP, request.json))), 200


class InvestigationGroupsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/investigation_instruments_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INVESTIGATIONINSTRUMENT

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INVESTIGATIONINSTRUMENT, request.json))), 200


class InvestigationInstrumentsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/investigation_parameters_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INVESTIGATIONPARAMETER

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INVESTIGATIONPARAMETER, request.json))), 200


class InvestigationParametersWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/investigation_types_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INVESTIGATIONTYPE

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INVESTIGATIONTYPE, request.json))), 200


class InvestigationTypesWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/investigation_users_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INVESTIGATIONUSER

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INVESTIGATIONUSER, request.json))), 200


class InvestigationUsersWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/investigations_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import INVESTIGATION

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(INVESTIGATION, request.json))), 200


class InvestigationsWithID(Resource):
Expand Down
4 changes: 2 additions & 2 deletions src/resources/entities/jobs_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from flask_restful import Resource

from common.database_helpers import get_row_by_id, delete_row_by_id, update_row_from_id, get_rows_by_filter, \
get_filtered_row_count, get_first_filtered_row, create_row_from_json
get_filtered_row_count, get_first_filtered_row, create_row_from_json, patch_entities
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string
from common.models.db_models import JOB

Expand All @@ -22,7 +22,7 @@ def post(self):
@requires_session_id
@queries_records
def patch(self):
pass
return list(map(lambda x: x.to_dict(), patch_entities(JOB, request.json))), 200


class JobsWithID(Resource):
Expand Down
Loading

0 comments on commit 02e44d2

Please sign in to comment.