Zontroy Inner Repeating File
Last updated
Last updated
Zontroy Inner Repeating File is used to create folders, multiple code files and generate lines of code inside those. It uses .ziref extension. Name of folders and ziref files is set programatically by entering a name in Zontroy Programming Language.
[folder_name].ziref
[file_name].[file_extension].ziref
My[[[zg-entity...zg-name]]]Folder.ziref
MyClass.java.ziref
A simple usage example of ziref file in Typescript.
// folder name
zg-l(((zg-p(((zg-entity...zg-name))))))-list.ziref
// file name
// _requests.ts.ziref
import axios, {AxiosResponse} from 'axios'
import {ID, Response} from '../../../../../_metronic/helpers'
import {[[[zg-entity...zg-name]]], zg-pluralize(((zg-entity...zg-name)))QueryResponse} from './_models'
const API_URL = process.env.REACT_APP_API_URL
const GET_zg-upper(((zg-entity...zg-name)))_URL = `${API_URL}/zg-lower(((zg-entity...zg-name)))/getzg-lower(((zg-entity...zg-name)))`
const CREATE_zg-upper(((zg-entity...zg-name)))_URL = `${API_URL}/zg-lower(((zg-entity...zg-name)))/addzg-lower(((zg-entity...zg-name)))`
const UPDATE_zg-upper(((zg-entity...zg-name)))_URL = `${API_URL}/zg-lower(((zg-entity...zg-name)))/updatezg-lower(((zg-entity...zg-name)))`
const DELETE_zg-upper(((zg-entity...zg-name)))_URL = `${API_URL}/zg-lower(((zg-entity...zg-name)))/deletezg-lower(((zg-entity...zg-name)))`
const GET_zg-upper(((zg-pluralize(((zg-entity...zg-name))))))_URL = `${API_URL}/zg-lower(((zg-entity...zg-name)))/getzg-lower(((zg-pluralize(((zg-entity...zg-name))))))`
const getzg-pluralize(((zg-entity...zg-name))) = (query: string): Promise<zg-pluralize(((zg-entity...zg-name)))QueryResponse> => {
return axios
.get(`${GET_zg-upper(((zg-pluralize(((zg-entity...zg-name))))))_URL}?${query}`)
.then((d: AxiosResponse<zg-pluralize(((zg-entity...zg-name)))QueryResponse>) => d.data)
}
const get[[[zg-entity...zg-name]]]ById = (id: ID): Promise<[[[zg-entity...zg-name]]] | undefined> => {
return axios
.get(`${GET_zg-upper(((zg-entity...zg-name)))_URL}/${id}`)
.then((response: AxiosResponse<Response<[[[zg-entity...zg-name]]]>>) => response.data)
.then((response: Response<[[[zg-entity...zg-name]]]>) => response.data)
}
const create[[[zg-entity...zg-name]]] = (zg-lower(((zg-entity...zg-name))): [[[zg-entity...zg-name]]]): Promise<[[[zg-entity...zg-name]]] | undefined> => {
return axios
.post(CREATE_zg-upper(((zg-entity...zg-name)))_URL, zg-lower(((zg-entity...zg-name))))
.then((response: AxiosResponse<Response<[[[zg-entity...zg-name]]]>>) => response.data)
.then((response: Response<[[[zg-entity...zg-name]]]>) => response.data)
}
const update[[[zg-entity...zg-name]]] = (zg-lower(((zg-entity...zg-name))): [[[zg-entity...zg-name]]]): Promise<[[[zg-entity...zg-name]]] | undefined> => {
return axios
.put(`${UPDATE_zg-upper(((zg-entity...zg-name)))_URL}/${zg-lower(((zg-entity...zg-name))).id}`, zg-lower(((zg-entity...zg-name))))
.then((response: AxiosResponse<Response<[[[zg-entity...zg-name]]]>>) => response.data)
.then((response: Response<[[[zg-entity...zg-name]]]>) => response.data)
}
const delete[[[zg-entity...zg-name]]] = (zg-lower(((zg-entity...zg-name)))Id: ID): Promise<void> => {
return axios.delete(`${DELETE_zg-upper(((zg-entity...zg-name)))_URL}/${zg-lower(((zg-entity...zg-name)))Id}`).then(() => {})
}
const deleteSelectedzg-pluralize(((zg-entity...zg-name))) = (zg-lower(((zg-entity...zg-name)))Ids: Array<ID>): Promise<void> => {
const requests = zg-lower(((zg-entity...zg-name)))Ids.map((id) => axios.delete(`${DELETE_zg-upper(((zg-entity...zg-name)))_URL}/${id}`))
return axios.all(requests).then(() => {})
}
export {getzg-pluralize(((zg-entity...zg-name))), delete[[[zg-entity...zg-name]]], deleteSelectedzg-pluralize(((zg-entity...zg-name))), get[[[zg-entity...zg-name]]]ById, create[[[zg-entity...zg-name]]], update[[[zg-entity...zg-name]]]}
// folder
--> expenses-list
// file
// _requests.ts
import axios, {AxiosResponse} from 'axios'
import {ID, Response} from '../../../../../_metronic/helpers'
import {Expense, ExpensesQueryResponse} from './_models'
const API_URL = process.env.REACT_APP_API_URL
const GET_EXPENSE_URL = `${API_URL}/expense/getexpense`
const CREATE_EXPENSE_URL = `${API_URL}/expense/addexpense`
const UPDATE_EXPENSE_URL = `${API_URL}/expense/updateexpense`
const DELETE_EXPENSE_URL = `${API_URL}/expense/deleteexpense`
const GET_EXPENSES_URL = `${API_URL}/expense/getexpenses`
const getExpenses = (query: string): Promise<ExpensesQueryResponse> => {
return axios
.get(`${GET_EXPENSES_URL}?${query}`)
.then((d: AxiosResponse<ExpensesQueryResponse>) => d.data)
}
const getExpenseById = (id: ID): Promise<Expense | undefined> => {
return axios
.get(`${GET_EXPENSE_URL}/${id}`)
.then((response: AxiosResponse<Response<Expense>>) => response.data)
.then((response: Response<Expense>) => response.data)
}
const createExpense = (expense: Expense): Promise<Expense | undefined> => {
return axios
.post(CREATE_EXPENSE_URL, expense)
.then((response: AxiosResponse<Response<Expense>>) => response.data)
.then((response: Response<Expense>) => response.data)
}
const updateExpense = (expense: Expense): Promise<Expense | undefined> => {
return axios
.put(`${UPDATE_EXPENSE_URL}/${expense.id}`, expense)
.then((response: AxiosResponse<Response<Expense>>) => response.data)
.then((response: Response<Expense>) => response.data)
}
const deleteExpense = (expenseId: ID): Promise<void> => {
return axios.delete(`${DELETE_EXPENSE_URL}/${expenseId}`).then(() => {})
}
const deleteSelectedExpenses = (expenseIds: Array<ID>): Promise<void> => {
const requests = expenseIds.map((id) => axios.delete(`${DELETE_EXPENSE_URL}/${id}`))
return axios.all(requests).then(() => {})
}
export {getExpenses, deleteExpense, deleteSelectedExpenses, getExpenseById, createExpense, updateExpense}
// folder
--> expensetypes-list
// file
// _requests.ts
import axios, {AxiosResponse} from 'axios'
import {ID, Response} from '../../../../../_metronic/helpers'
import {ExpenseType, ExpenseTypesQueryResponse} from './_models'
const API_URL = process.env.REACT_APP_API_URL
const GET_EXPENSETYPE_URL = `${API_URL}/expensetype/getexpensetype`
const CREATE_EXPENSETYPE_URL = `${API_URL}/expensetype/addexpensetype`
const UPDATE_EXPENSETYPE_URL = `${API_URL}/expensetype/updateexpensetype`
const DELETE_EXPENSETYPE_URL = `${API_URL}/expensetype/deleteexpensetype`
const GET_EXPENSETYPES_URL = `${API_URL}/expensetype/getexpensetypes`
const getExpenseTypes = (query: string): Promise<ExpenseTypesQueryResponse> => {
return axios
.get(`${GET_EXPENSETYPES_URL}?${query}`)
.then((d: AxiosResponse<ExpenseTypesQueryResponse>) => d.data)
}
const getExpenseTypeById = (id: ID): Promise<ExpenseType | undefined> => {
return axios
.get(`${GET_EXPENSETYPE_URL}/${id}`)
.then((response: AxiosResponse<Response<ExpenseType>>) => response.data)
.then((response: Response<ExpenseType>) => response.data)
}
const createExpenseType = (expensetype: ExpenseType): Promise<ExpenseType | undefined> => {
return axios
.post(CREATE_EXPENSETYPE_URL, expensetype)
.then((response: AxiosResponse<Response<ExpenseType>>) => response.data)
.then((response: Response<ExpenseType>) => response.data)
}
const updateExpenseType = (expensetype: ExpenseType): Promise<ExpenseType | undefined> => {
return axios
.put(`${UPDATE_EXPENSETYPE_URL}/${expensetype.id}`, expensetype)
.then((response: AxiosResponse<Response<ExpenseType>>) => response.data)
.then((response: Response<ExpenseType>) => response.data)
}
const deleteExpenseType = (expensetypeId: ID): Promise<void> => {
return axios.delete(`${DELETE_EXPENSETYPE_URL}/${expensetypeId}`).then(() => {})
}
const deleteSelectedExpenseTypes = (expensetypeIds: Array<ID>): Promise<void> => {
const requests = expensetypeIds.map((id) => axios.delete(`${DELETE_EXPENSETYPE_URL}/${id}`))
return axios.all(requests).then(() => {})
}
export {getExpenseTypes, deleteExpenseType, deleteSelectedExpenseTypes, getExpenseTypeById, createExpenseType, updateExpenseType}
Good to know: ziref is used for code files hold in a folder for each entity.