/** * Mongo Database Helper Methods */ import labReportModel from '../models/lab-report'; /** * Function to add a new a new record * @param reportID the unique report identifier * @param ipfsHash ipfs hash for the lab report * @param helixTxHash helix transaction hash for lab report */ export async function addNewRecord(reportID:string, ipfsHash:string, helixTxHash:string) { await labReportModel.create({ reportID, ipfsHash, helixTxHash }); } /** * Function which returns teh total reports saved till now */ export async function recordCount() { const count = await labReportModel.countDocuments(); return count; } /** * Get records by the reportID * @param reportID */ export async function getRecord(reportID:string) { const record = await labReportModel.findOne({ reportID }).exec(); return record; }