GithubHelp home page GithubHelp logo

tomcornall / booking-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 398 KB

Simple booking application for a doctor

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 0.60% PHP 75.26% HTML 22.74% CSS 1.40%

booking-app's Introduction

Doctor Booking App

Introduction

This simple application uses the Zend 2 Framework MVC layer and module systems. The application has 2 modules:

  • Booking
  • BookingRest (REST API)

Setup

You need to use Composer to install the project. Run the following command from the project's root directory to install required packages:

$ composer install

Once installed, we also recommend that you initially use development mode, which you can enable using:

$ composer development-enable

Create a server using the built-in composer script which makes a local PHP server:

$ composer serve

Database Setup

The database used is SQLite. The Schema is saved under the data directory and can be setup easily:

$ sqlite3 data/booking.db < data/schema.sql

// Note you might need to use `sqlite` instead of the `sqlite3` version depending on your system

The Schema is as follows:

Field name Type Null? Notes
id integer No Primary key, auto-increment
username varchar(80) No
reason varchar(255) No
start_date date No Format: Y-m-d\TH:i
end_date date No Format: Y-m-d\TH:i

API Docs

GET /api/booking

Gets a list of bookings.

http GET localhost:8080/api/booking

Response:

{
    "data": [
        {
            "id": "1",
            "username": "John Johnson",
            "reason": "Back pain",
            "start_date": "2018-10-20T08:00",
            "end_date": "2018-10-20T10:00"
        },
        {
            "id": "2",
            "username": "Jack Jimson",
            "reason": "Teeth stuff",
            "start_date": "2019-02-01T01:10",
            "end_date": "2019-11-01T01:01"
        }
    ]
}

GET /api/booking/:id

Gets a single booking, by ID.

http GET localhost:8080/api/booking/2

Response:

{
    "data": {
        "id": "2",
        "username": "Jack Jimson",
        "reason": "Teeth stuff",
        "start_date": "2019-02-01T01:10",
        "end_date": "2019-11-01T01:01"
    }
}

POST /api/booking

Creates a booking.

http POST localhost:8080/api/booking

Request Body:

{
  "username": "Test Name",
  "reason": "Itchy",
  "start_date": "2018-10-20T08:00",
  "end_date": "2018-10-20T10:00"
}

Response:

{
    "data": {
        "id": "2",
        "username": "Test Name",
        "reason": "itchy raATE11",
        "start_date": "2018-10-20T08:00",
        "end_date": "2018-10-20T10:00"
    }
}

PUT /api/booking/:id

Updates a booking.

http PUT localhost:8080/api/booking/2

Request Body:

{
  "username": "Test Name<script></script>",
  "reason": "Itchy",
  "start_date": "2018-10-20T08:00",
  "end_date": "2018-10-20T10:00"
}

Response:

{
    "data": {
        "id": "2",
        "username": "Test Name",
        "reason": "Itchy",
        "start_date": "2018-10-20T08:00",
        "end_date": "2018-10-20T10:00"
    }
}

*Note the filtered out tag.

DELETE /api/booking/:id

Deletes a booking.

http DELETE localhost:8080/api/booking/2

Response:

{
    "data": "deleted"
}

Running Unit Tests

To run the unit tests, use phpunit from the project's root directory:

$ ./vendor/bin/phpunit

And filter out specific tests:

$ ./vendor/bin/phpunit --testsuite BookingRest

booking-app's People

Contributors

tomcornall avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.