Ejemplo n.º 1
0
        # if current_user and current_user.is_authenticated:
        solar_data = solar_service.get_detail(solarid)
        if solar_data:
            data = solar_data.to_dict()
            data['panels'] = solar_data.get_panels_data()
            data["photos"] = solar_data.get_photos_data()
            return data
        abort(404, message="Solar id={0} not found".format(solarid))
        # abort(401, message="Requires user to login")

    def put(self, solarid):
        data = request.json
        log.debug("Edit Solar request {0}: {1}".format(solarid, data))
        # TODO check authenticated user
        # if current_user and current_user.is_authenticated:
        try:
            solar_data = solar_service.update_from_dict(solarid, data)
            result = dict(status=200, message="OK", solar=solar_data)
            return marshal(result, solar_create_fields)
        except SolarNotFoundError as err:
            abort(404, message=err.message)
            # abort(401, message="Requires user to login")


rest_api.add_resource(SolarsResource, '/api/solars')
rest_api.add_resource(SolarDetailResource, '/api/solars/<int:solarid>')




Ejemplo n.º 2
0
        try:
            audit = sign_audit(audit_id, uploaded_file)
            result = dict(status=200, message="OK", audit=audit)
            return marshal(result, audit_create_fields)
        except AuditNotFoundError as err:
            abort(404, message=err.message)

    def put(self, audit_id):
        """ PUT /api/audits/<audit_id>/signature """
        log.debug(
            "PUT Upload Audit Signature Photo request id={0} files={1} form data={2}"
            .format(audit_id, request.files, request.form))
        uploaded_file = request.files['file']
        signature_id = request.form.get('signature[id]')
        try:
            signature = update_audit_signature(audit_id, signature_id,
                                               uploaded_file)
            result = dict(status=200, message="OK", signature=signature)
            return marshal(result, signature_create_fields)
        except (AuditNotFoundError, AuditSignatureNotFoundError) as err:
            abort(404, message=err.message)


rest_api.add_resource(AuditTemplatesResource, '/api/audit_templates')
rest_api.add_resource(AuditTemplateDetailsResource,
                      '/api/audit_templates/<int:audit_template_id>')
rest_api.add_resource(AuditsResource, '/api/audits')
rest_api.add_resource(AuditDetailsResource, '/api/audits/<int:audit_id>')
rest_api.add_resource(AuditSignatureResource,
                      '/api/audits/<int:audit_id>/signature')
Ejemplo n.º 3
0
#     """
#
#     @marshal_with(section_complete_fields)
#     def get(self, c_id):
#         log.debug('GET Crematorium request id={0}: {1}'.format(c_id, request.json))
#         section = section_service.get_section(c_id)
#         if section:
#             data = section.to_dict()
#             data['blocks'] = section.get_blocks()
#             return data
#         abort(404, message="Crematorium id={0} not found".format(c_id))
#
#     def put(self, c_id):
#         """ PUT /api/crematorium/<c_id> """
#         form_data = request.json
#         log.debug('Update Crematorium request id {0}: {1}'.format(c_id, form_data))
#         form = AddSectionForm.from_json(form_data)
#         if form.validate():
#             try:
#                 section = section_service.update_from_dict(c_id, form_data)
#                 result = dict(status=200, message='OK', section=section)
#                 return marshal(result, section_create_fields)
#             except CrematoriumNotFoundError as err:
#                 abort(404, message=err.message)
#         else:
#             abort(400, message="Invalid Parameters", errors=form.errors)


rest_api.add_resource(CrematoriumResource, '/api/crematorium')
# rest_api.add_resource(CrematoriumDetailResource, '/api/crematorium/<int:c_id>')
Ejemplo n.º 4
0
def init_all():
    rest_api.add_resource(SubjectsListResource, api_prefix + '/subjects/')
    rest_api.add_resource(StudentResource, api_prefix + '/student/<string:vk_id>')
    rest_api.add_resource(NotificationsListResource, api_prefix + '/notifications/<int:last_id>')
    rest_api.add_resource(StudentsToGroupsResource, api_prefix + '/students_to_groups/')
    rest_api.add_resource(StudentDeclinesResource, api_prefix + '/student_declines/<string:vk_id>')
Ejemplo n.º 5
0
API_UNITS = {
	'm':'SI meters', 
	's':'SI seconds'
	}


class SiteList(restful.Resource):
	def get(self):
		api_response = ApiResponse()
		sites = Site.query.all()
		for site in sites: api_response += site
		# print api_response.json()
		return api_response.json()

rest_api.add_resource(SiteList, '/sites')

class SiteResource(restful.Resource):
	def get(self, site_id):
		response = ApiResponse(request)
		site = Site.query.filter_by(id = site_id).first()
		if site:
			response += site
		else:
			response += exc.MissingResourceException(type(self), site_id)
		return response.json()

	def delete(self, site_id):
		response = ApiResponse(request)
		site = Site.query.filter_by(id = site_id).first()
		if site:
Ejemplo n.º 6
0
from files import api as files_api
from events import api as events_api
from reviews import api as reviews_api
from invitedGuest import api as invitedGuest_api
from references import api as reference_api
from registration import api as registration_api
from registrationResponse import api as registration_response
from guestRegistrations import api as guest_registration
from invitationletter import api as invitation_letter_api
from attendance import api as attendance_api
from organisation import api as organisation_api
from integration_tests import api as integration_tests_api
from outcome import api as outcome_api
from tags import api as tag_api

rest_api.add_resource(users_api.UserAPI, '/api/v1/user')
rest_api.add_resource(users_api.UserCommentAPI, '/api/v1/user-comment')
rest_api.add_resource(users_api.AuthenticationAPI, '/api/v1/authenticate')
rest_api.add_resource(users_api.AuthenticationRefreshAPI,
                      '/api/v1/authenticationrefresh')
rest_api.add_resource(users_api.PasswordResetRequestAPI,
                      '/api/v1/password-reset/request')
rest_api.add_resource(users_api.PasswordResetConfirmAPI,
                      '/api/v1/password-reset/confirm')
rest_api.add_resource(users_api.AdminOnlyAPI, '/api/v1/admin')
rest_api.add_resource(users_api.EmailerAPI, '/api/v1/admin/emailer')
rest_api.add_resource(form_api.ApplicationFormAPI, '/api/v1/application-form')
rest_api.add_resource(responses_api.ResponseAPI, '/api/v1/response')
rest_api.add_resource(content_api.CountryContentAPI,
                      '/api/v1/content/countries')
