-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from aelporg/AA-78-assessment-screen
Add assessment creation
- Loading branch information
Showing
49 changed files
with
1,474 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { ModelsModule } from '@aelp-app/models' | ||
import { Module } from '@nestjs/common' | ||
import QuestionsModule from '../question/question.module' | ||
import AssessmentResolver from './assessment.resolver' | ||
import AssessmentService from './assessment.service' | ||
|
||
@Module({ | ||
imports: [ModelsModule], | ||
imports: [ModelsModule, QuestionsModule], | ||
providers: [AssessmentService, AssessmentResolver], | ||
}) | ||
export default class AssessmentModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/api/src/modules/evaluation-criteria/types/evaluation-criteria-create-input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Field, InputType, Int } from '@nestjs/graphql' | ||
import { EvaluationCriteriaType } from '../../../global-types' | ||
import { InputOutputEvaluationCriteriaCreateInput } from './input-output-evaluation-criteria-create-input' | ||
|
||
@InputType() | ||
export class EvaluationCriteriaCreateInput { | ||
@Field(() => String, { nullable: false }) | ||
name!: string | ||
|
||
@Field(() => EvaluationCriteriaType, { nullable: false }) | ||
type!: EvaluationCriteriaType | ||
|
||
@Field(() => Int, { nullable: false }) | ||
totalPoints!: number | ||
|
||
@Field(() => InputOutputEvaluationCriteriaCreateInput, { nullable: true }) | ||
inputOutputEvaluationCriteria?: InputOutputEvaluationCriteriaCreateInput | ||
} |
10 changes: 10 additions & 0 deletions
10
...pi/src/modules/evaluation-criteria/types/input-output-evaluation-criteria-count.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Field } from '@nestjs/graphql'; | ||
import { ObjectType } from '@nestjs/graphql'; | ||
import { Int } from '@nestjs/graphql'; | ||
|
||
@ObjectType() | ||
export class InputOutputEvaluationCriteriaCount { | ||
|
||
@Field(() => Int, {nullable:false}) | ||
baseCriteria!: number; | ||
} |
14 changes: 14 additions & 0 deletions
14
...pi/src/modules/evaluation-criteria/types/input-output-evaluation-criteria-create-input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Field } from '@nestjs/graphql' | ||
import { InputType } from '@nestjs/graphql' | ||
@InputType() | ||
export class InputOutputEvaluationCriteriaCreateInput { | ||
@Field(() => [String], { | ||
nullable: true, | ||
}) | ||
inputs?: string[] | ||
|
||
@Field(() => [String], { | ||
nullable: true, | ||
}) | ||
outputs?: string[] | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/api/src/modules/evaluation-criteria/types/input-output-evaluation-criteria.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Field } from '@nestjs/graphql'; | ||
import { ObjectType } from '@nestjs/graphql'; | ||
import { ID } from '@nestjs/graphql'; | ||
import { EvaluationCriteria } from './evaluation-criteria.model'; | ||
import { InputOutputEvaluationCriteriaCount } from './input-output-evaluation-criteria-count.output'; | ||
|
||
@ObjectType() | ||
export class InputOutputEvaluationCriteria { | ||
|
||
@Field(() => ID, {nullable:false}) | ||
id!: string; | ||
|
||
@Field(() => [String], {nullable:true}) | ||
inputs!: Array<string>; | ||
|
||
@Field(() => [String], {nullable:true}) | ||
outputs!: Array<string>; | ||
|
||
@Field(() => [EvaluationCriteria], {nullable:true}) | ||
baseCriteria?: Array<EvaluationCriteria>; | ||
|
||
@Field(() => Date, {nullable:false}) | ||
updatedAt!: Date; | ||
|
||
@Field(() => Date, {nullable:false}) | ||
createdAt!: Date; | ||
|
||
@Field(() => InputOutputEvaluationCriteriaCount, {nullable:false}) | ||
_count?: InputOutputEvaluationCriteriaCount; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ModelsModule } from '@aelp-app/models' | ||
import { Module } from '@nestjs/common' | ||
import LanguageResolver from './language.resolver' | ||
|
||
@Module({ imports: [ModelsModule], providers: [LanguageResolver] }) | ||
export default class LanguageModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { PrismaService } from '@aelp-app/models' | ||
import { Query } from '@nestjs/graphql' | ||
import { Resolver } from '@nestjs/graphql' | ||
import { Language } from './types/language.model' | ||
|
||
@Resolver(() => Language) | ||
export default class LanguageResolver { | ||
constructor(private prismaService: PrismaService) {} | ||
|
||
@Query(() => [Language]) | ||
async languages() { | ||
return this.prismaService.language.findMany() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
import { Args, Mutation, ResolveField, Resolver, Root } from '@nestjs/graphql' | ||
import { LoggedInUser } from '../../utils/decorators/LoggedInUser' | ||
import { User } from '../user/types/user.model' | ||
import { ResolveField, Resolver, Root } from '@nestjs/graphql' | ||
import QuestionService from './question.service' | ||
import { MultipleChoiceQuestion } from './types/multiple-choice-question.model' | ||
import { ProgrammingQuestion } from './types/programming-question.model' | ||
import { QuestionCreateInput } from './types/question-create-input' | ||
import { Question } from './types/question.model' | ||
|
||
@Resolver(() => Question) | ||
export default class QuestionResolver { | ||
constructor(private questionService: QuestionService) {} | ||
|
||
@Mutation(() => Question) | ||
async createQuestion(@Args('data') data: QuestionCreateInput, @LoggedInUser() user: User) { | ||
return this.questionService.createQuestion(data, user) | ||
} | ||
|
||
@ResolveField(() => ProgrammingQuestion) | ||
async programmingQuestion(@Root() question: Question) { | ||
return this.questionService.getById(question.id).programmingQuestion() | ||
} | ||
|
||
@ResolveField(() => MultipleChoiceQuestion) | ||
async multipleChoiceQuestion(@Root() question: Question) { | ||
return this.questionService.getById(question.id).multipleChoiceQuestion() | ||
} | ||
} |
Oops, something went wrong.