Buscar en la wiki...

📦 Aplicaciones

Dispondremos de toda la información de nuestras aplicaciones. Campos, propiedades, validaciones...etc.

🧠 Debes saber que...

A lo largo de toda esta sección encontraras el término APPNAME . Este se sustituye por el permalink de la aplicacion que estes usando en ese momento.

Listar aplicaciones

this.$gestios.apps(live = false)

Devuelve todas las aplicaciones del proyecto.

await this.$gestios.apps();

// [
//    {
//       "ID":"102",
//       "Name":"Cars",
//       "NameSingular":"Car",
//       "Permalink":"cars",
//       "ElementsPerPage":"20",
//       "Fields":{
//          "date":{
//             "ID":"384",
//             "Name":"date",
//             "Type":"date",
//             "Required":true,
//             "Maxlength":"0",
//             "Searchable":false,
//             "Placeholder":"Manufactured Date",
//             "Vars":"",
//             "Parser":""
//          },
//          "name":{
//             "ID":"387",
//             "Name":"name",
//             "Type":"text",
//             "Required":true,
//             "Maxlength":"50",
//             "Searchable":true,
//             "Placeholder":"Car Name",
//             "Vars":"",
//             "Parser":""
//          },
//         "brand":{
//             "ID":"387",
//             "Name":"brand",
//             "Type":"relation",
//             "Required":true,
//             "Maxlength":"50",
//             "Searchable":true,
//             "Placeholder":"Car Name",
//             "Vars":"{
//                "type":"single",
//                "table":"brands",
//                "column":"_EntityId",
//                "return":["name"],
//                "group_duplicates":"true",
//                "ondelete": "set_null"
//             }",
//             "Parser":""
//          },
//       }
//    },
//    {
//       "ID":"142",
//       "Name":"Brands",
//       "NameSingular":"Brand",
//       "Permalink":"brands",
//       "ElementsPerPage":"20",
//       "Fields":{
//          "name":{
//             "ID":"655",
//             "Name":"name",
//             "Type":"text",
//             "Required":true,
//             "Maxlength":"200",
//             "Searchable":true,
//             "Placeholder":"Brand Name",
//             "Vars":"",
//             "Parser":""
//          },
//          "logo":{
//             "ID":"656",
//             "Name":"logo",
//             "Type":"media",
//             "Required":false,
//             "Maxlength":"",
//             "Searchable":false,
//             "Placeholder":"Image Logo",
//             "Vars":"",
//             "Parser":""
//          },
//       }
//    }
// ]
PropiedadDescripcionTipoPredefinido
liveConsula en cache o en live. Si se establece a true se recogerá la información a tiempo real.Booleanfalse

Obtener aplicación

this.$gestios.app(appName, live = false).data()

Devuelve la aplicación específica y su información.

await this.$gestios.app('cars', true).data();

// 
//  {
//       "ID":"102",
//       "Name":"Cars",
//       "NameSingular":"Car",
//       "Permalink":"cars",
//       "ElementsPerPage":"20",
//       "Fields":{
//          "date":{
//             "ID":"384",
//             "Name":"date",
//             "Type":"date",
//             "Required":true,
//             "Maxlength":"0",
//             "Searchable":false,
//             "Placeholder":"Manufactured Date",
//             "Vars":"",
//             "Parser":""
//          },
//          "name":{
//             "ID":"387",
//             "Name":"name",
//             "Type":"text",
//             "Required":true,
//             "Maxlength":"50",
//             "Searchable":true,
//             "Placeholder":"Car Name",
//             "Vars":"",
//             "Parser":""
//          },
//          "brand":{
//             "ID":"387",
//             "Name":"brand",
//             "Type":"relation",
//             "Required":true,
//             "Maxlength":"50",
//             "Searchable":true,
//             "Placeholder":"Car Name",
//             "Vars":"{
//                "type":"single",
//                "table":"brands",
//                "column":"_EntityId",
//                "return":["name"],
//                "group_duplicates":"true",
//                "ondelete": "set_null"
//             }",
//             "Parser":""
//          },
//      }
//  }
// 
PropiedadDescripcionTipoPredefinido
appNameNombre único de la aplicaciónStringNecesario
liveConsula en cache o en live. Si se establece a true se recogerá la información a tiempo real.Booleanfalse

Obtener campo de aplicación