rest_api.add_resource(files_api.FileUploadAPI, '/api/v1/file')
Ejemplo n.º 7
0
            # form = DelegateActionForm.from_json(form_data['data'])
            # if form.validate():
            response = respond_to_action(action_id, current_user.id, form_data)
            result = dict(status=200, message='OK', response=response)
            return marshal(result, action_response_create_fields)
            # else:
            #     abort(400, message="Invalid Parameters", errors=form.errors)
        abort(401, message="Requires user to login")


class MarkDoneActionResource(Resource):
    """
    Resource for Marking action as done
    """
    def put(self, action_id):
        """ POST /api/actions/<action_id>/done """
        if current_user and current_user.is_authenticated:
            log.debug('Marking action as done request')
            action = mark_action_done(action_id, current_user.id)
            result = dict(status=200, message='OK', action=action)
            return marshal(result, action_create_fields)
        abort(401, message="Requires user to login")


rest_api.add_resource(ActionsResource, '/api/actions')
rest_api.add_resource(ActionDetailsResource, '/api/actions/<int:action_id>')
rest_api.add_resource(ActionResponseResource,
                      '/api/actions/<int:action_id>/responses')
rest_api.add_resource(MarkDoneActionResource,
                      '/api/actions/<int:action_id>/done')
Ejemplo n.º 8
0
log = logging.getLogger(__name__)


class SchemasResource(Resource):
    """
    Resource for getting all FormSchema json files
    """

    @marshal_with(schema_fields)
    def get(self):
        if current_user and current_user.is_authenticated:
            return get_form_schemas()
        abort(401, message="Requires user to login")


class SchemasDetailResource(Resource):
    """
    Resource for FormSchema Detail json files
    """

    def post(self, name):
        if current_user and current_user.is_authenticated:
            update_form_schema(name, request.json)
            return dict(status=200, message="OK")
        abort(401, message="Requires user to login")


rest_api.add_resource(SchemasResource, '/api/form_schemas')
rest_api.add_resource(SchemasDetailResource, '/api/form_schemas/<name>')
Ejemplo n.º 9
0
from app import rest_api
from users import api as users_api


rest_api.add_resource(users_api.UserAPI, '/api/v1/user')
rest_api.add_resource(users_api.AuthenticationAPI, '/api/v1/authenticate')
rest_api.add_resource(users_api.PasswordResetRequestAPI,
                      '/api/v1/password-reset/request')
rest_api.add_resource(users_api.PasswordResetConfirmAPI,
                      '/api/v1/password-reset/confirm')
rest_api.add_resource(users_api.VerifyEmailAPI,
                      '/api/v1/verify-email'),
rest_api.add_resource(users_api.ResendVerificationEmailAPI,
                      '/api/v1/resend-verification-email'),
rest_api.add_resource(users_api.UserProfileList, '/api/v1/userprofilelist')
Ejemplo n.º 10
0
#     """
#
#     @marshal_with(section_complete_fields)
#     def get(self, c_id):
#         log.debug('GET Crematorium request id={0}: {1}'.format(c_id, request.json))
#         section = section_service.get_section(c_id)
#         if section:
#             data = section.to_dict()
#             data['blocks'] = section.get_blocks()
#             return data
#         abort(404, message="Crematorium id={0} not found".format(c_id))
#
#     def put(self, c_id):
#         """ PUT /api/crematorium/<c_id> """
#         form_data = request.json
#         log.debug('Update Crematorium request id {0}: {1}'.format(c_id, form_data))
#         form = AddSectionForm.from_json(form_data)
#         if form.validate():
#             try:
#                 section = section_service.update_from_dict(c_id, form_data)
#                 result = dict(status=200, message='OK', section=section)
#                 return marshal(result, section_create_fields)
#             except CrematoriumNotFoundError as err:
#                 abort(404, message=err.message)
#         else:
#             abort(400, message="Invalid Parameters", errors=form.errors)


rest_api.add_resource(CrematoriumResource, '/api/crematorium')
# rest_api.add_resource(CrematoriumDetailResource, '/api/crematorium/<int:c_id>')
Ejemplo n.º 11
0
class DocumentsResource(Resource):
    """
    Resource for getting all Documents Resource
    """
    def post(self):
        """ POST /api/documents """
        log.debug("POST Upload Document request {0} {1}".format(
            request.files, request.form))
        # uploaded_file = request.files['file']
        # if uploaded_file:
        #     caption = request.form['caption'] if request.form['caption'] is not None else ''
        #     document = upload_document(uploaded_file, caption)
        #     result = dict(status=200, message="OK", document=document)
        #     return marshal(result, document_create_fields)
        # else:
        #     abort(400, message="Invalid parameters")


rest_api.add_resource(DepartmentsResource, '/api/departments')
rest_api.add_resource(EmployeesResource, '/api/employees')
rest_api.add_resource(AssetsResource, '/api/assets')
rest_api.add_resource(IncidentTypesResource, '/api/incident_types')
rest_api.add_resource(RiskTypesResource, '/api/risk_types')
rest_api.add_resource(IncidentsResource, '/api/incidents')
rest_api.add_resource(IncidentDetailsResource,
                      '/api/incidents/<int:incident_id>')
rest_api.add_resource(IncidentPhotosResource,
                      '/api/incidents/<int:incident_id>/photos')
rest_api.add_resource(PhotoDetailResource, '/api/photos/<int:photo_id>')
rest_api.add_resource(DocumentsResource, '/api/documents')
Ejemplo n.º 12
0
        """ GET /api/clients """
        # TODO check authenticated user
        # TODO: Handle logins for 401s
        clients = client_service.get_clients()
        log.debug("Clients Resource Data: {0}".format(clients))
        return clients

    # def post(self):  # TODO Get rid of these one, throw all on /api/lots/lot_id
    #     """ POST /api/clients """
    #     form_data = request.json
    #     log.debug('Add Client for lot request: {0}'.format(form_data))
    # TODO check authenticated user
    # form = AddClientForm.from_json(form_data)
    # try:
    #     if form.validate():
    #         client = client_service.create_from_dict(form_data)
    #
    #         # Update Lot here
    #         lot = lot_service.sold_lot(form_data['lot_id'], client.id)
    #
    #         result = dict(status=200, message='OK', client=client, lot=lot)
    #
    #         return marshal(result, lot_client_create_fields)
    #     else:
    #         abort(400, message="Invalid Parameters", errors=form.errors)
    # except ValueError as err:
    #     abort(403, message=err.message)


