-
Notifications
You must be signed in to change notification settings - Fork 0
Home
DotFreelance edited this page Apr 7, 2017
·
8 revisions
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.
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
HTTP | route | Description: |
---|---|---|
GET | api/events |
List all Events. |
HTTP | route | Description: |
---|---|---|
POST | api/events |
Create a new Event. |
HTTP | route | Description: |
---|---|---|
DELETE | api/events/{event} |
Delete an Event by id, e.g. api/events/2
|
HTTP | route | Description: |
---|---|---|
GET | api/events/{event} |
Retrieve an Event by id, e.g. api/events/2
|
HTTP | route | Description: |
---|---|---|
PUT, PATCH | api/events/{event} |
Update an Event by id, e.g. api/events/2
|
HTTP | route | Description: |
---|---|---|
GET | api/events/{event}/services |
Retrieve all Services for an Event by id, e.g. api/events/2/services
|
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. |
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. |
HTTP | route | Description: |
---|---|---|
GET | api/events/{event}/invoice |
Retrieve the Invoice for an Event by id, e.g. api/events/2/invoice
|
HTTP | route | Description: |
---|---|---|
GET | api/services |
List all of the Services. |
HTTP | route | Description: |
---|---|---|
POST | api/services |
Create a new Service. |
HTTP | route | Description: |
---|---|---|
GET | api/services/{service} |
Get a specified Service by id, e.g. api/services/2
|
HTTP | route | Description: |
---|---|---|
PUT, PATCH | api/services/{service} |
Update a specified Service by id, e.g. api/services/2
|
HTTP | route | Description: |
---|---|---|
DLETE | api/services/{service} |
Delete a specified Service by id, e.g. api/services/2
|
HTTP | route | Description: |
---|---|---|
GET | api/services/{service}/service_tags |
Retrieve all ServiceTags for a Service by id, e.g. api/services/2/service_tags
|
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. |
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. |
HTTP | route | Description: |
---|---|---|
GET | api/service_tags |
List all of the ServiceTags. |
HTTP | route | Description: |
---|---|---|
POST | api/service_tags |
Create a new ServiceTag. |
HTTP | route | Description: |
---|---|---|
GET | api/service_tags/{service_tag} |
Get a specified ServiceTag by id, e.g. api/service_tags/2
|
HTTP | route | Description: |
---|---|---|
PUT, PATCH | api/service_tags/{service_tag} |
Update a specified ServiceTag by id, e.g. api/service_tags/2
|
HTTP | route | Description: |
---|---|---|
DELETE | api/service_tags/{service_tag} |
Delete a specified ServiceTag by id, e.g. api/service_tags/2
|