Skip to content

v0.5.0 - November release 2016

Compare
Choose a tag to compare
@thyb thyb released this 09 Dec 02:30
· 11 commits to master since this release

We're excited to announce Materia November Release which brings a new architecture for your application. It also adds nice features like the Field Components and Query Parameters Deduction.

New application architecture

This new architecture for Materia applications is more standard to what you usually see to develop a web application. All files & folders related to the database or to the server has been moved in the server/ folder.

materia.json has been moved in the package.json in the materia key.

The structure now looks like the following:

node_modules/
     ...
server/
    controllers/
        default.ctrl.js
        users.ctrl.js
        ...
    models/
        queries/
             entity1.js
        entity1.json
        entity2.json
        ...
    api.json
    server.json
web/
    index.html
package.json

Now It seems clear what is used by the server and what is used by the client to display the content.

If you want to expand your API or your entity's queries with code, it's now easier with controllers and models.

A controller regroup multiple endpoints in the same file (using ES6 classes):

// server/controllers/default.ctrl.js

module.exports = class DefaultController {
    constructor(app) {
        this.app = app;        // Materia Application Object (defined in Materia Server) => https://getmateria.com/docs/api-reference/app
    }

    // It uses the parameters of Express
    getUsers(req, res, next) {
         // endpoint logic here
    }
    someOtherMethod(req, res, next) {
         // endpoint logic here
    }
}

The same has been applied to the Javascript queries:

// server/models/queries/speaker.js

module.exports = class UserModel {
    constructor(app, entity) {
        this.app = app;        //Materia Application Object (defined in Materia Server => https://getmateria.com/docs/api-reference/app)
        this.entity = entity;  //Materia Entity Object (defined in Materia Server => https://getmateria.com/docs/api-reference/entity)
    }

    updateOrder(params) {
         // Define your query logic to reorder a speaker in an event
    }
}

Instead of writing one function per file, your can combine them logically per controller or per model. Then Materia Designer,

This release fixes #57 where there was an inconsistency in Query params where the params were not the same if the query was executed from an Endpoint or from the Javascript API (e.g. when Materia Designer execute an individual query in the UI).

Field Components

Blog's article

This release includes new components for your fields ! Components are useful to write data in the appropriate format in your database.

e.g. If you have a field type TEXT which should only contain emails, you can now use the component email to restrict the value in Materia Designer with a <input type="email"> instead of the traditional <input type="text">

this is not an email

This is the list of component available in this version:

Field type TEXT

  • Input (default)

input

- Password

password

- Email

screen shot 2016-12-08 at 1 07 55 am

- Color

color

color picker

- URL

url

- Textarea

textarea

- Markdown

markdown

Field type NUMBER

  • Input (default)

screen shot 2016-12-08 at 1 25 51 am

Field type DATE

  • Date Picker (default)

date

- Date Time Picker

date_time

- Time Picker

time

Field type BOOLEAN

  • Switch (default)

switch

Field type FLOAT

  • Input (default)

input

Some other components may be added on demand, just post a Github issue.

Parameters deduction

In the Query Builder (except on Javascript & SQL queries), you don't need anymore to enter your own parameters. They are deduced from how you use the params in the query builder.

e.g. if you set a condition title = with the parameter title, Materia will automatically add title in the list of parameters with the type and component of the field title. As it is used in a condition, the parameter is required.

Bug fixes and enhancements

  • Fix Update/Delete cascade - Better consistency between Cascade. SQLite now support cascade too. #47
  • Enhance conditions management in queries to not break when used on associated tables
  • Addons use npm. Our official addons can be installed using npm install @materia/{addon-name} directly / Use npm link for addons development
  • Fix conditions with no explicit entity (defaults to query's entity)
  • Finished the migration to Typescript in Materia Server (100% typescript !)
  • Set default configuration when server.json is missing.