rest_api.add_resource(ClientsResource, '/api/clients')
Ejemplo n.º 13
0
class SettingsResource(Resource):
    """
    Resource for Block
    """

    def post(self):
        """ POST /api/settings """
        form_data = request.json
        log.debug('Update Settings request: {0}'.format(form_data))
        settings = setting_service.update_settings(form_data)
        result = dict(status=200, message='OK', settings=settings)
        log.debug("Result: {0}".format(result))
        return marshal(result, success_settings_fields)


class LastLotPriceResource(Resource):
    """
    Resource for LastLotPrice
    """

    @marshal_with(settings_fields)
    def get(self):
        """ GET /api/settings/last_lot_price """
        last_lot = setting_service.get_current_settings()
        return last_lot


rest_api.add_resource(SettingsResource, '/api/settings')
rest_api.add_resource(LastLotPriceResource, '/api/settings/last_lot_price')
Ejemplo n.º 14
0
from app import rest_api
from app.api.pimpy.minutes import MinuteResource, GroupMinuteResource
from app.api.pimpy.tasks import TaskListResource, TaskResource, \
    GroupTaskListResource

# Pimpy Tasks
rest_api.add_resource(TaskListResource,
                      '/api/tasks/',
                      endpoint="api.task")
rest_api.add_resource(TaskResource,
                      '/api/tasks/<string:task_id>',
                      endpoint="api.tasks")
rest_api.add_resource(GroupTaskListResource,
                      '/api/groups/<int:group_id>/tasks',
                      endpoint="api.groups.tasks")

# Pimpy Minutes
rest_api.add_resource(MinuteResource,
                      "/api/minutes/<int:minute_id>",
                      endpoint="api.minute")
rest_api.add_resource(GroupMinuteResource,
                      "/api/groups/<int:group_id>/minutes",
                      endpoint="api.groups.minutes")
Ejemplo n.º 15
0
class SectionBlocksResource(Resource):
    """
    Resource for Section Blocks
    """

    @marshal_with(block_basic_fields)
    def get(self, section_id):
        """ GET /api/sections/section_id/blocks """
        log.debug("Get All Blocks for Section : {0}".format(section_id))
        try:
            return block_service.get_blocks_for_section(section_id)
        except SectionNotFoundError as err:
            abort(403, message=err.message)

    def post(self, section_id):
        """ POST /api/sections/<section_id>/blocks """
        form_data = request.json
        log.debug('Add Block for Section id={0} request: {1}'.format(section_id, form_data))
        # TODO check authenticated user
        form = AddBlockForm.from_json(form_data)
        if form.validate():
            block = block_service.create_from_dict(section_id, form_data)
            result = dict(status=200, message='OK', block=block)
            return marshal(result, block_create_fields)
        else:
            abort(400, message="Invalid Parameters", errors=form.errors)


