Skip to content
DotFreelance edited this page Apr 7, 2017 · 8 revisions

Welcome to the Eventus-Server wiki!

See the API below.

Here is how to run the tests, from the root directory of this repo:
vendor/bin/phpunit

We're using Laravel (PHP) to build out the API. All structure is discussed and defined by the framework developers. All content in this repository is required for the functionality (or future functionality) of the server application.

Here is the general structure for the parts of the architecture that we have implemented:

- app
  - Exceptions
    - EventusException: A generic parent Exception for our server application.
    - Handler(modified): Added a hook in render() that sends a JSON response instead of a rendered HTML page.
  - Http
    - Controllers
      - EventController: Handles interaction between the Event objects, the persistence layer, and children.
      - ServiceController: Handles interaction between the Service objects, the persistence layer, and children.
      - ServiceTagController: Handles interaction between the ServiceTag objects and the persistence layer.
    - Middleware
      - CorsHeaders: Adds the headers necessary to allow Cross-Origin Resource Sharing. ( Overridden by new CORS package. )
      - EventusJsonResponseFormat: Modifies the outgoing response in-transit to meet our Eventus JSON spec.
  - Event: Class definition for an Eventus Event object.
  - Service: Class definition for an Eventus Service object.
  - ServiceTag: Class definition for an Eventus ServiceTag object.
- database
  - factories
    - ModelFactory(modified): Model Factories allow us to create mock data for our resources. Mostly for testing.
  - migrations
    - <several migrations>: All the migrations files are defined by us, they allow us to add/remove changes to the database.
- routes
  - api: under the subdirectory `<server-address>/api/` are the routes listed here.
- tests
  - EventAPITest: Integration tests over the individual API routes (more specifically, their associated Controller methods.)
  - ServiceAPITest: Same as above.
  - ServiceTagAPITest: Same as above.
  - FilterAPITest: Integration tests for the Filtering and Sorting parameters.
  - ExampleTest(modified): Runs creations using faker (the Model Factory library) to ensure they're working.

API:

Note, when making calls to endpoints that require you to submit JSON in the body, you must also set a header as so:

Content-Type: application/json

Events

Get All Events

HTTP route Description:
GET api/events List all Events.

Add Event

HTTP route Description:
POST api/events Create a new Event.

Delete a specified Event

HTTP route Description:
DELETE api/events/{event} Delete an Event by id, e.g. api/events/2

Retrieve a specified Event

HTTP route Description:
GET api/events/{event} Retrieve an Event by id, e.g. api/events/2

Update a specified Event

HTTP route Description:
PUT, PATCH api/events/{event} Update an Event by id, e.g. api/events/2

Get all Service items for specified Event

HTTP route Description:
GET api/events/{event}/services Retrieve all Services for an Event by id, e.g. api/events/2/services

Remove a Service from an Event

HTTP route Description:
DELETE api/events/{event}/services/{service} Remove the specified Service from the specified Event, e.g. api/events/2/services/1 removes Service 1 from Event 2.

Add a Service to an Event

HTTP route Description:
POST api/events/{event}/services/{service} Add the specified Service to the specified Event, e.g. api/events/2/services/1 adds Service 1 to Event 2.

Get an Invoice for specified Event

HTTP route Description:
GET api/events/{event}/invoice Retrieve the Invoice for an Event by id, e.g. api/events/2/invoice

Services

Get all Services

HTTP route Description:
GET api/services List all of the Services.

Add a Service

HTTP route Description:
POST api/services Create a new Service.

Get a specified Service

HTTP route Description:
GET api/services/{service} Get a specified Service by id, e.g. api/services/2

Update a specified Service

HTTP route Description:
PUT, PATCH api/services/{service} Update a specified Service by id, e.g. api/services/2

Delete a specified Service

HTTP route Description:
DLETE api/services/{service} Delete a specified Service by id, e.g. api/services/2

Get all ServiceTag items for a specified Service

HTTP route Description:
GET api/services/{service}/service_tags Retrieve all ServiceTags for a Service by id, e.g. api/services/2/service_tags

Remove a ServiceTag from a Service

HTTP route Description:
DELETE api/services/{service}/service_tags/{service_tag} Remove the specified ServiceTag from the specified Service, e.g. api/services/2/service_tags/1 removes ServiceTag 1 from Service 2.

Add a ServiceTag to a Service

HTTP route Description:
POST api/services/{service}/service_tags/{service_tag} Add the specified ServiceTag to the specified Service, e.g. api/services/2/service_tags/1 adds ServiceTag 1 to Service 2.

ServiceTags

Get all ServiceTags

HTTP route Description:
GET api/service_tags List all of the ServiceTags.

Add ServiceTag

HTTP route Description:
POST api/service_tags Create a new ServiceTag.

Get a specified ServiceTag

HTTP route Description:
GET api/service_tags/{service_tag} Get a specified ServiceTag by id, e.g. api/service_tags/2

Update a specified ServiceTag

HTTP route Description:
PUT, PATCH api/service_tags/{service_tag} Update a specified ServiceTag by id, e.g. api/service_tags/2

Delete a specified ServiceTag

HTTP route Description:
DELETE api/service_tags/{service_tag} Delete a specified ServiceTag by id, e.g. api/service_tags/2