Database
Use the DB()
helper to define your application’s models. Models are typed and automatically persisted.
import { DB } from 'workflows.do'
const db = DB({
loans: {
applicantId: String,
amount: Number,
term: Number,
riskScore: Number,
offerTerms: String,
status: String,
},
docs: {
applicantId: String,
verified: Boolean,
missing: [String],
},
})
After defining the models you can persist and update records just like in the Business‑as‑Code example.
await db.loans.create({ applicantId: 'turbo123', amount: 25000, term: 60, status: 'submitted' })
await db.docs.update('turbo123', { verified: false, missing: ['paystubs'] })
Last updated on