orki-core-view
v0.0.56
Published
## Como instalar
Downloads
128
Readme
orki-core-view
Como instalar
npm install orki-core-view
Como configurar
npx orki-core-view configure
Informe o endereço do servidor e o token de acesso.
Como importar um projeto existente
Esse comando irá importar o projeto do servidor para o diretório atual
npx orki-core-view import -p <path>
Cada arquivo schema
deve ser criado com as seguintes convenções:
- Sulfixo:
<name>.model.yaml
para modelo de dados - Sulfixo:
<name>.api.yaml
para api - Sulfixo:
<name>.view.yaml
para view
Exemplo de arquivo de modelo de dados
name: <name>
fields:
- name: <name>
typeField: String | Number | Boolean | Date | JSON | StringI18N | DynamicSelect | StaticSelect
required: true
- name: <withRegex>
typeField: String
required: true
optionsType:
String:
validate:
regex: ^[A-Z]{2}$
errorMessage: <messageOfError>
- name: <name>
typeField: StaticSelect
required: true
optionsType:
StaticSelect:
optionsList:
- <option1>
- <option2>
- name: isVisible
typeField: Boolean
- name: <name>
typeField: DynamicSelect
optionsType:
DynamicSelect:
model: <modelName>
- name: created_at
typeField: Date
optionsType:
Date:
defaultDateNowOnCreate: true
- name: updated_at
typeField: Date
optionsType:
Date:
defaultDateNowOnUpdate: true
defaultDateNowOnCreate: true
indexes:
- _id: 6501b4289f33a344d2c99452
name: unique_by_
fields:
- _id: 6501b4289f33a38060c99453
name: user
ordenation: asc
- _id: 6501b4289f33a36af2c99454
name: value
ordenation: asc
- _id: 6501b4289f33a3d112c99455
name: type
ordenation: asc
unique: true
sparse: false
Exemplo de arquivo de api
name: <name>
model: <modelName>
workspaces:
- <workspaceName> # Nome do workspace
permissions:
canCreate: true
canGet: true
canList: true
canUpdate: true
canDelete: true
canImport: true
hooks:
beforeCreate: <scriptName>
beforeUpdate: <scriptName>
beforeDelete: <scriptName>
beforeGet: <scriptName>
beforeList: <scriptName>
afterCreate: <scriptName>
afterUpdate: <scriptName>
afterDelete: <scriptName>
afterGet: <scriptName>
afterList: <scriptName>
fields:
- name: <fieldNameFromModel>
select:
optionsType:
DynamicSelect:
selectFields:
- <fieldName_1>
- <fieldName_2>
isList: true # Se o campo é incluído na listagem
isGet: true # Se o campo é incluído na consulta
- name: type
select:
optionsType:
StaticSelect:
hasSearch: true # Se o campo possui busca via `query`
isList: true
isGet: true
Exemplo de arquivo de view
name: <MenuName>
api: <apiName>
identifier: <identifier>
workspaces:
- <workspaceName> # Nome do workspace
defaultFieldView:
title: <fieldName>
startDate: <fieldName>
endDate: <fieldName>
fields:
- name: <fieldName>
label: <label>
layout:
xs: "12"
sm: "12"
md: "12"
lg: "12"
xl: "12"
visible:
editMode: true
addMode: true
listMode: true
cloneMode: true
order: 0 # Ordem de exibição -1 (desc) / 0 (não ordena) / 1 (asc)
- name: <fieldName>
label: <label>
optionsType:
DynamicSelect:
diplayFields:
- <fieldName_1>
- <fieldName_2>
api: <apiName>
view: <viewName> # Gera um link nas view para facilitar a navegação
layout:
xs: "12"
sm: "12"
md: "12"
lg: "12"
xl: "12"
visible:
editMode: true
addMode: true
listMode: true
cloneMode: true
order: 0
- name: <fieldName>
label: <label>
optionsType:
String:
component: textfield | textarea | richtext
layout:
xs: "12"
sm: "12"
md: "12"
lg: "12"
xl: "12"
visible:
editMode: true
addMode: true
listMode: true
cloneMode: true
- name: <fieldName>
label: <label>
optionsType:
Date:
dateFormat: DD/MM/YYYY
timeFormat: HH:mm
isTimeAgo: true
layout:
xs: "12"
sm: "12"
md: "12"
lg: "12"
xl: "12"
visible:
editMode: true
addMode: false
listMode: true
cloneMode: false
order: -1
actions:
- name: <actionName>
identifier: <identifier>
code: <scriptName>
description: <description>
icon: list_alt
inputs:
- name: <fieldName>
label: <label>
typeField: String | Number | Boolean | Date | JSON | StringI18N | DynamicSelect | StaticSelect
optionsType:
DynamicSelect:
diplayFields:
- <fieldName_1>
api: <apiName>
layout:
xs: "12"
sm: "12"
md: "12"
lg: "12"
xl: "12"
relationships:
- fields:
- <fieldName> # Campo da view para fazer o relacionamento
view: <viewName>
name: <relationshipName>
Como fazer o deploy de um schema
Fazendo deploy de um arquivo
npx orki-core-view deploy -f ./tmp/out/product/views/product.view.yaml
Fazendo deploy de um diretório
npx orki-core-view deploy -p tmp/ -t <model|api|view>