Skip to content

Node.js micro-service that maintains a MongoDB database state.

Notifications You must be signed in to change notification settings

CharidimosTzedakis/company-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

company-api

start the microservice with: npm start run the test suite with: npm test

Mongo DB Configuration

  • For production environment: Database: Business Collection: companies
  • For testing environment: Database: BusinessTest Collection: companies

Endpoints

POST /api/company

Create a new company. Example post request body:

{
  "displayName": "Xara",
  "workspaces": [
    {
      "displayName": "XaraLondon",
      "users": [
        {"email": "[email protected]", "role": "admin"},
        {"email": "[email protected]", "role": "basic"}
      ]
    },
    {
      "displayName": "XaraBerlin",
      "users": [
        {"email": "[email protected]", "role": "admin"},
        {"email": "[email protected]", "role": "basic"}
      ]
    }
  ]
}
PATCH /api/company/:companyId

Update an existing company. Example patch request body:

{
  "displayName": "Xara",
  "workspaces": [
    {
      "displayName": "XaraLondonNew",
      "users": [
        {"email": "[email protected]", "role": "admin"},
      ]
    },
    {
      "displayName": "XaraBerlinOld",
      "users": [
        {"email": "[email protected]", "role": "admin"},
        {"email": "[email protected]", "role": "basic"},
        {"email": "[email protected]", "role": "basic"}
      ]
    }
  ]
}
POST /api/workspace/:companyName

Create a workspace within a specific company. Example post request body:

{
  "displayName": "XaraAthens",
  "users": [
	{"email": "[email protected]", "role": "admin"},
	{"email": "[email protected]", "role": "basic"}
  ]
}
PATCH /api/workspace/:companyName

Update a specific workspace within a specific company. Example patch request body:

{
  "id": "b8e6b760-f75c-11e8-a201-93dd10335524",
  "displayName": "XaraAthensNew",
  "users": [
	{"email": "[email protected]", "role": "admin"},
  ]
}
POST /api/user/:companyName

Create a new user to a specific workspace in a company. Example post request body:

{
  "workspaceName": "xaraathens",
  "user": 
  {
	"email": "[email protected]", 
	"role": "admin"
  }
}
DELETE /api/user/:companyName

Remove a user from a specific workspace within a company. Example delete reqest body:

{
  "workspaceName": "xaraathens",
  "userEmail": "[email protected]"
}

About

Node.js micro-service that maintains a MongoDB database state.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published