Dispondremos de toda la información de nuestras aplicaciones. Campos, propiedades, validaciones...etc.
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":""
// },
// }
// }
// ]
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| live | Consula en cache o en live. Si se establece a true se recogerá la información a tiempo real. | Boolean | false |
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":""
// },
// }
// }
//
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| appName | Nombre único de la aplicación | String | Necesario |
| live | Consula en cache o en live. Si se establece a true se recogerá la información a tiempo real. | Boolean | false |
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":""
// }
//
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| appName | Nombre único de la aplicación | String | Necesario |
| live | Consula en cache o en live. Si se establece a true se recogerá la información a tiempo real. | Boolean | false |
| fieldName | Nombre único del campo | String | Necesario |
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
// }]
// }
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| page | Número de página | Integer | 1 |
| limit | Limitar numero de registros devueltos | Object | 20 |
| view | Guarda los resultados en una caché de vista | String | null |
| order | Ordenar registros por campos | Object | null |
| filter | Filtra los registros por una serie de condiciones | Object | null |
| silent | No alerta ni muestra barra de progreso | Boolean | false |
| reset | Borra la caché de objetos | Boolean | false |
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
// }
// }
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| id | ID único del registro | Integer | Necesario |
| silent | No alerta ni muestra barra de progreso | Boolean | false |
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
// }
// }
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| params | Campos de la aplicación | Object | Necesario |
| view | Vista en la que se añadirá el registro una vez creado | String | null |
| callback | URL externa a la que se llamará una vez el registro sea añadido | String | null |
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
// }
// }
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| id | ID único del registro | String | Necesario |
| params | Campos de la aplicación a modificar | Object | Necesario |
| callback | URL externa a la que se llamará una vez el registro sea modificado | String | null |
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
// }
// }
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| id | ID único del registro | String | Necesario |
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
// }
// }
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| id | ID único del registro | String | Necesario |
| callback | URL externa a la que se llamará una vez el registro sea eliminado | String | null |
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.
| Propiedad | Descripcion | Tipo | Predefinido |
|---|---|---|---|
| scopes | Array de roles | Array | Necesario |
| item | Objeto de registro | String | Necesario |
| user | Objeto de usuario. Si no se precisa se usa el tuyo. | String | null |
| strict | Si es true se precisaran todos los roles | Boolean | false |