-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from ral-facilities/34_add_table_specific_endp…
…oints 34 add table specific endpoints
- Loading branch information
Showing
4 changed files
with
215 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from flask_restful import Resource | ||
|
||
from common.database_helpers import get_investigations_for_user, get_investigations_for_user_count, \ | ||
get_facility_cycles_for_instrument, get_facility_cycles_for_instrument_count, \ | ||
get_investigations_for_instrument_in_facility_cycle, get_investigations_for_instrument_in_facility_cycle_count | ||
from common.helpers import requires_session_id, queries_records, get_filters_from_query_string | ||
|
||
|
||
class UsersInvestigations(Resource): | ||
@requires_session_id | ||
@queries_records | ||
def get(self, id): | ||
return get_investigations_for_user(id, get_filters_from_query_string()), 200 | ||
|
||
|
||
class UsersInvestigationsCount(Resource): | ||
@requires_session_id | ||
@queries_records | ||
def get(self, id): | ||
return get_investigations_for_user_count(id, get_filters_from_query_string()), 200 | ||
|
||
|
||
class InstrumentsFacilityCycles(Resource): | ||
@requires_session_id | ||
@queries_records | ||
def get(self, id): | ||
return get_facility_cycles_for_instrument(id, get_filters_from_query_string()), 200 | ||
|
||
|
||
class InstrumentsFacilityCyclesCount(Resource): | ||
@requires_session_id | ||
@queries_records | ||
def get(self, id): | ||
return get_facility_cycles_for_instrument_count(id, get_filters_from_query_string()), 200 | ||
|
||
|
||
class InstrumentsFacilityCyclesInvestigations(Resource): | ||
@requires_session_id | ||
@queries_records | ||
def get(self, instrument_id, cycle_id): | ||
return get_investigations_for_instrument_in_facility_cycle(instrument_id, cycle_id, | ||
get_filters_from_query_string()), 200 | ||
|
||
|
||
class InstrumentsFacilityCyclesInvestigationsCount(Resource): | ||
@requires_session_id | ||
@queries_records | ||
def get(self, instrument_id, cycle_id): | ||
return get_investigations_for_instrument_in_facility_cycle_count(instrument_id, cycle_id, | ||
get_filters_from_query_string()), 200 |