rest_api.add_resource(BlocksResource, '/api/blocks')
rest_api.add_resource(SectionBlocksResource, '/api/sections/<int:section_id>/blocks')
Ejemplo n.º 16
0
    @marshal_with(hazard_complete_fields)
    def get(self, hazard_id):
        """ GET /api/hazards/<hazard_id> """
        return get_hazard_details(hazard_id)

    def delete(self, hazard_id):
        """ DELETE /api/hazards/<hazard_id> """
        try:
            delete_hazard(hazard_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except HazardNotFoundError as err:
            abort(404, message=err.message)


rest_api.add_resource(RiskAssessmentResource, '/api/risk_assessments')
rest_api.add_resource(RiskAssessmentDetailsResource,
                      '/api/risk_assessments/<int:risk_assessment_id>')
rest_api.add_resource(RiskAssessmentRisksResource,
                      '/api/risk_assessments/<int:risk_assessment_id>/risks')
rest_api.add_resource(AssessmentRiskResource,
                      '/api/assessment_risk/<int:assessment_risk_id>')
rest_api.add_resource(
    RiskAssessmentActionsResource,
    '/api/risk_assessments/<int:risk_assessment_id>/actions')
rest_api.add_resource(
    RiskAssessmentActionResource,
    '/api/risk_assessment_action/<int:risk_assessment_action_id>')
rest_api.add_resource(HazardResource, '/api/hazards')
rest_api.add_resource(HazardDetailsResource, '/api/hazards/<int:hazard_id>')
Ejemplo n.º 17
0
log = logging.getLogger(__name__)


class DeceasedResource(Resource):
    """
    Resource for Deceased
    """

    """ PUT /api/deceased/deceased_id """
    def put(self, deceased_id):
        form_data = request.json
        log.debug("Update Deceased Request id={0} : {1}".format(deceased_id, form_data))
        try:
            deceased = deceased_service.update_deceased(deceased_id, form_data)
            result = dict(status=200, message='OK', deceased=deceased)
            return marshal(result, deceased_create_fields)
        except DeceasedNotFoundError as err:
            abort(403, message=err.message)

    def delete(self, deceased_id):
        """ DELETE /api/deceased/deceased_id """
        try:
            deceased_service.delete_deceased(deceased_id)
            result = dict(status=200, message='OK')
            return marshal(result, ok_response)
        except DeceasedNotFoundError as err:
            abort(403, message=err.message)


rest_api.add_resource(DeceasedResource, '/api/deceased/<int:deceased_id>')
Ejemplo n.º 18
0
            columbary = sold_columbary(c_id, form_data)
            result = dict(status=200, message='OK', columbary=columbary)
            return marshal(result, columbary_create_fields)
        except ColumbaryNotFoundError as err:
            abort(404, message=err.message)


class ColumbaryDeceasedResource(Resource):
    """
    Resource for Deceased Columbary
    """

    def post(self, c_id):
        """ POST /api/columbary/<c_id>/deceased """
        form_data = request.json
        log.debug('Add Deceased for Columbary id={0} request: {1}'.format(c_id, form_data))
        # TODO check authenticated user
        form = AddDeceasedForm.from_json(form_data)
        if form.validate():
            data = add_occupant(c_id, form_data)
            result = dict(status=200, message='OK', deceased=data)
            return marshal(result, deceased_create_fields)
        else:
            abort(400, message="Invalid Parameters", errors=form.errors)

rest_api.add_resource(ColumbaryResource, '/api/columbary')
rest_api.add_resource(ColumbaryAllResource, '/api/columbary/all')
rest_api.add_resource(ColumbaryDetailResource, '/api/columbary/<int:c_id>')
rest_api.add_resource(MarkSoldColumbaryResource, '/api/columbary/<int:c_id>/mark_sold')
rest_api.add_resource(ColumbaryDeceasedResource, '/api/columbary/<int:c_id>/deceased')
from app import rest_api

from users import api as users_api


rest_api.add_resource(users_api.UserAPI, '/api/v1/user')
rest_api.add_resource(users_api.AuthenticationAPI, '/api/v1/authenticate')
rest_api.add_resource(users_api.PasswordResetRequestAPI, '/api/v1/password-reset/request')
rest_api.add_resource(users_api.PasswordResetConfirmAPI, '/api/v1/password-reset/confirm')
rest_api.add_resource(users_api.AdminOnlyAPI, '/api/v1/admin')
Ejemplo n.º 20
0
			return jsonify(ApiObjects(site.json()))
		else:
			return jsonify(ApiObjects())

	@http_auth_required
	def post(self):
		parser = reqparse.RequestParser(bundle_errors = True)
		parser.add_argument('name', type=str, location='form', required=True, help='<str> name required')
		args = parser.parse_args()
		site = Site.create(name = args['name'])
		if site:
			return jsonify(ApiObjects(site.json()))
		else:
			return jsonify(ApiObjects())

rest_api.add_resource(SiteResource, '/site/<int:site_id>', '/site')


class SiteListResource(restful.Resource):
	def get(self):
		sites = Site.query.all()
		if sites: 
			return jsonify(ApiObjects([site.json() for site in sites]))
		else:
			return jsonify(ApiObjects())
		
rest_api.add_resource(SiteListResource, '/sites')



    def put(self, site_design_id):
        """ PUT /site_designs/<site_design_id> """
        if current_user and current_user.is_authenticated:
            try:
                form_data = request.json
                log.debug("Update Site Design Request: {0}".format(form_data))
                site_design = update_site_design(site_design_id, form_data)
                result = dict(status=200, message='OK', site_design=site_design)
                return marshal(result, site_design_create_fields)
            except SiteDesignNotFoundError as err:
                abort(404, message=err.message)
        abort(401, message="Requires user to login")


class SiteDesignComponentUnitsResource(Resource):
    """
    Resource for Site Design Component Units
    """

    @marshal_with(site_design_component_unit_fields)
    def get(self, component_unit_id):
        """ GET /component_units/<component_unit_id>/site_designs """
        log.debug("Get Site Design Component Units Request component_unit_id={0}".format(component_unit_id))
        return get_site_design_component_units(component_unit_id)

rest_api.add_resource(ComponentUnitsResource, '/api/component_units')
rest_api.add_resource(SiteDesignsResource, '/api/site_designs')
rest_api.add_resource(SiteDesignDetailsResource, '/api/site_designs/<int:site_design_id>')
rest_api.add_resource(SiteDesignComponentUnitsResource, '/api/component_units/<int:component_unit_id>/site_designs')
Ejemplo n.º 22
0
import ujson

API_UNITS = {'m': 'SI meters', 's': 'SI seconds'}


class SiteList(restful.Resource):
    def get(self):
        api_response = ApiResponse()
        sites = Site.query.all()
        for site in sites:
            api_response += site
        # print api_response.json()
        return api_response.json()


rest_api.add_resource(SiteList, '/sites')


class SiteResource(restful.Resource):
    def get(self, site_id):
        response = ApiResponse(request)
        site = Site.query.filter_by(id=site_id).first()
        if site:
            response += site
        else:
            response += exc.MissingResourceException(type(self), site_id)
        return response.json()

    def delete(self, site_id):
        response = ApiResponse(request)
        site = Site.query.filter_by(id=site_id).first()
Ejemplo n.º 23
0
            delete_work_step(work_permit_id, step_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except WorkPermitNotFoundError as err:
            abort(404, message=err.message)


class WorkPermitHazardsResource(Resource):
    """
    Resource for getting Work Permit hazards
    """
    def delete(self, work_permit_id):
        haz_id = request.args.get('id')
        log.debug('Delete Work Hazard id={0} , work hazard id={1}'.format(
            work_permit_id, haz_id))
        try:
            delete_work_hazard(work_permit_id, haz_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except WorkPermitNotFoundError as err:
            abort(404, message=err.message)


rest_api.add_resource(WorkPermitsResource, '/api/work_permits')
rest_api.add_resource(WorkPermitDetailsResource,
                      '/api/work_permits/<int:work_permit_id>')
rest_api.add_resource(WorkPermitStepsResource,
                      '/api/work_permits/<int:work_permit_id>/steps')
rest_api.add_resource(WorkPermitHazardsResource,
                      '/api/work_permits/<int:work_permit_id>/hazards')
Ejemplo n.º 24
0
from app import app, rest_api
from flask.ext.restful import Resource, abort, marshal_with, marshal
from flask import request
from .fields import building_fields, building_create_fields
from .services import get_buildings, create_building
import logging

log = logging.getLogger(__name__)


class BuildingsResource(Resource):
    """
    Resource for Buildings
    """

    @marshal_with(building_fields)
    def get(self):
        return get_buildings()

    def post(self):
        form_data = request.json

        log.debug('Add Building request: {0}'.format(form_data))

        obj = create_building(form_data)
        result = dict(status=200, message='OK', building=obj)
        return marshal(result, building_create_fields)


rest_api.add_resource(BuildingsResource, '/api/buildings')
Ejemplo n.º 25
0

class DocumentsResource(Resource):
    """
    Resource for getting all Documents Resource
    """

    def post(self):
        """ POST /api/documents """
        log.debug("POST Upload Document request {0} {1}".format(request.files, request.form))
        # uploaded_file = request.files['file']
        # if uploaded_file:
        #     caption = request.form['caption'] if request.form['caption'] is not None else ''
        #     document = upload_document(uploaded_file, caption)
        #     result = dict(status=200, message="OK", document=document)
        #     return marshal(result, document_create_fields)
        # else:
        #     abort(400, message="Invalid parameters")


rest_api.add_resource(DepartmentsResource, '/api/departments')
rest_api.add_resource(EmployeesResource, '/api/employees')
rest_api.add_resource(AssetsResource, '/api/assets')
rest_api.add_resource(IncidentTypesResource, '/api/incident_types')
rest_api.add_resource(RiskTypesResource, '/api/risk_types')
rest_api.add_resource(IncidentsResource, '/api/incidents')
rest_api.add_resource(IncidentDetailsResource, '/api/incidents/<int:incident_id>')
rest_api.add_resource(IncidentPhotosResource, '/api/incidents/<int:incident_id>/photos')
rest_api.add_resource(PhotoDetailResource, '/api/photos/<int:photo_id>')
rest_api.add_resource(DocumentsResource, '/api/documents')
Ejemplo n.º 26
0
        section = section_service.get_section(section_id)
        if section:
            data = section.to_dict()
            data['blocks'] = section.get_blocks()
            return data
        abort(404, message="Section id={0} not found".format(section_id))
        # abort(401, message="Requires user to login")

    def put(self, section_id):
        """ PUT /api/sections/<section_id> """
        form_data = request.json
        log.debug('Update Section request id {0}: {1}'.format(
            section_id, form_data))
        # TODO check authenticated user
        form = AddSectionForm.from_json(form_data)
        if form.validate():
            try:
                section = section_service.update_from_dict(
                    section_id, form_data)
                result = dict(status=200, message='OK', section=section)
                return marshal(result, section_create_fields)
            except SectionNotFoundError as err:
                abort(404, message=err.message)
        else:
            abort(400, message="Invalid Parameters", errors=form.errors)


rest_api.add_resource(SectionsResource, '/api/sections')
rest_api.add_resource(SectionsBasicResource, '/api/sections/basic')
rest_api.add_resource(SectionDetailResource, '/api/sections/<int:section_id>')
Ejemplo n.º 27
0
    @marshal_with(client_fields)
    def get(self):
        """ GET /api/clients """
        # TODO check authenticated user
        # TODO: Handle logins for 401s
        clients = client_service.get_clients()
        log.debug("Clients Resource Data: {0}".format(clients))
        return clients


class LotClientResource(Resource):
    def put(self, lot_id):
        """ PUT /api/lots/<lot_id>/client """
        form_data = request.json
        log.debug('Update Lot Client request id={0} {1}'.format(lot_id, form_data))
        try:
            # client = client_service.create_from_dict(form_data)
            # Update Lot here
            lot = lot_service.update_lot_client(lot_id, form_data)

            result = dict(status=200, message='OK', lot=lot)

            return marshal(result, lot_create_fields)
        except LotNotFoundError as err:
            abort(403, message=err.message)


rest_api.add_resource(ClientsResource, '/api/clients')
rest_api.add_resource(LotClientResource, '/api/lots/<int:lot_id>/client')
Ejemplo n.º 28
0
    """

    def delete(self, solar_id, panel_id):
        data = request.json
        log.debug("Delete Solar Panel Detail request Solar={0} Panel={1} Data={2}".format(solar_id, panel_id, data))
        # TODO check authenticated user
        # if current_user and current_user.is_authenticated:
        try:
            solar_panel_service.delete_panel(solar_id, panel_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except ValueError as err:
            abort(404, message=err.message)
            # abort(401, message="Requires user to login")

    def put(self, solar_id, panel_id):
        data = request.json
        log.debug("Update Solar Panel Detail request Solar={0} Panel={1} Data={2}".format(solar_id, panel_id, data))
        # TODO check authenticated user
        # if current_user and current_user.is_authenticated:
        try:
            panel_data = solar_panel_service.update_panel_area(solar_id, panel_id, data)
            result = dict(status=200, message="OK", panel=panel_data)
            return marshal(result, solar_panel_create_fields)
        except ValueError as err:
            abort(404, message=err.message)
            # abort(401, message="Requires user to login")


rest_api.add_resource(SolarPanelResource, '/api/solars/<int:solar_id>/panels')
rest_api.add_resource(SolarPanelDetailResource, '/api/solars/<int:solar_id>/panels/<int:panel_id>')
Ejemplo n.º 29
0
    """

    def post(self, project_id):
        """ POST /api/projects/<project_id>/files """
        log.debug('Update Project File {0} request: {1}'.format(project_id, request.form))

        if current_user and current_user.is_authenticated:
            uploaded_file = request.files['file']
            # TODO: Delete previous associated file before saving new one for good housekeeping
            if self.has_valid_form() and uploaded_file and self.allowed_file(uploaded_file.filename):
                filename = self.copy_file(uploaded_file)
                data = dict(id=project_id, sections=self.get_files_form_data(filename))
                try:
                    file = save_files_from_dict(project_id, data)
                    file.date_created = file.date_created.isoformat()
                    file.date_modified = file.date_modified.isoformat()
                    file.coordinates = GISHelper.point_to_latlng_dict(file.coordinates)
                    filedict = file.to_dict()
                    return dict(status=200, message="OK", file=filedict)
                except ProjectNotFoundError as err:
                    abort(404, message=err.message)
            else:
                abort(400, message="Invalid parameters")
        abort(401, message="Requires user to login")


rest_api.add_resource(ProjectsResource, '/api/projects')
rest_api.add_resource(ProjectDetailsResource, '/api/projects/<int:project_id>')
rest_api.add_resource(ProjectSectionsResource, '/api/projects/<int:project_id>/sections')
rest_api.add_resource(ProjectFilesResource, '/api/projects/<int:project_id>/files')
Ejemplo n.º 30
0
                                                      allow_null=False))


class SettingsResource(Resource):
    """
    Resource for Block
    """
    def post(self):
        """ POST /api/settings """
        form_data = request.json
        log.debug('Update Settings request: {0}'.format(form_data))
        settings = setting_service.update_settings(form_data)
        result = dict(status=200, message='OK', settings=settings)
        log.debug("Result: {0}".format(result))
        return marshal(result, success_settings_fields)


class LastLotPriceResource(Resource):
    """
    Resource for LastLotPrice
    """
    @marshal_with(settings_fields)
    def get(self):
        """ GET /api/settings/last_lot_price """
        last_lot = setting_service.get_current_settings()
        return last_lot


rest_api.add_resource(SettingsResource, '/api/settings')
rest_api.add_resource(LastLotPriceResource, '/api/settings/last_lot_price')
Ejemplo n.º 31
0
        step_id = request.args.get('id')
        log.debug('Delete Work Step id={0} , step id={1}'.format(work_permit_id, step_id))
        try:
            delete_work_step(work_permit_id, step_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except WorkPermitNotFoundError as err:
            abort(404, message=err.message)


class WorkPermitHazardsResource(Resource):
    """
    Resource for getting Work Permit hazards
    """

    def delete(self, work_permit_id):
        haz_id = request.args.get('id')
        log.debug('Delete Work Hazard id={0} , work hazard id={1}'.format(work_permit_id, haz_id))
        try:
            delete_work_hazard(work_permit_id, haz_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except WorkPermitNotFoundError as err:
            abort(404, message=err.message)


rest_api.add_resource(WorkPermitsResource, '/api/work_permits')
rest_api.add_resource(WorkPermitDetailsResource, '/api/work_permits/<int:work_permit_id>')
rest_api.add_resource(WorkPermitStepsResource, '/api/work_permits/<int:work_permit_id>/steps')
rest_api.add_resource(WorkPermitHazardsResource, '/api/work_permits/<int:work_permit_id>/hazards')
Ejemplo n.º 32
0
from app import rest_api

from boards import api as board_api

rest_api.add_resource(board_api.BoardAPI, '/api/v1/board')
rest_api.add_resource(board_api.BoardsByUserAPI, '/api/v1/boardsbyuser')
rest_api.add_resource(board_api.Boards, '/api/v1/boards')
Ejemplo n.º 33
0
from flask.ext.restful import Resource, abort, marshal_with, marshal
from flask import request
from app import app, rest_api
from .services import *
from .fields import *
from flask_login import current_user
import logging

log = logging.getLogger(__name__)


class UsersResource(Resource):
    """
    Resource for Users
    """

    @marshal_with(user_fields)
    def get(self):
        """ GET /users """
        # TODO check authenticated user
        # TODO: Handle logins for 401s and get_solars_for_user
        return get_users()

rest_api.add_resource(UsersResource, '/api/users')
Ejemplo n.º 34
0
    def delete(self, order_substance_id):
        material_id = request.args.get('material_id', 0)
        log.debug(
            'Delete Dangerous Substance Order Material Request id={0} : {1}'.
            format(order_substance_id, material_id))
        try:
            delete_dangerous_substance_order_material(material_id,
                                                      order_substance_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except (DangerousSubstanceOrderNotFoundError,
                DangerousSubstanceOrderMaterialNotFoundError) as err:
            abort(404, message=err.message)


rest_api.add_resource(AgentsResource, '/api/agents')
rest_api.add_resource(AgentDetailResource, '/api/agents/<int:agent_id>')
rest_api.add_resource(MaterialTypesResource, '/api/material_types')
rest_api.add_resource(HazardMaterialsResource, '/api/hazard_materials')
rest_api.add_resource(HazardMaterialDetailResource,
                      '/api/hazard_materials/<int:material_id>')
rest_api.add_resource(ContractorsResource, '/api/contractors')
rest_api.add_resource(ContractorDetailsResource,
                      '/api/contractors/<int:contractor_id>')
rest_api.add_resource(WasteDisposalsResource, '/api/waste_disposals')
rest_api.add_resource(WasteDisposalDetailsResource,
                      '/api/waste_disposals/<int:waste_disposal_id>')
rest_api.add_resource(
    WasteDisposalDocumentsResource,
    '/api/waste_disposals/<int:waste_disposal_id>/documents')
rest_api.add_resource(DangerousSubstanceOrdersResource,
Ejemplo n.º 35
0
        # if current_user and current_user.is_authenticated:
        new_caption = data['caption']
        form = UpdatePhotoCaptionForm.from_json(data)
        if form.validate():
            try:
                solar_file_obj = solar_file_service.update_photo_caption(solar_id, photo_id, new_caption)
                result = dict(status=200, message="OK", solar_file=solar_file_obj)
                return marshal(result, solar_file_create_fields)
            except ValueError as err:
                abort(404, message=err.message)
            else:
                abort(400, message="Invalid parameters")
                # abort(401, message="Requires user to login")

    def delete(self, solar_id, photo_id):
        data = request.json
        log.debug("Delete Solar Panel Detail request Solar={0} Panel={1} Data={2}".format(solar_id, photo_id, data))
        # TODO check authenticated user
        # if current_user and current_user.is_authenticated:
        try:
            filename = solar_file_service.delete_photo(solar_id, photo_id)
            # self.delete_file(filename)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except ValueError as err:
            abort(404, message=err.message)
            # abort(401, message="Requires user to login")


rest_api.add_resource(SolarPhotosResource, '/api/solars/<int:solar_id>/photos')
rest_api.add_resource(SolarPhotosDetailResource, '/api/solars/<int:solar_id>/photos/<int:photo_id>')
Ejemplo n.º 36
0
            log.debug('Add Action Response request: {0}'.format(form_data))
            # Validation here
            # form = DelegateActionForm.from_json(form_data['data'])
            # if form.validate():
            response = respond_to_action(action_id, current_user.id, form_data)
            result = dict(status=200, message='OK', response=response)
            return marshal(result, action_response_create_fields)
            # else:
            #     abort(400, message="Invalid Parameters", errors=form.errors)
        abort(401, message="Requires user to login")


class MarkDoneActionResource(Resource):
    """
    Resource for Marking action as done
    """

    def put(self, action_id):
        """ POST /api/actions/<action_id>/done """
        if current_user and current_user.is_authenticated:
            log.debug('Marking action as done request')
            action = mark_action_done(action_id, current_user.id)
            result = dict(status=200, message='OK', action=action)
            return marshal(result, action_create_fields)
        abort(401, message="Requires user to login")

rest_api.add_resource(ActionsResource, '/api/actions')
rest_api.add_resource(ActionDetailsResource, '/api/actions/<int:action_id>')
rest_api.add_resource(ActionResponseResource, '/api/actions/<int:action_id>/responses')
rest_api.add_resource(MarkDoneActionResource, '/api/actions/<int:action_id>/done')
Ejemplo n.º 37
0
    """
    @marshal_with(waypoint_type_fields)
    def get(self):
        return get_waypoint_types()


class WaypointsResource(Resource):
    """
    Resource for Waypoints
    """
    @marshal_with(waypoint_complete_fields)
    def get(self, buildingid, floorplanid):
        return get_waypoints(buildingid, floorplanid)

    def post(self, buildingid, floorplanid):
        form_data = request.json

        log.debug(
            'Add waypoint request buildingid={0} floorplanid={1}: {2}'.format(
                buildingid, floorplanid, form_data))

        obj = create_waypoint(buildingid, floorplanid, form_data)
        result = dict(status=200, message='OK', waypoint=obj)
        return marshal(result, waypoint_create_fields)


rest_api.add_resource(WaypointTypesResource, '/api/waypoint_types')
rest_api.add_resource(
    WaypointsResource,
    '/api/buildings/<int:buildingid>/floorplans/<int:floorplanid>/waypoints')
Ejemplo n.º 38
0
from flask.ext.restful import Resource, abort, marshal_with, marshal
from app import app, rest_api
from .services import *
from .fields import *
import logging

log = logging.getLogger(__name__)


class UsersResource(Resource):
    """
    Resource for Users
    """
    @marshal_with(user_fields)
    def get(self):
        """ GET /users """
        return get_users()


rest_api.add_resource(UsersResource, '/api/users')
Ejemplo n.º 39
0
        """ GET /api/offices """
        print "asset type showroom: {0}".format(AssetTypes.SHOWROOM)
        return get_assets(AssetTypes.MALL_EXHIBITS)


class OfficesResource(Resource):
    """
    Resource for Offices Resource
    """

    @marshal_with(asset_fields)
    def get(self):
        """ GET /api/offices """
        return get_assets(AssetTypes.OFFICE)

rest_api.add_resource(ProjectTypesResource, '/api/project_types')
rest_api.add_resource(ProjectsResource, '/api/projects')
rest_api.add_resource(ProjectDetailsResource, '/api/projects/<int:project_id>')
rest_api.add_resource(ProjectCondoFloorsResource, '/api/projects/<int:project_id>/floors')
rest_api.add_resource(CondoUnitsResource, '/api/condo_units')
rest_api.add_resource(ProjectCondoUnitsResource, '/api/projects/<int:project_id>/floors/<int:floor_id>/units')
rest_api.add_resource(ProjectLotsResource, '/api/projects/<int:project_id>/lots')
rest_api.add_resource(LotsResource, '/api/lots')
rest_api.add_resource(LotDetailsResource, '/api/lots/<int:lot_id>')
rest_api.add_resource(ProjectPhotosResource, '/api/projects/<int:project_id>/photos')
rest_api.add_resource(CustomersResource, '/api/customers')
rest_api.add_resource(ProspectsResource, '/api/prospects')
rest_api.add_resource(ShowroomsResource, '/api/showrooms')
rest_api.add_resource(MallExhibitsResource, '/api/mall_exhibits')
rest_api.add_resource(OfficesResource, '/api/offices')
Ejemplo n.º 40
0
        abort(401, message="Requires user to login")


class HazardDetailsResource(Resource):
    """
    Resource for getting Hazard Details Resource
    """

    @marshal_with(hazard_complete_fields)
    def get(self, hazard_id):
        """ GET /api/hazards/<hazard_id> """
        return get_hazard_details(hazard_id)

    def delete(self, hazard_id):
        """ DELETE /api/hazards/<hazard_id> """
        try:
            delete_hazard(hazard_id)
            result = dict(status=200, message="OK")
            return marshal(result, success_fields)
        except HazardNotFoundError as err:
            abort(404, message=err.message)

rest_api.add_resource(RiskAssessmentResource, '/api/risk_assessments')
rest_api.add_resource(RiskAssessmentDetailsResource, '/api/risk_assessments/<int:risk_assessment_id>')
rest_api.add_resource(RiskAssessmentRisksResource, '/api/risk_assessments/<int:risk_assessment_id>/risks')
rest_api.add_resource(AssessmentRiskResource, '/api/assessment_risk/<int:assessment_risk_id>')
rest_api.add_resource(RiskAssessmentActionsResource, '/api/risk_assessments/<int:risk_assessment_id>/actions')
rest_api.add_resource(RiskAssessmentActionResource, '/api/risk_assessment_action/<int:risk_assessment_action_id>')
rest_api.add_resource(HazardResource, '/api/hazards')
rest_api.add_resource(HazardDetailsResource, '/api/hazards/<int:hazard_id>')
Ejemplo n.º 41
0
            abort(403, message=err.message)


class LotDeceasedResource(Resource):
    """
    Resource for Deceased Lots
    """

    def post(self, lot_id):
        """ POST /api/lots/<lot_id>/deceased """
        form_data = request.json
        log.debug('Add Deceased for Lot id={0} request: {1}'.format(lot_id, form_data))
        # TODO check authenticated user
        form = AddDeceasedForm.from_json(form_data)
        try:
            if form.validate():
                data = lot_service.add_occupant(lot_id, form_data)
                result = dict(status=200, message='OK', deceased=data)
                return marshal(result, deceased_create_fields)
            else:
                abort(400, message="Invalid Parameters", errors=form.errors)
        except LotPriceNullError as err:
            abort(403, message=err.message)


rest_api.add_resource(LotsResource, '/api/lots')
rest_api.add_resource(LotDetailResource, '/api/lots/<int:lot_id>')
rest_api.add_resource(BlockLotResource, '/api/blocks/<int:block_id>/lots')
rest_api.add_resource(LotDeceasedResource, '/api/lots/<int:lot_id>/deceased')
rest_api.add_resource(MarkSoldLotResource, '/api/lots/<int:lot_id>/mark_sold')
Ejemplo n.º 42
0
            abort(403, message=err.message)


class LotDeceasedResource(Resource):
    """
    Resource for Deceased Lots
    """
    def post(self, lot_id):
        """ POST /api/lots/<lot_id>/deceased """
        form_data = request.json
        log.debug('Add Deceased for Lot id={0} request: {1}'.format(
            lot_id, form_data))
        # TODO check authenticated user
        form = AddDeceasedForm.from_json(form_data)
        try:
            if form.validate():
                data = lot_service.add_occupant(lot_id, form_data)
                result = dict(status=200, message='OK', deceased=data)
                return marshal(result, deceased_create_fields)
            else:
                abort(400, message="Invalid Parameters", errors=form.errors)
        except LotPriceNullError as err:
            abort(403, message=err.message)


rest_api.add_resource(LotsResource, '/api/lots')
rest_api.add_resource(LotDetailResource, '/api/lots/<int:lot_id>')
rest_api.add_resource(BlockLotResource, '/api/blocks/<int:block_id>/lots')
rest_api.add_resource(LotDeceasedResource, '/api/lots/<int:lot_id>/deceased')
rest_api.add_resource(MarkSoldLotResource, '/api/lots/<int:lot_id>/mark_sold')
Ejemplo n.º 43
0
    """
    Resource for Section Blocks
    """
    @marshal_with(block_basic_fields)
    def get(self, section_id):
        """ GET /api/sections/section_id/blocks """
        log.debug("Get All Blocks for Section : {0}".format(section_id))
        try:
            return block_service.get_blocks_for_section(section_id)
        except SectionNotFoundError as err:
            abort(403, message=err.message)

    def post(self, section_id):
        """ POST /api/sections/<section_id>/blocks """
        form_data = request.json
        log.debug('Add Block for Section id={0} request: {1}'.format(
            section_id, form_data))
        # TODO check authenticated user
        form = AddBlockForm.from_json(form_data)
        if form.validate():
            block = block_service.create_from_dict(section_id, form_data)
            result = dict(status=200, message='OK', block=block)
            return marshal(result, block_create_fields)
        else:
            abort(400, message="Invalid Parameters", errors=form.errors)


rest_api.add_resource(BlocksResource, '/api/blocks')
rest_api.add_resource(SectionBlocksResource,
                      '/api/sections/<int:section_id>/blocks')
Ejemplo n.º 44
0
from flask.ext.restful import Resource, abort, marshal, marshal_with
from app.fields.lot_fields import ok_response
from app.exceptions.deceased import *
from app import rest_api
from app.services import deceased_service
import logging

log = logging.getLogger(__name__)


class DeceasedResource(Resource):
    """
    Resource for Deceased
    """

    def delete(self, deceased_id):
        """ GET /api/deceased/deceased_id """
        try:
            deceased_service.delete_deceased(deceased_id)
            result = dict(status=200, message='OK')
            return marshal(result, ok_response)
        except DeceasedNotFoundError as err:
            abort(403, message=err.message)


rest_api.add_resource(DeceasedResource, '/api/deceased/<int:deceased_id>')
Ejemplo n.º 45
0
from app import rest_api
from applicationModel import api as form_api
from users import api as users_api
from responses import api as responses_api
from content import api as content_api
from files import api as files_api
from events import api as events_api
from reviews import api as reviews_api
from invitedGuest import api as invitedGuest_api
from registration import api as registration_api
from registrationResponse import api as registration_response
from guestRegistrations import api as guest_registration
from invitationletter import api as invitation_letter_api
from attendance import api as attendance_api

rest_api.add_resource(users_api.UserAPI, '/api/v1/user')
rest_api.add_resource(users_api.UserCommentAPI, '/api/v1/user-comment')
rest_api.add_resource(users_api.AuthenticationAPI, '/api/v1/authenticate')
rest_api.add_resource(users_api.PasswordResetRequestAPI,
                      '/api/v1/password-reset/request')
rest_api.add_resource(users_api.PasswordResetConfirmAPI,
                      '/api/v1/password-reset/confirm')
rest_api.add_resource(users_api.AdminOnlyAPI, '/api/v1/admin')
rest_api.add_resource(users_api.EmailerAPI, '/api/v1/admin/emailer')
rest_api.add_resource(form_api.ApplicationFormAPI, '/api/v1/application-form')
rest_api.add_resource(responses_api.ResponseAPI, '/api/v1/response')
rest_api.add_resource(content_api.CountryContentAPI,
                      '/api/v1/content/countries')
rest_api.add_resource(files_api.FileUploadAPI, '/api/v1/file')
rest_api.add_resource(content_api.CategoryContentAPI,
                      '/api/v1/content/categories')
Ejemplo n.º 46
0
    def post(self, audit_id):
        """ POST /api/audits/<audit_id>/signature """
        log.debug("POST Upload Audit Signature Photo request id={0} {1}".format(audit_id, request.files))
        uploaded_file = request.files['file']
        print "uploaded file: {0}".format(uploaded_file)
        try:
            audit = sign_audit(audit_id, uploaded_file)
            result = dict(status=200, message="OK", audit=audit)
            return marshal(result, audit_create_fields)
        except AuditNotFoundError as err:
            abort(404, message=err.message)

    def put(self, audit_id):
        """ PUT /api/audits/<audit_id>/signature """
        log.debug("PUT Upload Audit Signature Photo request id={0} files={1} form data={2}".format(audit_id, request.files, request.form))
        uploaded_file = request.files['file']
        signature_id = request.form.get('signature[id]')
        try:
            signature = update_audit_signature(audit_id, signature_id, uploaded_file)
            result = dict(status=200, message="OK", signature=signature)
            return marshal(result, signature_create_fields)
        except (AuditNotFoundError, AuditSignatureNotFoundError) as err:
            abort(404, message=err.message)

rest_api.add_resource(AuditTemplatesResource, '/api/audit_templates')
rest_api.add_resource(AuditTemplateDetailsResource, '/api/audit_templates/<int:audit_template_id>')
rest_api.add_resource(AuditsResource, '/api/audits')
rest_api.add_resource(AuditDetailsResource, '/api/audits/<int:audit_id>')
rest_api.add_resource(AuditSignatureResource, '/api/audits/<int:audit_id>/signature')
Ejemplo n.º 47
0
from app import rest_api

from users import api as users_api

rest_api.add_resource(users_api.UserAPI, '/api/v1/user')
rest_api.add_resource(users_api.AuthenticationAPI, '/api/v1/authenticate')
rest_api.add_resource(users_api.PasswordResetRequestAPI,
                      '/api/v1/password-reset/request')
rest_api.add_resource(users_api.PasswordResetConfirmAPI,
                      '/api/v1/password-reset/confirm')
rest_api.add_resource(users_api.AdminOnlyAPI, '/api/v1/admin')