Skip to content

Instantly share code, notes, and snippets.

@wilcorrea
Created June 27, 2019 22:54
Show Gist options
  • Save wilcorrea/a628e281d916106c6e42b1c5ca81c5e3 to your computer and use it in GitHub Desktop.
Save wilcorrea/a628e281d916106c6e42b1c5ca81c5e3 to your computer and use it in GitHub Desktop.
import Schema from 'src/app/Agnostic/Schema'
import MovieService from 'src/domains/Example/Movie/MovieService'
import { moviePath } from 'src/domains/Example/Movie/routeFile'
/**
*/
export default class MovieSchema extends Schema {
/**
* @type {string}
*/
static path = moviePath
/**
* @type {string}
*/
static domain = 'example.movie'
/**
* @type {Http}
*/
service = MovieService
/**
*/
construct () {
this.fieldAsPrimaryKey()
this.addField('name')
.fieldTableShow()
.fieldFormWidth(100)
.fieldFormAutofocus()
.fieldOn('input', function () {
// console.log('~> arguments', arguments)
})
this.addField('description')
.fieldIsText(5)
.fieldTableShow()
.fieldFormWidth(100)
.fieldOn('input', function () {
// console.log('~> arguments', arguments)
})
}
}
import Rest from 'src/app/Services/Rest'
/**
*/
export default class MovieService extends Rest {
/**
* @type {String}
*/
resource = '/example/movie'
}
// import { primaryKey } from 'src/settings/schema'
/**
*/
export default {
form: {
title: ''
},
table: {
title: ''
},
sections: {
},
fields: {
// [primaryKey]: 'Id',
name: 'Nome',
description: 'Descrição'
}
}
import { RouteConfig, VueRouter } from 'vue-router/types/router'
import { crud, group } from 'src/app/Util/routing'
/** @type {string} */
export const moviePath = '/dashboard/example/movie'
/**
* @param {VueRouter} router
* @returns Array<RouteConfig>
*/
export default (router: VueRouter): Array<RouteConfig> => {
// index
const index = () => import('src/layouts/Group.vue')
// table
const table = () => import('src/pages/dashboard/example/movie/MovieTable.vue')
// form
const form = () => import('src/pages/dashboard/example/movie/MovieForm.vue')
return [
group(
moviePath,
index,
crud('example.movie', moviePath, table, form)
)
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment