add all search queries to result set
This commit is contained in:
parent
4b03b787c3
commit
2c29d8ae3c
@ -11,6 +11,7 @@ interface Option<T> {
|
||||
interface Question<T> {
|
||||
for: string,
|
||||
header: string,
|
||||
question: string,
|
||||
options: Option<T>[]
|
||||
}
|
||||
|
||||
@ -18,17 +19,18 @@ const questions: Question<QuestionTypes>[] = [
|
||||
{
|
||||
for: "ages",
|
||||
header: "Age of Patient",
|
||||
question: "How old is the patient?",
|
||||
options: [
|
||||
{
|
||||
label: "Child",
|
||||
label: "Child (0-10)",
|
||||
value: "0-9",
|
||||
},
|
||||
{
|
||||
label: "Teen",
|
||||
label: "Teen (10-20)",
|
||||
value: "10-20",
|
||||
},
|
||||
{
|
||||
label: "Adult",
|
||||
label: "Adult (21+)",
|
||||
value: "21-100",
|
||||
},
|
||||
],
|
||||
@ -36,6 +38,7 @@ const questions: Question<QuestionTypes>[] = [
|
||||
{
|
||||
for: "platforms",
|
||||
header: "Desired Platforms",
|
||||
question: "What platform(s) does the resource need to be on?",
|
||||
options: [
|
||||
{
|
||||
label: "Apple (iOS)",
|
||||
@ -58,6 +61,7 @@ const questions: Question<QuestionTypes>[] = [
|
||||
{
|
||||
for: "skill_levels",
|
||||
header: "Skill Level",
|
||||
question: "What skill level(s) should the resource have?",
|
||||
options: [
|
||||
{
|
||||
label: "Beginner",
|
||||
@ -76,6 +80,7 @@ const questions: Question<QuestionTypes>[] = [
|
||||
{
|
||||
for: "skills",
|
||||
header: "Skills Practiced",
|
||||
question: "What skill(s) would you like the resource to cover?",
|
||||
options: [
|
||||
{
|
||||
label: "Phonemes",
|
||||
@ -128,7 +133,7 @@ const ChoiceQuestion = ({question, formData, updateFormData}: {question: Questio
|
||||
}
|
||||
|
||||
return (
|
||||
<button type="button" onClick={handleToggle} className={"w-64 shadow rounded-lg border border-neutral-400 " + (selected ? "bg-amber-200" : "bg-white")}>
|
||||
<button type="button" onClick={handleToggle} className={"mx-auto w-64 py-2 shadow rounded-lg border border-neutral-400 " + (selected ? "bg-amber-200" : "bg-white")}>
|
||||
{option.label}
|
||||
</button>
|
||||
)
|
||||
@ -153,11 +158,12 @@ const ChoiceQuestion = ({question, formData, updateFormData}: {question: Questio
|
||||
|
||||
return (
|
||||
<div className="text-center border-b border-neutral-400 py-4 mx-auto">
|
||||
<label htmlFor={question.for} className="font-bold text-xl mb-2">{question.header}</label>
|
||||
<label htmlFor={question.for} className="font-bold border-b border-neutral-800 text-xl mb-2">{question.header}</label>
|
||||
<p className="text-md mb-2">{question.question}</p>
|
||||
<select className="hidden" name={question.for} multiple>
|
||||
{htmlOptions}
|
||||
</select>
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-col space-y-1 justify-center">
|
||||
{optionButtons}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -36,12 +36,28 @@ export const auditoryResourceRouter = createTRPCRouter({
|
||||
|
||||
return ctx.prisma.auditoryResource.findMany({
|
||||
where: {
|
||||
// ages: input.ages ? {min: 0, max: 100}, TODO: Make this so ranges work.
|
||||
ages: {
|
||||
is: {
|
||||
min: {
|
||||
lte: input.ages?.min,
|
||||
},
|
||||
max: {
|
||||
gte: input.ages?.max,
|
||||
}
|
||||
}
|
||||
},
|
||||
skill_levels: {
|
||||
hasEvery: input.skill_levels ?? [],
|
||||
},
|
||||
skills: {
|
||||
hasEvery: input.skills ?? [],
|
||||
},
|
||||
platform_links: {
|
||||
some: {
|
||||
platform: {
|
||||
in: input.platforms,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user