Git Product home page Git Product logo

doctor's Introduction

doctor

This service provides informations about user three health related questions using spring boot.

Instalation

To install and test this service you need just to clone it and have java and maven installed in you system.

mvn test

Endpoints

Request type Target path Response
post /consultation OK (201) The Consultation has successfully been saved
get {user_id}/consultation OK (200) The user and consultations was successfully been fetched else (404) user not found

Usage

Create a consultation

To Create a consultation, We can provide a simple form with 3 and submit the data to the api. The response to an HTTP POST request might look like:

    {
		id: 1,
		firstanswer: "lorem ipsum",
		secondanswer: "lorem ipsum",
        thirdanswer: "lorem ipsum",
        user: {
        	id: 1
            username: 
        }
	}

Retrive a collection of consultation

We can get all user consultation by consume the get request {user_id}/consultation The response to an HTTP GET request might look like:

    [{
		id: 1,
		firstanswer: "lorem ipsum",
		secondanswer: "lorem ipsum",
        thirdanswer: "lorem ipsum"
	},
    {
		id: 2,
		firstanswer: "lorem ipsum",
		secondanswer: "lorem ipsum",
        thirdanswer: "lorem ipsum"
	}
    {
		id: 2,
		firstanswer: "lorem ipsum",
		secondanswer: "lorem ipsum",
        thirdanswer: "lorem ipsum"
	}
    ...
    ]

Structure

Model layer

See the model folder, there are two objects which are User and Consultation. I thought to do One to Many relation between them.

Dao layer

I used two Spring Data JPA repositories to handle the database interactions and embaded database to store datastructure.

Testing the Service

Look at /src/test/java/com/ib92/doctor/api The first thing to look at is this @Before-annotated setup method. The first thing the setup method does is instantiate a MockMvc the MockMvc is the center piece: all tests will invariably go through the MockMvc type to mock HTTP requests against the service.

mockMvc.perform(get("/" + userId + "/consultations/"
                + this.bookmarkList.get(0).getId()))
                .andExpect(status().isOk())

doctor's People

Contributors

ibrahimhizeoui avatar

Watchers

James Cloos 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.