Models
This package contains all the models used in Brad Technology apps.
Getting started
yarn add @bradtech/models
OR
npm i @bradtech/models
Instantiating a model
import { BaseObject } from '@bradtech/models'
const myObject = BaseObject.create({
name: 'myObject',
status: 'active',
})
Using the Backend Adapter
import { ApplicationReference, FirestoreAdapter, Plot } from '@bradtech/models'
// Instantiate a Backend Adapter
const backendAdapter = new FirestoreAdapter()
backendAdapter.setUser(
ApplicationReference.factory({
ref: 'applications/app',
label: 'My App',
}),
)
// Saving myObject in our database
backendAdapter.create(myObject)