Giter VIP home page Giter VIP logo

vet-practice-app's Introduction

NOTE

I've stopped hosting this project on AWS, so some of the below will be out of date. This was done to reduce my footprint on the web.

Wildlife Sumpreme Veterinary Practice

This mock veterinary practice database web application and API was developed over 2 weeks of the developme bootcamp learning and applying the skills listed in the gitHub topics. It uses Laravel Blade to display lists of owners and their animals from the MySQL database. It contains forms that allow for adding/updating these based on your user role. We also developed an API (using a test driven development approach) with Laravel that can be used to query and update the database (based on OAUTH and user role). Finally we deployed the site on AWS and set up Capistrano to enable Continuous Deployment of updates to the site.

Website

https://wildlifesupreme.developme.space

API

https://wildlifesupreme.developme.space/api/

Local Set Up

  1. Clone the git repository to your local machine by running the following command in your terminal.
  • Use the main branch in git to run this project locally.
git clone {url}
  1. In your terminal cd into the project directory and run the below composer command to install neccessary dependencies
cd {project-directory}
composer install
  1. Set up homestead virtual machine.
  • Run the below command in the project directory
vendor/bin/homestead make
  • This will create a Homestead.yaml file inside your project directory
    • Inside this file edit the memory to be 512
      • memory: 512
  1. Create the .env file
  • Run the below command in the project directory
cp .env.example .env
  1. Spin up the virtual machine
vagrant up
  1. Once the above is complete, ssh into the virtual machine and cd to the code directory
vagrant ssh
cd code
  1. Generate the app key, this will be set in your .env file
art key:generate
  1. Run the MySQL table migrations to set up the database,
  • You can omit the --seed if you'd like to start with a blank database, otherwise this will seed the database with test data using faker.
art migrate:fresh --seed
  1. Navigate to http://homestead.test
  • You should see the homepage

Running tests

In the vagrant box run: artisan test

This runs all the unit tests for the app and API.

Wildlife Supreme Veterinary Practice Database API

Base URL

https://wildlifesupreme.developme.space/api/

Authentication

In order to use the service you'll need to have an account created for you. Message me and I'll get you set up.

Once you have the account information, make the following request to recieve a Bearer Token:

POST https://wildlifesupreme.developme.space/oauth/token

Request

{
    "grant_type": "password",
    "client_id": "<your_client_id>",
    "client_secret": "<your_client_secret>",
    "username": "[email protected]",
    "password": "password"
}

Response

{
    "token_type": "Bearer",
    "expires_in": 31535999,
    "access_token": "...",
    "refresh_token": "..."
}

Usage

You'll need to use your token for all requests.

For example, if your response was:

{
    "token_type": "Bearer",
    "expires_in": 31535999,
    "access_token": "massivelylongaccesstoken",
    "refresh_token": "..."
}

All your requests should have the following header:

Authorization: Bearer massivelylongaccesstoken

Owners

GET /owners

Will return a list of all animal owners, their details, and the animals they own.

{
    "data": [
        {
            "id": 1,
            "name": "Helena Beahan",
            "address": "Adah Villages, Suite 833, West Hudson, 52447-8504",
            "animals": [
                "Dr. Destiny Crist",
                "Hardy Luettgen",
                "Doogo"
            ]
        },
        {
            "id": 2,
            "name": "Grayce Graham",
            "address": "Dicki Vista, Apt. 837, Lake Elouiseport, 14515-7225",
            "animals": [
                "Felipe Walsh Sr.",
                "Nyasia Reynolds",
                "Dr. Dina Fadel PhD"
            ]
        },
    ]
}

POST /owners

Will create a new owner

Request

{	
    "first_name": "<first name>", // REQ - String
    "last_name" : "<last name>", // REQ - String
    "address_1": "<address_1>", // REQ - String
    "address_2": "<address_2>", // REQ - String
    "town": "<town>", // REQ - String
    "telephone": "+XXXXXXXXXXX", // REQ - String
    "postcode": "<postcode>", // REQ - String
    "user_id": {id} // // REQ - integer creating user, 
}

GET /owners/<id>

