diff --git a/lesson_03/quiz/package-lock.json b/lesson_03/quiz/package-lock.json index 97662c0f5..e19dfa802 100644 --- a/lesson_03/quiz/package-lock.json +++ b/lesson_03/quiz/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@nestjs/common": "^10.4.15", "@nestjs/core": "^10.4.15", + "bcrypt": "^6.0.0", "codedifferently-instructional": "file:../../lib/javascript/codedifferently-instructional", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.1" @@ -2267,6 +2268,20 @@ "dev": true, "license": "MIT" }, + "node_modules/bcrypt": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-6.0.0.tgz", + "integrity": "sha512-cU8v/EGSrnH+HnxV2z0J7/blxH8gq7Xh2JFT6Aroax7UohdmiJJlxApMxtKfuI7z68NvvVcmR78k2LbT6efhRg==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^8.3.0", + "node-gyp-build": "^4.8.4" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4544,6 +4559,15 @@ "dev": true, "license": "MIT" }, + "node_modules/node-addon-api": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", + "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, "node_modules/node-cleanup": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz", @@ -4571,6 +4595,17 @@ } } }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5996,4 +6031,4 @@ } } } -} +} \ No newline at end of file diff --git a/lesson_03/quiz/package.json b/lesson_03/quiz/package.json index a03128951..caeefaaaa 100644 --- a/lesson_03/quiz/package.json +++ b/lesson_03/quiz/package.json @@ -39,6 +39,7 @@ "dependencies": { "@nestjs/common": "^10.4.15", "@nestjs/core": "^10.4.15", + "bcrypt": "^6.0.0", "codedifferently-instructional": "file:../../lib/javascript/codedifferently-instructional", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.1" diff --git a/lesson_03/quiz/quiz.yaml b/lesson_03/quiz/quiz.yaml index a711de6b6..f6f96cb6c 100644 --- a/lesson_03/quiz/quiz.yaml +++ b/lesson_03/quiz/quiz.yaml @@ -6,4 +6,7 @@ quiz: anotherone: - $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK - $2y$10$dGB0CGv7.XQC5OqfyY6iXOiJsdVyxU3ve5YE0gt4m2I8P8H13lNXa - + jaizel_quiz: + - $2y$10$l0gz8cPuUAV/fPCz1eZPLuceO/ea4VzwVY2e4VkjWjkjMh785XOaa + - $2y$10$ESuiNYZk3LoPpwXWWI9HuOAW1UkMXvihaXb1FbOgMyUzmxD1EmcUe + - $2y$10$pwNF2IjXoEXS7VnuiQI23O3/i4AmT7e5KUYTrtm3ewJdb.vFpNxTy diff --git a/lesson_03/quiz/src/quizzes/jaizel_quiz.ts b/lesson_03/quiz/src/quizzes/jaizel_quiz.ts new file mode 100644 index 000000000..016d3d0b3 --- /dev/null +++ b/lesson_03/quiz/src/quizzes/jaizel_quiz.ts @@ -0,0 +1,62 @@ +import { + AnswerChoice, + MultipleChoiceQuizQuestion, + QuizQuestion, + QuizQuestionProvider, +} from 'codedifferently-instructional'; + +export class JaizelQuiz implements QuizQuestionProvider { + getProviderName(): string { + return 'jaizel_quiz'; + } + + makeQuizQuestions(): QuizQuestion[] { + return [ + JaizelQuiz.makeQuestion0(), + JaizelQuiz.makeQuestion1(), + JaizelQuiz.makeQuestion2(), + ]; + } + + private static makeQuestion0(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 0, + 'What is TypeScript?', + new Map([ + [AnswerChoice.A, 'A superset of JavaScript that adds static typing'], + [AnswerChoice.B, 'A completely different language from JavaScript'], + [AnswerChoice.C, 'A JavaScript runtime environment'], + [AnswerChoice.D, 'A JavaScript framework like React or Angular'], + ]), + AnswerChoice.UNANSWERED, + ); + } + + private static makeQuestion1(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 1, + 'Which of the following is NOT a valid way to declare a variable in JavaScript?', + new Map([ + [AnswerChoice.A, 'var x = 10;'], + [AnswerChoice.B, 'let x = 10;'], + [AnswerChoice.C, 'const x = 10;'], + [AnswerChoice.D, 'static x = 10;'], + ]), + AnswerChoice.UNANSWERED, + ); + } + + private static makeQuestion2(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 2, + 'What is an Interface in TypeScript?', + new Map([ + [AnswerChoice.A, 'A way to define a contract for object structure'], + [AnswerChoice.B, 'A tool for bundling TypeScript code'], + [AnswerChoice.C, 'A special type of JavaScript class'], + [AnswerChoice.D, 'A method for importing external modules'], + ]), + AnswerChoice.UNANSWERED, + ); + } +} diff --git a/lesson_03/quiz/src/quizzes/quizzes.module.ts b/lesson_03/quiz/src/quizzes/quizzes.module.ts index f35cd5b43..83db99f38 100644 --- a/lesson_03/quiz/src/quizzes/quizzes.module.ts +++ b/lesson_03/quiz/src/quizzes/quizzes.module.ts @@ -1,15 +1,12 @@ import { Module } from '@nestjs/common'; import { AnotherQuiz } from './another_quiz.js'; import { AnthonyMaysQuiz } from './anthony_mays_quiz.js'; +import { JaizelQuiz } from './jaizel_quiz.js'; export const Quizzes = Symbol.for('Quizzes'); // Add your quiz provider here. -const QUIZ_PROVIDERS = [ - AnthonyMaysQuiz, - AnotherQuiz, - -]; +const QUIZ_PROVIDERS = [AnthonyMaysQuiz, AnotherQuiz, JaizelQuiz]; @Module({ providers: [ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..600e2a1ef --- /dev/null +++ b/package-lock.json @@ -0,0 +1,46 @@ +{ + "name": "code-society-25-2-6", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "bcrypt": "^6.0.0" + } + }, + "node_modules/bcrypt": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-6.0.0.tgz", + "integrity": "sha512-cU8v/EGSrnH+HnxV2z0J7/blxH8gq7Xh2JFT6Aroax7UohdmiJJlxApMxtKfuI7z68NvvVcmR78k2LbT6efhRg==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^8.3.0", + "node-gyp-build": "^4.8.4" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/node-addon-api": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", + "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..8da26fb6d --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "bcrypt": "^6.0.0" + } +}