Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Latest commit

 

History

History
276 lines (229 loc) · 6.89 KB

README.md

File metadata and controls

276 lines (229 loc) · 6.89 KB

Errors documentation

This document contains all the business logic errors that the API may send to the client as a response when an error occurs.

Errors

Unique Constraint

Thrown when a property value must be unique and the value inserted it is not.

  • Type: /errors/unique-constraint
  • SQL Type: unique-constraint
Status: 409 Conflict
{
    "type": "/errors/unique-constraint",
    "title": "The company 'ISEL' already exists. Please try another one.",
    "instance": "/companies"
}

Database Write Error

Thrown when occurred an error in a write operation in the PostgreSQL database.

  • Type: /errors/database-write-error
  • SQL Type: unknown-error-writing-resource
Status: 500 Internal Server Error
{
    "type": "/errors/database-write-error",
    "title": "An error occurred writing the resource, please try again later.",
    "instance": "/companies"
}

Inactive Resource

Thrown when it is requested to change a resource that is on an inactive state.

  • Type: /errors/inactive-resource
  • SQL Type: inactive-resource
Status: 409 Conflict
{
    "type": "/errors/database-write-error",
    "title": "It's not possible to change an inactive resource.",
    "detail": "To change it, you need to activate it first.",
    "instance": "/companies/1"
}

Inactive or Banned Person

Thrown when it is requested to change an information of a person on an inactive or banned state.

  • Type: /errors/inactive-or-banned-person
  • SQL Type: change-inactive-or-banned-person
Status: 409 Conflict
{
    "type": "/errors/inactive-or-banned-person",
    "title": "It's not possible to change an inactive or banned person.",
    "instance": "/persons/c2b393be-d720-4494-874d-43765f5116cb"
}

Person Dismissal

Thrown when the person to fire or rehire it is not an employee or a manager.

  • Type: /errors/person-dismissal
  • SQL Type: person-dismissal
Status: 409 Conflict
{
    "type": "/errors/person-dismissal",
    "title": "Only other employees or managers can be fired or rehired.",
    "instance": "/persons/c2b393be-d720-4494-874d-43765f5116cb"
}

Person Ban

Thrown when a managers tries to ban a person that is not a guest or a user.

  • Type: /errors/person-ban
  • SQL Type: manager-ban-permission
Status: 409 Conflict
{
    "type": "/errors/person-ban",
    "title": "A manager can only ban guests or users.",
    "instance": "/persons/c2b393be-d720-4494-874d-43765f5116cb"
}

Minimum Roles Skills

Thrown when is requested to remove a role or a skill from a person when they are already in the limit. The persons must have at least one.

  • Type: /errors/minimum-roles-skills
  • SQL Types: minimum-roles, minimum-skills
Status: 409 Conflict
{
    "type": "/errors/minimum-roles-skills",
    "title": "A person must have, at least, one role associated.",
    "instance": "/persons/c2b393be-d720-4494-874d-43765f5116cb"
}

Company Person Roles

Thrown when a person tries to assign another person that is not an employee or a manager to a company.

  • Type: /errors/company-person-roles
  • SQL Type: company-persons
Status: 409 Conflict
{
    "type": "/errors/company-person-roles",
    "title": "Only an employee or a manager can be assigned to a company.",
    "instance": "/persons/c2b393be-d720-4494-874d-43765f5116cb"
}

Invalid Role

Thrown when a person does not have the required role to complete the request.

  • Type: /errors/invalid-role
  • SQL Type: invalid-role
Status: 409 Conflict
{
    "type": "/errors/invalid-role",
    "title": "You don't have the required role assigned.",
    "instance": "/persons/c2b393be-d720-4494-874d-43765f5116cb"
}

Invalid Company

Thrown when a person that does not belong to a company tries to access some resource of that company.

  • Type: /errors/invalid-company
  • SQL Type: invalid-company
Status: 409 Conflict
{
    "type": "/errors/invalid-company",
    "title": "The manager must belong to the ticket company to access or make changes.",
    "instance": "/companies/1"
}

Category Being Used

Thrown when is made a request to deactivate a category that is in use.

  • Type: /errors/category-being-used
  • SQL Type: category-being-used
Status: 409 Conflict
{
    "type": "/errors/category-being-used",
    "title": "To deactivate a category, it must not be linked to a device or an employee.",
    "instance": "/categories/1"
}

Archived Ticket

Thrown when is made a request to change some ticket information when it is on the archived state.

  • Type: /errors/archived-ticket
  • SQL Type: archived-ticket
Status: 409 Conflict
{
    "type": "/errors/archived-ticket",
    "title": "It's not possible to change an archived ticket.",
    "instance": "/tickets/1"
}

Fixing Ticket

Thrown when is made a request to update the subject or the description of a ticket that is already being fixed, i.e. that in the fixing state.

  • Type: /errors/fixing-ticket
  • SQL Type: fixing-ticket
Status: 409 Conflict
{
    "type": "/errors/fixing-ticket",
    "title": "It's not possible to update a ticket that is already being fixed.",
    "instance": "/tickets/1"
}

Ticket Employee Skill Mismatch

Thrown when a ticket is delivered to an employee that does not have the required skills to solve the ticket.

  • Type: /errors/ticket-employee-skill-mismatch
  • SQL Type: ticket-employee-skill-mismatch
Status: 409 Conflict
{
    "type": "/errors/ticket-employee-skill-mismatch",
    "title": "The employee doesn't have the skills to solve the ticket.",
    "instance": "/tickets/1/employee"
}

Ticket Rate

Thrown when is made a request to set the rate of a ticket that is not on the archived state yet.

  • Type: /errors/ticket-rate
  • SQL Type: ticket-rate
Status: 409 Conflict
{
    "type": "/errors/ticket-rate",
    "title": "The ticket must be archived to be able to receive a rating.",
    "instance": "/tickets/1/rate"
}