Git Product home page Git Product logo

company's Introduction

Company

Requirements:

Installation:

Run this command in projects directory:

change directory:

  • cd company

install dependencies:

  • composer install

create .env.testing file:

cp .env.testing.example .env.testing

create database:

php artisan db:create company

create test database:

php artisan db:create company_test

run migrations:

php artisan migrate

start the app:

php artisan serve

Testing

Run test:

php artisan test

API endpoints:

Positions

Create position:

REQUEST:
POST api/v1/positions

BODY: {
    "name": "string|required|unique",
    "type": "string|required" (regular|management)
}

RESPONSE 201: PositionResource

List positions:

REQUEST:
GET api/v1/positions

RESPONSE 200: PositionResource collection

Edit position:

REQUEST:
PATCH api/v1/positions/{position:id}
BODY: {
    "name": "string|optional|unique",
    "type": "string|optional" (regular|management)
}
RESPONSE 202: PositionResource

Show single position:

REQUEST:
GET api/v1/positions/{position:id}

RESPONSE 200: PositionResource

Delete position:

REQUEST:
DELETE api/v1/positions/{position:id}

RESPONSE 204: No Content

Employee

Create employee:

REQUEST:
POST api/v1/employee

BODY: {
    "name": "string|required",
    "superior_id": "int|nullable",
    "position_id": "int|required",
    "start_date": "date_format:"Y-m-d"|required",
    "end_date": "date_format:"Y-m-d"|required",
}

RESPONSE 201: EmployeeResource

Create employee:

REQUEST:
POST api/v1/employees

BODY: {
    "name": "string|required",
    "superior_id": "int|nullable",
    "position_id": "int|required",
    "start_date": "date_format:"Y-m-d"|required",
    "end_date": "date_format:"Y-m-d"|required",
}

RESPONSE 201: EmployeeResource

List all employees:

REQUEST:
GET api/v1/employees

QUERY PARAMETERS => page (optional) ie.  api/v1/employees?page=2

RESPONSE 200: EmployeeResource collection paginated

Show employee:

REQUEST:
GET api/v1/employees/{employee:id}

RESPONSE 200: EmployeeResource

Update employee:

REQUEST:
PATCH api/v1/employees/{employee:id}

BODY: {
    "name": "string|optional",
    "superior_id": "int|optional",
    "position_id": "int|optional",
    "start_date": "date_format:"Y-m-d"|optional",
    "end_date": "date_format:"Y-m-d"|optional",
}

RESPONSE 202: EmployeeResource

Delete employee:

REQUEST:
Delete api/v1/employees/{employee:id}

RESPONSE 204: No Content

List all employees that belongs to superior:

REQUEST:
GET api/v1/employees/superior/{employee:id}

RESPONSE 200: EmployeeResource collection

List all employees with specific position:

REQUEST:
GET api/v1/employees/position/{position:id}

RESPONSE 200: EmployeeResource collection

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.