LearnersGuild/echo

View on GitHub
src/server/services/dataService/queries/getSurveyBlueprintByDescriptor.js

Summary

Maintainability
A
0 mins
Test Coverage
import r from '../r'
import {customQueryError} from '../util'
 
const surveysBlueprintsTable = r.table('surveyBlueprints')
 
export default function getSurveyBlueprintByDescriptor(descriptor) {
FIXME found
// FIXME: should be instead rejected with an easily identifiable DocumentNotFound error
return surveysBlueprintsTable.getAll(descriptor, {index: 'descriptor'})
.nth(0)
.default(customQueryError(`No Survey Blueprint found with descriptor ${descriptor}`))
}