this.$gestios.app(appName, live = false).field(fieldName)

Devuelve la aplicación específica y su información.

await this.$gestios.app('cars', true).field('date');

// 
//  {
//      "ID":"384",
//      "Name":"date",
//      "Type":"date",
//      "Required":true,
//      "Maxlength":"0",
//      "Searchable":false,
//      "Placeholder":"Manufactured Date",
//      "Vars":"",
//      "Parser":""
//  }
// 
PropiedadDescripcionTipoPredefinido
appNameNombre único de la aplicaciónStringNecesario
liveConsula en cache o en live. Si se establece a true se recogerá la información a tiempo real.Booleanfalse
fieldNameNombre único del campoStringNecesario

Listar registros

this.$gestios.items(APPNAME).list({ page = 1, filters = null, order = null, limit = 20, silent = false, reset = false, view = null })

Devuelve los registros de una aplicacion específica

this.$gestios.items('cars').list({
    page:1,
    order: {date:'desc', name: 'asc'},
    limit:20,
    silent: false,
    reset:false,
    view: 'carViewTable',
    filters: [{
        _ParentOperator:"OR",
        _Operator:"OR",
        Fields: {
            "name": {
                "type":"text",
                "value":"hyundai",
                "lig":"%"
            }
         }
    }]
}).then((result) => {
    console.log(result);
});

// {
//     ok: true,
//     total: 2,
//     data: [{
//         name: "Hyundai Coupe 1.6",
//         date: "2019-05-04",
//         brand: 1,
//         _Comments: []
//         _EntityCreateDate: "2019-05-04 20:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 18
//         _EntityStatus: 1
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     },{
//         name: "Hyundai Accent 2.0",
//         date: "2019-06-01",
//         brand: 1,
//         _Comments: []
//         _EntityCreateDate: "2019-05-03 16:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 19
//         _EntityStatus: 1
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     }]
// }
PropiedadDescripcionTipoPredefinido
pageNúmero de páginaInteger1
limitLimitar numero de registros devueltosObject20
viewGuarda los resultados en una caché de vistaStringnull
orderOrdenar registros por camposObjectnull
filterFiltra los registros por una serie de condicionesObjectnull
silentNo alerta ni muestra barra de progresoBooleanfalse
resetBorra la caché de objetosBooleanfalse

Permisos necesarios:

  • view.APPNAME Ver todos los registros
  • view.mine.APPNAME Ver registros propios

Obtener registro

this.$gestios.items(APPNAME).get({ id, silent = false })

Devuelve el registro específico de una aplicacion

this.$gestios.items('cars').get({
    id: 18,
    silent: true,
}).then((result) => {
    console.log(result);
});

// {
//     ok: true,
//     data: {
//         name: "Hyundai Coupe 1.6",
//         date: "2019-05-04",
//         brand: 1,
//         _Comments: []
//         _EntityCreateDate: "2019-05-04 20:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 18
//         _EntityStatus: 1
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     }
// }
PropiedadDescripcionTipoPredefinido
idID único del registroIntegerNecesario
silentNo alerta ni muestra barra de progresoBooleanfalse

Permisos necesarios:

  • view.APPNAME Ver todos los registros
  • view.mine.APPNAME Ver registros propios
🧠 Debes saber que...

Hay que sustituir APPNAME por el nombre de la aplicacion especifica. En este ejemplo sería view.cars o view.mine.cars

Añadir registro

this.$gestios.items(APPNAME).add({ params, view = null, callback = null })

Añade un registro nuevo en la aplicación específica

this.$gestios.items('cars').add({
    params: {
        name: 'Alfa Romeo',
        date: '2019-06-07',
        brand: 4
    },
    view: 'carViewTable',
    callback: 'http://midominio.com/script.php'
}).then((result) => {
    console.log(result);
});

// {
//     ok: true,
//     data: {
//         name: "Alfa Romeo",
//         date: "2019-06-07",
//         brand: 4,
//         _Comments: []
//         _EntityCreateDate: "2020-05-04 20:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 24
//         _EntityStatus: 1
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     }
// }
PropiedadDescripcionTipoPredefinido
paramsCampos de la aplicaciónObjectNecesario
viewVista en la que se añadirá el registro una vez creadoStringnull
callbackURL externa a la que se llamará una vez el registro sea añadidoStringnull

