import type { UnitTestResult } from 'insomnia-data'; import { database as db, models } from 'insomnia-data'; const { type } = models.unitTestResult; export function create(patch: Partial = {}) { if (!patch.parentId) { throw new Error('New UnitTestResult missing `parentId` ' + JSON.stringify(patch)); } return db.docCreate(type, patch); } export function update(unitTest: UnitTestResult, patch: Partial) { return db.docUpdate(unitTest, patch); } export function getByParentId(parentId: string) { return db.findOne(type, { parentId }); } export function getById(_id: string) { return db.findOne(type, { _id, }); } export function all() { return db.find(type); }