Skip to content

Latest commit

 

History

History
65 lines (55 loc) · 1.78 KB

README.md

File metadata and controls

65 lines (55 loc) · 1.78 KB

Company Information REST API

Description

This is a Symfony-based REST API application that allows users to submit information about a company, including the company's name, NIP, address, city, and postcode, as well as information about its employees, such as name, surname, and email. All fields are mandatory except for the phone number, which is optional.

Getting started

To run this project, you'll need Docker and Docker Compose installed on your system.

Installation

  1. Clone this repository to your local machine:
    git clone https://github.com/Mariusz225/company_info_rest_api.git
  2. Navigate to the project directory:
    cd company-info-rest-api
  3. Build and start the Docker containers:
    docker-compose up -d --build
  4. Install project dependencies using Composer:
    docker exec -it company_info_rest_api-php-1 composer install
  5. Run database migrations to set up the database schema:
    docker exec -it company_info_rest_api-php-1 php bin/console doctrine:migrations:migrate

Usage

To interact with the API, you can use the following endpoint to create a company with employees: Create a Company with Employees

Endpoint: /api/company/createCompanyWithEmployees
HTTP Method: POST

Request Body:

{
  "company": {
    "name": "Company name",
    "nip": "0000000000",
    "address": "Company address",
    "city": "Company city",
    "postcode": "123-321",
    "employees": [
      {
        "employee": {
          "name": "name1",
          "surname": "surname1",
          "email": "[email protected]"
        }
      },
      {
        "employee": {
          "name": "name2",
          "surname": "surname2",
          "email": "[email protected]"
        }
      }
    ]
  }
}

Response:

{
  "companyId": "{id of created company}"
}