Permisos necesarios:

  • add.APPNAME Añadir registros
  • add.mod.APPNAME Añadir registros en estado deshabilitado

Editar registro

this.$gestios.items(APPNAME).edit({ id, params, callback = null })

Modifica un registro previamente creado de una aplicación específica

this.$gestios.items('cars').edit({
    id: 24,
    params: {
        name: 'Alfa Romeo Jullieta',
    },
    callback: 'http://midominio.com/script.php'
}).then((result) => {
    console.log(result);
});

// {
//     ok: true,
//     data: {
//         name: "Alfa Romeo Jullieta",
//         date: "2019-06-07",
//         brand: 4,
//         _Comments: []
//         _EntityCreateDate: "2020-05-04 20:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 18
//         _EntityStatus: 1
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     }
// }
PropiedadDescripcionTipoPredefinido
idID único del registroStringNecesario
paramsCampos de la aplicación a modificarObjectNecesario
callbackURL externa a la que se llamará una vez el registro sea modificadoStringnull
🧠 Debes saber que...

La información del registro se actualiza en la plataforma de forma automática en todas las vistas que se este usando.

Permisos necesarios:

  • set.APPNAME Editar registros
  • set.mine.APPNAME Editar registros propios

Bloquear/Desbloquear registro

this.$gestios.items(APPNAME).status(id)

Cambia el estado de un registro, de bloqueado a desbloqueado o viceversa.

this.$gestios.items('cars').status(24).then((item) => {
    console.log(item);
});

// {
//     ok: true,
//     data: {
//         name: "Alfa Romeo Jullieta",
//         date: "2019-06-07",
//         brand: 4,
//         _Comments: []
//         _EntityCreateDate: "2020-05-04 20:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 18
//         _EntityStatus: 0
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     }
// }
PropiedadDescripcionTipoPredefinido
idID único del registroStringNecesario
🧠 Debes saber que...

El estado del registro se actualiza en la plataforma de forma automática en todas las vistas que se este usando.

Permisos necesarios:

  • mod.APPNAME Moderar registros

Eliminar registro

this.$gestios.items(APPNAME).delete({ id, callback = null })

Elimina un registro de una aplicación específica

this.$gestios.items('cars').delete({
    id: 24,
    callback: 'http://midominio.com/script.php'
}).then((result) => {
    console.log(result);
});

// {
//     ok: true,
//     data: {
//         name: "Alfa Romeo Jullieta",
//         date: "2019-06-07",
//         brand: 4,
//         _Comments: []
//         _EntityCreateDate: "2020-05-04 20:11:23"
//         _EntityCreateIp: "127.0.0.1"
//         _EntityCreateUser: {ID: 123, Nick: "jhondoe", Nombre: "Jhon Doe", Email: "jhon@doe.com"}
//         _EntityId: 18
//         _EntityStatus: 0
//         _EntityUpdateDate: null
//         _EntityUpdateIp: null
//         _EntityUpdateUser: null
//     }
// }
PropiedadDescripcionTipoPredefinido
idID único del registroStringNecesario
callbackURL externa a la que se llamará una vez el registro sea eliminadoStringnull
🧠 Debes saber que...

El registro se eliminará de todas las vistas cacheadas de la plataforma de forma automática.

Permisos necesarios:

  • del.APPNAME Eliminar registros
  • del.mine.APPNAME Eliminar registros propios

Verificar autorización

this.$gestios.items(APPNAME).auth({ scopes, item, strict = true, user = null })

Comprueba si tu usuario tiene autorización de un registro en funcion de los roles especificados

const check = this.$gestios.items('cars').auth({
    scopes = [
        'view.cars',
        'view.mine.cars'
    ],
    item: (... ItemObject),
    user: (... UserObject),
    strict: false
})
console.log(check);

// true / false

En este caso comprobariamos si el usuario especificado tiene permisos frente al registro dado en modo lectura.

PropiedadDescripcionTipoPredefinido
scopesArray de rolesArrayNecesario
itemObjeto de registroStringNecesario
userObjeto de usuario. Si no se precisa se usa el tuyo.Stringnull
strictSi es true se precisaran todos los rolesBooleanfalse
🧠 Debes saber que...

El registro se eliminará de todas las vistas cacheadas de la plataforma de forma automática.

Permisos necesarios:

  • del.APPNAME Eliminar registros
  • del.mine.APPNAME Eliminar registros propios