AdminType


Un tipo de administrador dentro de una Company. Define un conjunto de roles (AdminTypeRole) que se otorgan a los Admin de ese tipo, más valores de configuración de interfaz (content). code es un identificador numérico estable dentro de la company y default_key marca el tipo por defecto.

Notas y gotchas

  • En la respuesta JSON, id expone el code y uid expone el id real del registro.
  • company_id está en $hidden.

Estructura de Datos

Atributo Tipo Descripción
id int
name string Nombre del tipo de administrador
default_key string Clave que identifica al tipo por defecto
content array Configuración de interfaz del tipo
created_at datetime\|null
updated_at datetime\|null
company_id int {@link Company} dueña del tipo (oculto)
code int\|null Identificador numérico estable del tipo dentro de la company
allLogs ApiLog>
logs ApiLog>
roles AdminTypeRole> Roles otorgados a los admins de este tipo
{
    "id": 1,
    "name": "Operador de Comercio",
    "default_key": "dashboard",
    "content": [
        {
            "key": "Branch dashboard",
            "value": {
                "is_visible": false
            }
        },
        {
            "key": "map",
            "value": {
                "is_visible": false
            }
        },
        {
            "key": "orders",
            "value": {
                "is_visible": true
            },
            "default_key": "in_queue",
            "content": {
                "0.key": "in_queue",
                "0.value.is_visible": true,
                "1.key": "preparation_started",
                "1.value.is_visible": true,
                "2.key": "prepared",
                "2.value.is_visible": true,
                "3.key": "dispatched",
                "3.value.is_visible": true
            }
        },
        {
            "key": "categories",
            "value": {
                "is_visible": false
            }
        },
        {
            "key": "goods",
            "value": {
                "is_visible": true
            }
        },
        {
            "key": "attributes",
            "value": {
                "is_visible": false
            }
        },
        {
            "key": "company",
            "value": {
                "is_visible": false
            }
        },
        {
            "key": "reports",
            "value": {
                "is_visible": false
            }
        }
    ],
    "created_at": "2020-06-09 19:40:57",
    "updated_at": "2024-12-11 18:02:48",
    "code": 1,
    "roles": [
        {
            "id": 626,
            "role": "access_clients-management",
            "created_at": "2025-02-28 20:28:20",
            "updated_at": "2025-02-28 20:28:20",
            "admin_type_id": 1
        },
        {
            "id": 249,
            "role": "access_dashboard",
            "created_at": "2024-12-11 18:02:48",
            "updated_at": "2024-12-11 18:02:48",
            "admin_type_id": 1
        },
        {
            "id": 250,
            "role": "access_map",
            "created_at": "2024-12-11 18:02:48",
            "updated_at": "2024-12-11 18:02:48",
            "admin_type_id": 1
        },
        {
            "id": 627,
            "role": "access_settings",
            "created_at": "2025-02-28 20:28:20",
            "updated_at": "2025-02-28 20:28:20",
            "admin_type_id": 1
        }
    ],
    "uid": 1
}

Endpoints

Insertar AdminType

Crear tipo de administrador

Crea un AdminType para la company (name, default_key, content, code).

Método URI Cabeceras
POST /companies/{companyId}/admin-types Authorization
{
    "name": "required|string|max:32",
    "code": "integer",
    "default_key": "required|string|max:32",
    "content": [
        {
            "key": "string|max:32",
            "value": "",
            "default_key": "string|max:32",
            "content": [
                {
                    "key": "string|max:32",
                    "value": ""
                }
            ]
        }
    ],
    "roles": [
        {
            "string": true,
            "regex": "/^(access|can)\_.+$/"
        }
    ]
}

Listar AdminType

{info} Soporta: Paginación Filters Carga dinámica

Listar tipos de administrador

Devuelve los AdminType de la company, con sus roles.

Método URI Cabeceras
GET /companies/{companyId}/admin-types Authorization

Mostrar AdminType

{info} Soporta: Carga dinámica

Mostrar tipo de administrador

Devuelve el AdminType por su id, con sus roles.

Método URI Cabeceras
GET /companies/{companyId}/admin-types/{adminTypeId} Authorization

Actualizar AdminType

Actualizar tipo de administrador

Modifica name, default_key, content y code del AdminType. Los roles se gestionan con los endpoints roles.

Método URI Cabeceras
PATCH /companies/{companyId}/admin-types/{adminTypeId} Authorization
{
    "name": "string|max:32",
    "code": "integer",
    "default_key": "string|max:32",
    "content": [
        {
            "key": "string|max:32",
            "value": "",
            "default_key": "string|max:32",
            "content": [
                {
                    "key": "string|max:32",
                    "value": ""
                }
            ]
        }
    ],
    "roles": [
        {
            "string": true,
            "regex": "/^(access|can)\_.+$/"
        }
    ]
}

Vincular AdminType

Agregar roles a un tipo de administrador

Añade los roles indicados al AdminType (crea los AdminTypeRole que falten).

Método URI Cabeceras
POST /companies/{companyId}/admin-types/{adminTypeId}/roles Authorization
[
    "string"
]

Desvincular AdminType

Quitar roles de un tipo de administrador

Elimina los roles indicados del AdminType.

Método URI Cabeceras
DELETE /companies/{companyId}/admin-types/{adminTypeId}/roles Authorization
[
    "string"
]

Eliminar AdminType

Eliminar tipo de administrador

Borra el AdminType y sus roles.

Método URI Cabeceras
DELETE /companies/{companyId}/admin-types/{adminTypeId} Authorization

Relaciones