Will return an owner with the given id.

{
        "id": 1,
        "name": "Helena Beahan",
        "address": "Adah Villages, Suite 833, West Hudson, 52447-8504",
        "animals": [
            "Dr. Destiny Crist",
            "Hardy Luettgen",
            "Doogo"
        ]
}

PUT /owners/<id>

Will update an existing owner.

Request

Use the same request format as POST /owners.

DELETE /owners/<id>

Will delete an existing owner

Animals

GET /animals

Will return a list of all animals and their details.

{
    "data": [
        {
            "id": 1,
            "name": "Ludwig Walter",
            "dob": "1974-12-29",
            "weight": 76.47,
            "height": 283.58,
            "biteyness": 3,
            "owner": "Christ Williamson",
            "treatments": [
                "Neuter",
                "de-clawing",
                "spay"
            ]
        },
        {
            "id": 2,
            "name": "Felipe Walsh Sr.",
            "dob": "1979-10-06",
            "weight": 129.47,
            "height": 367.74,
            "biteyness": 1,
            "owner": "Grayce Graham",
            "treatments": [
                "spay",
                "spay",
                "shaving"
            ]
        },
    ]
}

POST /animals

Will create a new animal. Similar to using POST /owners/<id>/animals, but in this case you must include the owner_id in the request.

Request

{	
    "name": "<animal name>", // REQ - string
    "date_of_birth": "YYYY-MM-DD", // REQ - date
    "type": "<type of animal>", // REQ - string
    "weight": n.nn, // REQ - float in kg
    "height": n.nn, // REQ - float in cm
    "biteyness": n, // REQ - integer 1-5
    "owner_id": int, // REQ - owner ID
    "treatments": ["treatment 1", "treatment 2"] // OPT - array of strings
}

GET /animals/<id>

Will return an animal with the given id.

{
    "data": {
        "id": 5,
        "name": "Chloe Raynor",
        "dob": "1988-10-05",
        "weight": 175.61,
        "height": 495.78,
        "biteyness": 5,
        "owner": "Arvel Bauch",
        "treatments": [
            "de-clawing",
            "Neuter",
            "Toenail Removal"
        ]
    }
}

PUT /animals/<id>

Will update an existing owner.

Request

Use the same request format as POST /animals.

DELETE /animals/<id>

Will delete an existing animal

Animals and Owners

GET /owners/<id>/animals

Get the animals for an owner

Response

{
    "data": [
        {
            "id": 39,
            "name": "Dr. Destiny Crist",
            "dob": "2011-02-20",
            "weight": 33.39,
            "height": 86.05,
            "biteyness": 2,
            "owner": "Helena Beahan",
            "treatments": [
                "Flea Treatment",
                "spay",
                "petting therapy"
            ]
        },
        {
            "id": 82,
            "name": "Hardy Luettgen",
            "dob": "2015-09-01",
            "weight": 185.6,
            "height": 16.07,
            "biteyness": 5,
            "owner": "Helena Beahan",
            "treatments": [
                "petting therapy",
                "shaving",
                "petting therapy"
            ]
        },
        {
            "id": 101,
            "name": "Doogo",
            "dob": "2020-01-01",
            "weight": 4,
            "height": 12,
            "biteyness": 2,
            "owner": "Helena Beahan",
            "treatments": []
        }
    ]
}

POST /owners/<id>/animals

Add a new animal to an owner

Request

{	
    "name": "<animal name>", // REQ - string
    "date_of_birth": "YYYY-MM-DD", // REQ - date
    "type": "<type of animal>", // REQ - string
    "weight": n.nn, // REQ - float in kg
    "height": n.nn, // REQ - float in cm
    "biteyness": n, // REQ - integer 1-5
    "treatments": ["treatment 1", "treatment 2"] // OPT - array of strings
}

Deployment

  • Hosted on free AWS EC2 instance
bundle exec cap production deploy

Laravel Documentation

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [email protected]. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-sourced software licensed under the MIT license.

vet-practice-app's People

Contributors

dependabot[bot] avatar nosvalds avatar

Stargazers

 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.