materia-server
materia-server copied to clipboard
Merge queries files and entity model files
It would be easier to write models and custom queries if they were in the same file (hopefully Typescript).
This is an example of what I mean by merging queries and models in a single file:
@Entity('user')
class UserModel {
@Field({type: DataType.NUMBER, primary: true, autoIncrement: true}) id;
@Field({type: DataType.TEXT, required: true}) email;
@Field({type: DataType.TEXT, required: true}) password;
@Field({type: DataType.BOOLEAN}) public_email = false
constructor(private app: App) {}
@CustomQuery({
params: [{
name: 'email',
type: DataType.TEXT
required: true
},{
name: 'password',
type: DataType.TEXT
required: true
}]
})
signin(params) {
// todo
}
}
Many requirements are needed to implement this new syntax:
- Handle Typescript files in server/ folder (compilation in watch mode in Materia Designer)
- Need to be able to edit the class programmatically without breaking existing code
- Need to be able to read the class as we were reading the json file (reflexion / introspection of the class).
- Materia Version: v1.0.0-beta.1