From 8c3b8a30aaca128964760efb103297766430d864 Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Sat, 23 Jul 2022 06:51:00 -0400 Subject: [PATCH 01/37] Fetching and using the bearer token Every time I want to start up this project, I spend 30 or so minutes figuring out authorization. Instead, I figured it would be easier to put an example in the documentation to cut setup time and enable more commits in the future! --- docs/localAuth.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/localAuth.md b/docs/localAuth.md index 016624e7..4bdd1a5a 100644 --- a/docs/localAuth.md +++ b/docs/localAuth.md @@ -14,8 +14,50 @@ If you wish to better understand how this works, here's a bit more information. When developer auth is enabled, users can provide the email & externalId of the user they wish to login as (or create) and recieve a valid refresh/ access token. + +### Fetching the bearer token + +Request: `POST /login/developer` + +Sample Request body: +``` +{ + "email": "name@buffalo.edu", + "externalId": "101" +} +``` + +Sample Response: + +``` +{ + "message": "Login successful" +} +``` + +Sample Response Headers: +``` +{ + "Set-Cookie": "refreshToken=;" +} +``` + +### Using the Bearer token + +Request: `GET /users` + +Request headers (notice the space between `Bearer` and ``!): + +``` +{ + "Authorization": "Bearer " +} +``` + With this flag on, it enabled the `/login/developer` route (see `./router/login.router.ts` for more details). + + ## Testing SAML Authentication Locally To test SAML authentication, you will need to configure an Identity Provider (IDP) for the API to authenticate against. As we don't expect anyone to just have a configured IDP laying around ready to go, this will walk through using [SamlTest.id](https://samltest.id/). From 4891453e2d2922623745faf41efb9e39d32f6cad Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Sat, 23 Jul 2022 07:16:28 -0400 Subject: [PATCH 02/37] Create postman-setup.md Postman is an invaluable resource for new developers on this api. Having a pre-configured json file for postman will allow developers to understand exactly what a request looks like, and how they can make that request. Another option would be to host that json config file somewhere in this repo, so that we can make updates as we develop new endpoints. --- docs/postman-setup.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/postman-setup.md diff --git a/docs/postman-setup.md b/docs/postman-setup.md new file mode 100644 index 00000000..8e73ef79 --- /dev/null +++ b/docs/postman-setup.md @@ -0,0 +1,12 @@ +# Postman Setup + +[JSON configuration file for Postman](https://www.getpostman.com/collections/b817928ddd3489a9f8a4) + +Postman is a great tool for testing API endpoints. The link above is a configuration file that +will help setup the basic configuration for working with most of the basic endpoints. + +To get started: +1. Install/Open Postman +2. Copy JSON configuration file link +3. Select `Import > Link` +4. Paste the link, click continue, and then click `Import` From 76ba7bd45ab6b24f2a2cc61365e1034d694f48e2 Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Sat, 23 Jul 2022 07:32:44 -0400 Subject: [PATCH 03/37] Additional authentication setup steps --- docs/postman-setup.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/postman-setup.md b/docs/postman-setup.md index 8e73ef79..5d301ea3 100644 --- a/docs/postman-setup.md +++ b/docs/postman-setup.md @@ -5,8 +5,16 @@ Postman is a great tool for testing API endpoints. The link above is a configuration file that will help setup the basic configuration for working with most of the basic endpoints. -To get started: +### Get Started 1. Install/Open Postman 2. Copy JSON configuration file link 3. Select `Import > Link` 4. Paste the link, click continue, and then click `Import` + +### Setup Auth +See `docs/localAuth.md` for examples + +1. Using the auth folder, run `retrieve auth token` +2. Copy the **content** of the refresh token +3. Under the devU collection, set a variable called `authorization` to the content of the previous step +4. Run all the requests you want! From af15826c08174235658caa1a976db4ce8ba896c8 Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Wed, 21 Sep 2022 17:41:14 -0400 Subject: [PATCH 04/37] Delete .DS_Store Why is this file in the repo??? --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 09818d6af4863fbcc4043f5e2dcc50584ba3446b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}N6?5Ke5>v?BH()MGB*dgu=YJqSy!2XDfP9#q<0x7dZcDc!9_*UCPIzL9U> z>o}97#bOVhMC=SC-%MsE+4*4e!x-bOaZqEd#26FM5IHJK1c#Tp)@(2$$2t5-JoE?3 z2m9Un{yN~d=UKoMyJhj$@Arp;Fixt~55AVmuWxJ$Q541P;*Hx^6F2daaoqAoS7@Di zN#D2nxl)6f#!(RKd0gWVq96*LQaMfQ z)rzcFrxlsj8qG#UHV+S`(}F1P*N#rR_m5BM^YrD_5X^ypEjt!x@CM4fz6W;{4ODao zW3%{K93e443=jjv!0Iqy&j7KtIwe!3!~ikyLk4hvkkAkviabwG#LXY}V0Q9#GH z1fsO)Sj-H92ZWncK$FVt6N8&{7?(EAv6vY&>5S`@VII5k?D4|&>M$;KIOC2%>WKkj zV3C2GF-v&WG0~VBiy>&QN3k From 9a379cc626065e4fed9e85815e74dbaf290d9db9 Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Wed, 28 Sep 2022 02:03:00 -0400 Subject: [PATCH 05/37] Added non-implemented schema members * Added a menu for the schema members * Added comments for new members * I suggest we replace comments with types, since "foreign key" seems easier to follow --- Schema.md | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 Schema.md diff --git a/Schema.md b/Schema.md new file mode 100644 index 00000000..bb915293 --- /dev/null +++ b/Schema.md @@ -0,0 +1,118 @@ +# Entities + +- [x] [User](#user) +- [x] [Course](#course) +- [x] [UserCourse](#usercourse) +- [x] [Assignment](#assignment) +- [x] [Submission](#submission) +- [x] [AssignmentProblem](#assignmentproblem) +- [] [SubmissionProblemScore](#submissionproblemscore) +- [] [SubmissionScore](#submissionscore) +- [] [AssignmentScore](#assignmentscore) +- [] [CategoryScore](#categoryscore) +- [] [Category](#category) +- [] [CourseScore](#coursescore) + + + +# Entity Details + +### Generic Entity Attributes +* id (primary key) +* createdAt +* updatedAt +* deletedAt (If null, it's not deleted) + + +### User +*Student user for devu* +* email +* externalId (eg. School id number) +* preferredName + + +### Course +* name (eg. Computer Science 2) +* semester (eg. f2022) +* number (eg. CSE312) +* startDate +* endDate + + +### UserCourse +*Links a user to a course* +* userId (foreign key of the user) +* courseId (foreign key of the course) +* level (student, ta, or instructor) +* dropped (Boolean) + + +### Assignment +* courseId (foreign key of the course) +* name +* startDate (time when it should be available to students) +* dueDate (last time to submit without incurring late penalties) +* endDate (last time to submit even with a late penalty) +* gradingType +* categoryName (eg. HW, Quizzes) +* description +* maxFileSize (for submissions) +* maxSubmissions (if null, infinite submissions allowed) +* disableHandins (Boolean) + + +### Submission +* courseId (foreign key of the course) +* assignmentId (foreign key of the assignment) +* userId (foreign key of the user owning the submission) +* content (The actual submission) +* type (filepath, json, or text) +* submitterIp +* submittedBy (foreign key of the user making the submission. Will match the userId for normal submissions. Will be different if instructor/ta is creating the submission or if a regrade request was made. Regrades create a new submission) +* orignalSubmissionId (null for normal submissions. Matches the original submission id for regrades. Number of non-nulls for a user is the number of submissions) + + +### AssignmentProblem +* assignmentId (foreign key of the assignment) +* problemName +* maxScore + + +**------ Everything above this line exists in the code. Everything below needs to be built ------** + + +### SubmissionProblemScore +* submissionId (foreign key of the submission) +* assignmentProblemId (foreign key of the assignmentProblem) +* score +* feedback + + +### SubmissionScore +* submissionId (foreign key of the submission) +* score +* feedback +* released ? + + +### AssignmentScore +* assignmentId (foreign key of the assignment) +* userId (foreign key of the user) +* score + + +### CategoryScore +* categoryId (foreign key of the category) +* userId (foreign key of the user) +* *missing attributes* + + +### Category +* courseId + + +### CourseScore +* courseId +* userId + + From f94bfb57e2621ba5b22d6294350ae243d93ba53e Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Wed, 28 Sep 2022 02:11:13 -0400 Subject: [PATCH 06/37] added types to schema doc --- SCHEMA.md | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Schema.md | 118 ----------------------------------------------------- 2 files changed, 120 insertions(+), 118 deletions(-) create mode 100644 SCHEMA.md delete mode 100644 Schema.md diff --git a/SCHEMA.md b/SCHEMA.md new file mode 100644 index 00000000..462e6102 --- /dev/null +++ b/SCHEMA.md @@ -0,0 +1,120 @@ +# Entities + +- [x] [User](#user) +- [x] [Course](#course) +- [x] [UserCourse](#usercourse) +- [x] [Assignment](#assignment) +- [x] [Submission](#submission) +- [x] [AssignmentProblem](#assignmentproblem) +- [] [SubmissionProblemScore](#submissionproblemscore) +- [] [SubmissionScore](#submissionscore) +- [] [AssignmentScore](#assignmentscore) +- [] [CategoryScore](#categoryscore) +- [] [Category](#category) +- [] [CourseScore](#coursescore) + + + +# Entity Details + +### Generic Entity Attributes +* id +* createdAt +* updatedAt +* deletedAt + + +### User +*Student user for devu* +* email: string +* externalId: foreign_key +* preferredName: string + + +### Course +* name: string +* semester: string +* number: string *ex: cse220* +* startDate: ? +* endDate: ? + + +### UserCourse +*Links a user to a course* +* userId: foreign_key +* courseId: foreign_key +* level: ? +* dropped: boolean + + +### Assignment +* courseId: foreign_key +* name: string +* startDate: ? +* dueDate: ? +* endDate: ? +* gradingType: ? +* categoryName: ? +* description: string +* maxFileSize: ? +* maxSubmissions: ? +* disableHandins: boolean + + +### Submission +* courseId: foreign_key +* assignmentId: foreign_key +* userId: foreign_key +* content: ? +* type: ? +* submitterIp: ? +* submittedBy: ? +* orignalSubmissionId: ? + + +### AssignmentProblem +* assignmentId: foreign_key +* problemName: ? +* maxScore: ? + + +**------ Everything above this line exists in the code. Everything below needs to be built ------** + + +### SubmissionProblemScore +* submissionId: foreign_key +* assignmentProblemId: foreign_key +* score: ? +* feedback: ? + + +### SubmissionScore +* submissionId: foreign_key +* score: ? +* feedback: ? +* released: ? + + +### AssignmentScore +* assignmentId: foreign_key +* userId: foreign_key +* score: ? + + +### CategoryScore +* categoryId: foreign_key +* userId: foreign_key +* *missing attributes* + + +### Category +* courseId: foreign_key +* *missing attributes* + + +### CourseScore +* courseId: foreign_key +* userId: foreign_key +* *missing attributes* + + diff --git a/Schema.md b/Schema.md deleted file mode 100644 index bb915293..00000000 --- a/Schema.md +++ /dev/null @@ -1,118 +0,0 @@ -# Entities - -- [x] [User](#user) -- [x] [Course](#course) -- [x] [UserCourse](#usercourse) -- [x] [Assignment](#assignment) -- [x] [Submission](#submission) -- [x] [AssignmentProblem](#assignmentproblem) -- [] [SubmissionProblemScore](#submissionproblemscore) -- [] [SubmissionScore](#submissionscore) -- [] [AssignmentScore](#assignmentscore) -- [] [CategoryScore](#categoryscore) -- [] [Category](#category) -- [] [CourseScore](#coursescore) - - - -# Entity Details - -### Generic Entity Attributes -* id (primary key) -* createdAt -* updatedAt -* deletedAt (If null, it's not deleted) - - -### User -*Student user for devu* -* email -* externalId (eg. School id number) -* preferredName - - -### Course -* name (eg. Computer Science 2) -* semester (eg. f2022) -* number (eg. CSE312) -* startDate -* endDate - - -### UserCourse -*Links a user to a course* -* userId (foreign key of the user) -* courseId (foreign key of the course) -* level (student, ta, or instructor) -* dropped (Boolean) - - -### Assignment -* courseId (foreign key of the course) -* name -* startDate (time when it should be available to students) -* dueDate (last time to submit without incurring late penalties) -* endDate (last time to submit even with a late penalty) -* gradingType -* categoryName (eg. HW, Quizzes) -* description -* maxFileSize (for submissions) -* maxSubmissions (if null, infinite submissions allowed) -* disableHandins (Boolean) - - -### Submission -* courseId (foreign key of the course) -* assignmentId (foreign key of the assignment) -* userId (foreign key of the user owning the submission) -* content (The actual submission) -* type (filepath, json, or text) -* submitterIp -* submittedBy (foreign key of the user making the submission. Will match the userId for normal submissions. Will be different if instructor/ta is creating the submission or if a regrade request was made. Regrades create a new submission) -* orignalSubmissionId (null for normal submissions. Matches the original submission id for regrades. Number of non-nulls for a user is the number of submissions) - - -### AssignmentProblem -* assignmentId (foreign key of the assignment) -* problemName -* maxScore - - -**------ Everything above this line exists in the code. Everything below needs to be built ------** - - -### SubmissionProblemScore -* submissionId (foreign key of the submission) -* assignmentProblemId (foreign key of the assignmentProblem) -* score -* feedback - - -### SubmissionScore -* submissionId (foreign key of the submission) -* score -* feedback -* released ? - - -### AssignmentScore -* assignmentId (foreign key of the assignment) -* userId (foreign key of the user) -* score - - -### CategoryScore -* categoryId (foreign key of the category) -* userId (foreign key of the user) -* *missing attributes* - - -### Category -* courseId - - -### CourseScore -* courseId -* userId - - From c5284c0e5369fdbbe3c270d7d04114ea13f2ccce Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Wed, 28 Sep 2022 02:15:44 -0400 Subject: [PATCH 07/37] fixed markdown checklist syntax --- SCHEMA.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SCHEMA.md b/SCHEMA.md index 462e6102..e2a92940 100644 --- a/SCHEMA.md +++ b/SCHEMA.md @@ -6,12 +6,12 @@ - [x] [Assignment](#assignment) - [x] [Submission](#submission) - [x] [AssignmentProblem](#assignmentproblem) -- [] [SubmissionProblemScore](#submissionproblemscore) -- [] [SubmissionScore](#submissionscore) -- [] [AssignmentScore](#assignmentscore) -- [] [CategoryScore](#categoryscore) -- [] [Category](#category) -- [] [CourseScore](#coursescore) +- [ ] [SubmissionProblemScore](#submissionproblemscore) +- [ ] [SubmissionScore](#submissionscore) +- [ ] [AssignmentScore](#assignmentscore) +- [ ] [CategoryScore](#categoryscore) +- [ ] [Category](#category) +- [ ] [CourseScore](#coursescore) From 1a1828530931a5a89320383a1aabe293c279357a Mon Sep 17 00:00:00 2001 From: Jesse Hartloff Date: Wed, 28 Sep 2022 17:17:35 -0400 Subject: [PATCH 08/37] Move schema to docs folder; Add released field to AssignmentProblemScore --- SCHEMA.md => docs/SCHEMA.md | 1 + 1 file changed, 1 insertion(+) rename SCHEMA.md => docs/SCHEMA.md (99%) diff --git a/SCHEMA.md b/docs/SCHEMA.md similarity index 99% rename from SCHEMA.md rename to docs/SCHEMA.md index e2a92940..5f962b44 100644 --- a/SCHEMA.md +++ b/docs/SCHEMA.md @@ -86,6 +86,7 @@ * assignmentProblemId: foreign_key * score: ? * feedback: ? +* released: ? ### SubmissionScore From e451fba814ac2f547b253126e9b99c3a76a1a020 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 5 Oct 2022 17:56:48 -0400 Subject: [PATCH 09/37] [Dependencies] Update deps to resolve vulns This resolves all vulnerabilities reported by `npm audit`, including the breaking change to `passport` from `^0.4.1` to `^0.6.0`. All tests still pass with these updates. Fixes makeopensource/devU-api#15 --- package-lock.json | 224 +++++++++++++++++++++++++++------------------- package.json | 2 +- 2 files changed, 132 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d95b877..09f7d873 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "helmet": "^4.6.0", "jsonwebtoken": "^8.5.1", "morgan": "^1.10.0", - "passport": "^0.4.1", + "passport": "^0.6.0", "passport-saml": "^3.0.0", "pg": "^8.4.0", "reflect-metadata": "^0.1.10", @@ -1979,6 +1979,14 @@ "version": "0.8.3", "license": "MIT" }, + "node_modules/@xmldom/xmldom": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz", + "integrity": "sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/abab": { "version": "2.0.5", "dev": true, @@ -2101,8 +2109,9 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.0", - "license": "MIT", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "engines": { "node": ">=8" } @@ -7825,8 +7834,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "license": "MIT" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mkdirp": { "version": "1.0.4", @@ -7888,13 +7898,6 @@ "version": "1.0.5", "license": "MIT" }, - "node_modules/node-forge": { - "version": "0.10.0", - "license": "(BSD-3-Clause OR GPL-2.0)", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "dev": true, @@ -8053,6 +8056,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/openapi-types": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.0.2.tgz", + "integrity": "sha512-GuTo7FyZjOIWVhIhQSWJVaws6A82sWIGyQogxxYBYKZ0NBdyP2CYSIgOwFfSB+UVoPExk/YzFpyYitHS8KVZtA==", + "peer": true + }, "node_modules/optionator": { "version": "0.8.3", "dev": true, @@ -8182,27 +8191,34 @@ } }, "node_modules/passport": { - "version": "0.4.1", - "license": "MIT", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz", + "integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==", "dependencies": { "passport-strategy": "1.x.x", - "pause": "0.0.1" + "pause": "0.0.1", + "utils-merge": "^1.0.1" }, "engines": { "node": ">= 0.4.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jaredhanson" } }, "node_modules/passport-saml": { - "version": "3.1.0", - "license": "MIT", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/passport-saml/-/passport-saml-3.2.1.tgz", + "integrity": "sha512-Y8aD94B6MTLht57BlBrDauEgvtWjuSeINKk7NadXlpT/OBmsoGGYPpb0FJeBtdyGX4GEbZARAkxvBEqsL8E7XQ==", "dependencies": { - "debug": "^4.3.1", + "@xmldom/xmldom": "^0.7.5", + "debug": "^4.3.2", "passport-strategy": "^1.0.0", - "xml-crypto": "^2.1.2", - "xml-encryption": "^1.2.4", + "xml-crypto": "^2.1.3", + "xml-encryption": "^2.0.0", "xml2js": "^0.4.23", - "xmlbuilder": "^15.1.1", - "xmldom": "^0.6.0" + "xmlbuilder": "^15.1.1" }, "engines": { "node": ">= 12" @@ -8786,8 +8802,9 @@ } }, "node_modules/shell-quote": { - "version": "1.7.2", - "license": "MIT" + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz", + "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==" }, "node_modules/signal-exit": { "version": "3.0.3", @@ -9157,14 +9174,16 @@ } }, "node_modules/swagger-ui-dist": { - "version": "3.51.1", - "license": "Apache-2.0" + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.2.tgz", + "integrity": "sha512-kOIU7Ts3TrXDLb3/c9jRe4qGp8O3bRT19FFJA8wJfrRFkcK/4atPn3krhtBVJ57ZkNNofworXHxuYwmaisXBdg==" }, "node_modules/swagger-ui-express": { - "version": "4.1.6", - "license": "MIT", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.5.0.tgz", + "integrity": "sha512-DHk3zFvsxrkcnurGvQlAcLuTDacAVN1JHKDgcba/gr2NFRE4HGwP1YeHIXMiGznkWR4AeS7X5vEblNn4QljuNA==", "dependencies": { - "swagger-ui-dist": "^3.18.1" + "swagger-ui-dist": ">=4.11.0" }, "engines": { "node": ">= v0.10.32" @@ -9234,9 +9253,10 @@ "license": "MIT" }, "node_modules/tmpl": { - "version": "1.0.4", - "dev": true, - "license": "BSD-3-Clause" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true }, "node_modules/to-fast-properties": { "version": "2.0.0", @@ -9697,8 +9717,9 @@ } }, "node_modules/validator": { - "version": "13.6.0", - "license": "MIT", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", "engines": { "node": ">= 0.10" } @@ -9881,10 +9902,11 @@ } }, "node_modules/xml-crypto": { - "version": "2.1.2", - "license": "MIT", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-2.1.4.tgz", + "integrity": "sha512-ModFeGOy67L/XXHcuepnYGF7DASEDw7fhvy+qIs1ORoH55G1IIr+fN0kaMtttwvmNFFMskD9AHro8wx352/mUg==", "dependencies": { - "xmldom": "^0.6.0", + "@xmldom/xmldom": "^0.7.0", "xpath": "0.0.32" }, "engines": { @@ -9892,16 +9914,16 @@ } }, "node_modules/xml-encryption": { - "version": "1.2.4", - "license": "MIT", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xml-encryption/-/xml-encryption-2.0.0.tgz", + "integrity": "sha512-4Av83DdvAgUQQMfi/w8G01aJshbEZP9ewjmZMpS9t3H+OCZBDvyK4GJPnHGfWiXlArnPbYvR58JB9qF2x9Ds+Q==", "dependencies": { + "@xmldom/xmldom": "^0.7.0", "escape-html": "^1.0.3", - "node-forge": "^0.10.0", - "xmldom": "~0.6.0", "xpath": "0.0.32" }, "engines": { - "node": ">=8" + "node": ">=12" } }, "node_modules/xml-name-validator": { @@ -9939,16 +9961,10 @@ "dev": true, "license": "MIT" }, - "node_modules/xmldom": { - "version": "0.6.0", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/xpath": { "version": "0.0.32", - "license": "MIT", + "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.32.tgz", + "integrity": "sha512-rxMJhSIoiO8vXcWvSifKqhvV96GjiD5wYb8/QHdoRyQvraTpp4IEv944nhGausZZ3u7dhQXteZuZbaqfpB7uYw==", "engines": { "node": ">=0.6.0" } @@ -10065,12 +10081,13 @@ } }, "node_modules/z-schema": { - "version": "4.2.3", - "license": "MIT", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-4.2.4.tgz", + "integrity": "sha512-YvBeW5RGNeNzKOUJs3rTL4+9rpcvHXt5I051FJbOcitV8bl40pEfcG0Q+dWSwS0/BIYrMZ/9HHoqLllMkFhD0w==", "dependencies": { "lodash.get": "^4.4.2", "lodash.isequal": "^4.5.0", - "validator": "^12.0.0" + "validator": "^13.6.0" }, "bin": { "z-schema": "bin/z-schema" @@ -10087,13 +10104,6 @@ "license": "MIT", "optional": true }, - "node_modules/z-schema/node_modules/validator": { - "version": "12.2.0", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/zen-observable": { "version": "0.8.15", "license": "MIT" @@ -11441,6 +11451,11 @@ "@types/zen-observable": { "version": "0.8.3" }, + "@xmldom/xmldom": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz", + "integrity": "sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==" + }, "abab": { "version": "2.0.5", "dev": true @@ -11514,7 +11529,9 @@ } }, "ansi-regex": { - "version": "5.0.0" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { "version": "3.2.1", @@ -15163,7 +15180,9 @@ } }, "minimist": { - "version": "1.2.5" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mkdirp": { "version": "1.0.4" @@ -15204,9 +15223,6 @@ "nice-try": { "version": "1.0.5" }, - "node-forge": { - "version": "0.10.0" - }, "node-int64": { "version": "0.4.0", "dev": true @@ -15303,6 +15319,12 @@ "mimic-fn": "^2.1.0" } }, + "openapi-types": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/openapi-types/-/openapi-types-12.0.2.tgz", + "integrity": "sha512-GuTo7FyZjOIWVhIhQSWJVaws6A82sWIGyQogxxYBYKZ0NBdyP2CYSIgOwFfSB+UVoPExk/YzFpyYitHS8KVZtA==", + "peer": true + }, "optionator": { "version": "0.8.3", "dev": true, @@ -15382,22 +15404,27 @@ "version": "1.3.3" }, "passport": { - "version": "0.4.1", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz", + "integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==", "requires": { "passport-strategy": "1.x.x", - "pause": "0.0.1" + "pause": "0.0.1", + "utils-merge": "^1.0.1" } }, "passport-saml": { - "version": "3.1.0", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/passport-saml/-/passport-saml-3.2.1.tgz", + "integrity": "sha512-Y8aD94B6MTLht57BlBrDauEgvtWjuSeINKk7NadXlpT/OBmsoGGYPpb0FJeBtdyGX4GEbZARAkxvBEqsL8E7XQ==", "requires": { - "debug": "^4.3.1", + "@xmldom/xmldom": "^0.7.5", + "debug": "^4.3.2", "passport-strategy": "^1.0.0", - "xml-crypto": "^2.1.2", - "xml-encryption": "^1.2.4", + "xml-crypto": "^2.1.3", + "xml-encryption": "^2.0.0", "xml2js": "^0.4.23", - "xmlbuilder": "^15.1.1", - "xmldom": "^0.6.0" + "xmlbuilder": "^15.1.1" }, "dependencies": { "debug": { @@ -15755,7 +15782,9 @@ "version": "1.0.0" }, "shell-quote": { - "version": "1.7.2" + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz", + "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==" }, "signal-exit": { "version": "3.0.3", @@ -15993,12 +16022,16 @@ } }, "swagger-ui-dist": { - "version": "3.51.1" + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.14.2.tgz", + "integrity": "sha512-kOIU7Ts3TrXDLb3/c9jRe4qGp8O3bRT19FFJA8wJfrRFkcK/4atPn3krhtBVJ57ZkNNofworXHxuYwmaisXBdg==" }, "swagger-ui-express": { - "version": "4.1.6", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.5.0.tgz", + "integrity": "sha512-DHk3zFvsxrkcnurGvQlAcLuTDacAVN1JHKDgcba/gr2NFRE4HGwP1YeHIXMiGznkWR4AeS7X5vEblNn4QljuNA==", "requires": { - "swagger-ui-dist": "^3.18.1" + "swagger-ui-dist": ">=4.11.0" } }, "symbol-tree": { @@ -16043,7 +16076,9 @@ "dev": true }, "tmpl": { - "version": "1.0.4", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, "to-fast-properties": { @@ -16312,7 +16347,9 @@ } }, "validator": { - "version": "13.6.0" + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==" }, "vary": { "version": "1.1.2" @@ -16426,18 +16463,21 @@ "requires": {} }, "xml-crypto": { - "version": "2.1.2", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-2.1.4.tgz", + "integrity": "sha512-ModFeGOy67L/XXHcuepnYGF7DASEDw7fhvy+qIs1ORoH55G1IIr+fN0kaMtttwvmNFFMskD9AHro8wx352/mUg==", "requires": { - "xmldom": "^0.6.0", + "@xmldom/xmldom": "^0.7.0", "xpath": "0.0.32" } }, "xml-encryption": { - "version": "1.2.4", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xml-encryption/-/xml-encryption-2.0.0.tgz", + "integrity": "sha512-4Av83DdvAgUQQMfi/w8G01aJshbEZP9ewjmZMpS9t3H+OCZBDvyK4GJPnHGfWiXlArnPbYvR58JB9qF2x9Ds+Q==", "requires": { + "@xmldom/xmldom": "^0.7.0", "escape-html": "^1.0.3", - "node-forge": "^0.10.0", - "xmldom": "~0.6.0", "xpath": "0.0.32" } }, @@ -16464,11 +16504,10 @@ "version": "2.2.0", "dev": true }, - "xmldom": { - "version": "0.6.0" - }, "xpath": { - "version": "0.0.32" + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.32.tgz", + "integrity": "sha512-rxMJhSIoiO8vXcWvSifKqhvV96GjiD5wYb8/QHdoRyQvraTpp4IEv944nhGausZZ3u7dhQXteZuZbaqfpB7uYw==" }, "xtend": { "version": "4.0.2" @@ -16538,20 +16577,19 @@ "dev": true }, "z-schema": { - "version": "4.2.3", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-4.2.4.tgz", + "integrity": "sha512-YvBeW5RGNeNzKOUJs3rTL4+9rpcvHXt5I051FJbOcitV8bl40pEfcG0Q+dWSwS0/BIYrMZ/9HHoqLllMkFhD0w==", "requires": { "commander": "^2.7.1", "lodash.get": "^4.4.2", "lodash.isequal": "^4.5.0", - "validator": "^12.0.0" + "validator": "^13.6.0" }, "dependencies": { "commander": { "version": "2.20.3", "optional": true - }, - "validator": { - "version": "12.2.0" } } }, diff --git a/package.json b/package.json index 4dd5cee8..2bfab6ef 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "helmet": "^4.6.0", "jsonwebtoken": "^8.5.1", "morgan": "^1.10.0", - "passport": "^0.4.1", + "passport": "^0.6.0", "passport-saml": "^3.0.0", "pg": "^8.4.0", "reflect-metadata": "^0.1.10", From a1e5c9ae920493ee98611ddd9f152b07ef82e847 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 5 Oct 2022 19:16:43 -0400 Subject: [PATCH 10/37] [Documentation] Fix project referred to as example Fixes makeopensource/devU-api#18 --- README.md | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7cc451a0..f3a71490 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Typescript Example Project +# devU API This is an API for the v4 autograder. The main purpose of this project is to act as an in-between for the containers doing the autograding, and the users submitting assignments. diff --git a/package.json b/package.json index 4dd5cee8..c7fdb1cd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "typescript-api-example", + "name": "devu-api", "version": "1.0.0", - "description": "Typescript Express/ TypeORM Example", + "description": "Auto-grading 4.0 API", "scripts": { "start": "ts-node-dev src/index.ts", "update-shared": "npm update devu-shared-modules", From c811186e3e5864d9250a5b44830739890b6267ca Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 17:40:03 -0400 Subject: [PATCH 11/37] docs(README): Capitalize header on line 12 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3a71490..519951c6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This is an API for the v4 autograder. The main purpose of this project is to act For now the only reason we're including docker is to more easily control the development database. In the future we may very well dockerize the api itself for ease of development and deployment, but for now this writeup is expecting it to be running directly on your machine via node. -## Running the project locally +## Running the Project Locally ### Getting Everything Started From 7fe5c18f5304a4ff12d5f865de2d650107fc4150 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 17:45:36 -0400 Subject: [PATCH 12/37] docs(README): Clean up spelling/formatting errors --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 519951c6..0e6b003f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ docker run \ -d postgres ``` -Install all node dependancies. All of the database environment variables can change, and can be set as environment variables on your machine if you want to overwrite the defaults +Install all node dependencies. All of the database environment variables can change, and can be set as environment variables on your machine if you want to overwrite the defaults ``` npm install @@ -37,7 +37,6 @@ Run the setup script to create local development auth keys. These are used in lo npm run generate-config ``` - Run the initial migrations to setup our DB schema ``` @@ -76,13 +75,13 @@ Use [Azure Data Studio](https://docs.microsoft.com/en-us/sql/azure-data-studio/d ### Local Auth Providers -If you're looking for more information on how to setup auth for your developement environment, check out more info [here](./docs/localAuth.md) +If you're looking for more information on how to setup auth for your development environment, check out more info [here](./docs/localAuth.md) ## Working in the Project This project is built using -- [Typescript](https://www.typescriptlang.org/) - A superset of JavaScript. The language of the applciation +- [Typescript](https://www.typescriptlang.org/) - A superset of JavaScript. The language of the application - [Express](https://expressjs.com/) - A Node REST framework. - [TypeORM](https://typeorm.io/#/) - A Typescript ORM (manages the DB and all DB calls) @@ -101,7 +100,7 @@ In express, all of the functions added after the route's path are considered mid Express's middleware is always a function with three arguments ```typescript -function middlwareName(req: Reques, res: Response, next: NextFunction) +function middlewareName(req: Request, res: Response, next: NextFunction) ``` Here's what you need to know: @@ -130,7 +129,7 @@ Let's take this from the top - Controllers: deals with setting status codes, and directing to services. For the most part, controllers should be the last piece of middleware in the chain. - Services: Workhorse of the application. Deals with all major application logic and database calls -The database models live outside of this control flow as they don't deal with any buisness logic. However services will use them to access the database. You can largely think of the models as a 1:1 map to database tables. +The database models live outside of this control flow as they don't deal with any business logic. However services will use them to access the database. You can largely think of the models as a 1:1 map to database tables. ### Shared Modules @@ -168,7 +167,7 @@ npm test Keep in mind that when testing, jest is looking for `*.test.ts` files, so be sure to include the `.test` portion in those filenames. -If durring development, you want to only run a single test file (via command line), you can do so by adding a string to the end of the test command. That string will be used as a regex against the filename(s). So as an example, if we wanted to run all of the controller tests, you could do so by: +If during development, you want to only run a single test file (via command line), you can do so by adding a string to the end of the test command. That string will be used as a regex against the filename(s). So as an example, if we wanted to run all of the controller tests, you could do so by: ``` npm test "controller" @@ -210,7 +209,7 @@ npm run typeorm -- migration:revert ### Configuration Options -Most of the API's configuraiton options live in a file called `environment.ts`. That file is bootstrapped at startup using the [config library]https://www.npmjs.com/package/config), as well as some environment variables. +Most of the API's configuration options live in a file called `environment.ts`. That file is bootstrapped at startup using the [config library](https://www.npmjs.com/package/config), as well as some environment variables. What this means for you (the developer) is that you can control certain api options via environment variables at runtime, or by using your `config/default.yml`. To see which `environment.ts` options support using environment variables directly, open that file and see which are using `process.env.*`; everything else should be configurable via your `default.yml` @@ -236,7 +235,7 @@ import Routers import Utils ``` -The important thing here is once you get into the modules (models/ controllers/ routers/ etc), import them alphebetically with a single empty line inbetween them. +The important thing here is once you get into the modules (models/ controllers/ routers/ etc), import them alphabetically with a single empty line in between them. ## Production Builds From 15deaab65a6701c7c5998e30b5680bf31223e348 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 22:14:39 +0000 Subject: [PATCH 13/37] Bump passport-saml from 3.2.1 to 3.2.2 Bumps [passport-saml](https://github.com/node-saml/passport-saml) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/node-saml/passport-saml/releases) - [Changelog](https://github.com/node-saml/passport-saml/blob/master/CHANGELOG.md) - [Commits](https://github.com/node-saml/passport-saml/compare/v3.2.1...v3.2.2) --- updated-dependencies: - dependency-name: passport-saml dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 09f7d873..78e51849 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "jsonwebtoken": "^8.5.1", "morgan": "^1.10.0", "passport": "^0.6.0", - "passport-saml": "^3.0.0", + "passport-saml": "^3.2.2", "pg": "^8.4.0", "reflect-metadata": "^0.1.10", "swagger-jsdoc": "^6.1.0", @@ -8208,9 +8208,9 @@ } }, "node_modules/passport-saml": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/passport-saml/-/passport-saml-3.2.1.tgz", - "integrity": "sha512-Y8aD94B6MTLht57BlBrDauEgvtWjuSeINKk7NadXlpT/OBmsoGGYPpb0FJeBtdyGX4GEbZARAkxvBEqsL8E7XQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/passport-saml/-/passport-saml-3.2.2.tgz", + "integrity": "sha512-69lhv2HVuXlMcywSeZ91o91L5BW1tSK3xX3TJh8QfRUv8M65B5Jm0cgm2PV63IM3qn4Cq4jDkq934vcBEBcRNw==", "dependencies": { "@xmldom/xmldom": "^0.7.5", "debug": "^4.3.2", @@ -15414,9 +15414,9 @@ } }, "passport-saml": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/passport-saml/-/passport-saml-3.2.1.tgz", - "integrity": "sha512-Y8aD94B6MTLht57BlBrDauEgvtWjuSeINKk7NadXlpT/OBmsoGGYPpb0FJeBtdyGX4GEbZARAkxvBEqsL8E7XQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/passport-saml/-/passport-saml-3.2.2.tgz", + "integrity": "sha512-69lhv2HVuXlMcywSeZ91o91L5BW1tSK3xX3TJh8QfRUv8M65B5Jm0cgm2PV63IM3qn4Cq4jDkq934vcBEBcRNw==", "requires": { "@xmldom/xmldom": "^0.7.5", "debug": "^4.3.2", diff --git a/package.json b/package.json index 2bfab6ef..9a8e8c44 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "jsonwebtoken": "^8.5.1", "morgan": "^1.10.0", "passport": "^0.6.0", - "passport-saml": "^3.0.0", + "passport-saml": "^3.2.2", "pg": "^8.4.0", "reflect-metadata": "^0.1.10", "swagger-jsdoc": "^6.1.0", From 6e078f51c0658d396354cc6a719473e3e50f2957 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 18:41:19 -0400 Subject: [PATCH 14/37] ci(GH Actions): Initial basic build & test Pretty much just default Node.js config, just changed to only run on PRs (instead of pushes and PRs targetting "master") --- .github/workflows/buildAndTest.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/buildAndTest.yml diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml new file mode 100644 index 00000000..578029da --- /dev/null +++ b/.github/workflows/buildAndTest.yml @@ -0,0 +1,27 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Build & Test + +on: pull_request + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x, 18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build + - run: npm test From ab6cf9e2ea6ed799c74f837ccb0632d886778486 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 18:57:41 -0400 Subject: [PATCH 15/37] ci(GH Actions): Remove Node v14 from tests package.json defines requirement node >= 16 --- .github/workflows/buildAndTest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index 578029da..1fd6145c 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [16.x, 18.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: From e1445e1c4f546eb50596b5ce2289e53abf387a15 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 19:14:28 -0400 Subject: [PATCH 16/37] ci(GH Actions): Disable fail-fast, new format run --- .github/workflows/buildAndTest.yml | 1 + .github/workflows/format.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index 1fd6145c..eb05e15f 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: node-version: [16.x, 18.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..c86fa6cd --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,26 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Build & Test + +on: pull_request + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [16.x, 18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm run format From 9220a68bf386090b2a3ff21fb0d60581126f025d Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 19:16:55 -0400 Subject: [PATCH 17/37] ci(GH Actions): Fix format run --- .github/workflows/format.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index c86fa6cd..7a4cc23b 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Build & Test +name: Format on: pull_request @@ -23,4 +23,5 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: npm install prettier - run: npm run format From 43fcf4b710cb13028d53f863cbad0517875e1862 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 19:30:51 -0400 Subject: [PATCH 18/37] ci(GH Actions): Add Docker setup to build and test No idea if this will Just Work (TM), but I guess we'll find out soon! --- .github/workflows/buildAndTest.yml | 9 +++++++++ .github/workflows/format.yml | 12 +++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index eb05e15f..72cc6b8a 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -23,6 +23,15 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: docker run \ + --name typeorm-postgres \ + -p 5432:5432 \ + -e POSTGRES_PASSWORD=password \ + -e POSTGRES_DB=typescript_api \ + -e POSTGRES_USER=typescript_user \ + -d postgres - run: npm ci + - run: npm run generate-config + - run: npm run typeorm -- migration:run - run: npm run build - run: npm test diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 7a4cc23b..bc10430d 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -10,18 +10,12 @@ jobs: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: '16.x' cache: 'npm' - - run: npm install prettier + - run: npm ci - run: npm run format From cb5c42a89a782adbc38deaa0b1d662251f8d380b Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 12 Oct 2022 19:33:58 -0400 Subject: [PATCH 19/37] ci(GH Actions): Edit docker run command GH concats it all into one line so escaping the line breaks isnt needed --- .github/workflows/buildAndTest.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index 72cc6b8a..00a3391f 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -23,12 +23,12 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: docker run \ - --name typeorm-postgres \ - -p 5432:5432 \ - -e POSTGRES_PASSWORD=password \ - -e POSTGRES_DB=typescript_api \ - -e POSTGRES_USER=typescript_user \ + - run: docker run + --name typeorm-postgres + -p 5432:5432 + -e POSTGRES_PASSWORD=password + -e POSTGRES_DB=typescript_api + -e POSTGRES_USER=typescript_user -d postgres - run: npm ci - run: npm run generate-config From 0f47927f2c7cbb0a562a4c87fe4c1d81da7ab33d Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 13 Oct 2022 14:45:50 -0400 Subject: [PATCH 20/37] ci(GH Actions): Separate test, add annotations This uses incorporates mattallty/jest-github-action to add annotations in the test files on the failing tests, making it easier to identify the problems --- .../workflows/{buildAndTest.yml => build.yml} | 2 +- .github/workflows/test.yml | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) rename .github/workflows/{buildAndTest.yml => build.yml} (98%) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/build.yml similarity index 98% rename from .github/workflows/buildAndTest.yml rename to .github/workflows/build.yml index 00a3391f..4a3902bb 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Build & Test +name: Build on: pull_request diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a504594c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Format + +on: pull_request + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '16.x' + cache: 'npm' + - uses: mattallty/jest-github-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 02d5519091a0ab221da9c1f022e9750f886e8f91 Mon Sep 17 00:00:00 2001 From: Alex M Date: Thu, 13 Oct 2022 14:49:32 -0400 Subject: [PATCH 21/37] ci(GH Actions): Fix test action --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a504594c..2f7eab88 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Format +name: Test on: pull_request @@ -17,6 +17,7 @@ jobs: with: node-version: '16.x' cache: 'npm' + - run: npm ci - uses: mattallty/jest-github-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e675f11b2ab61dcb3e1032bfdee556be56f03636 Mon Sep 17 00:00:00 2001 From: Alex M Date: Fri, 14 Oct 2022 16:20:24 -0400 Subject: [PATCH 22/37] ci(GH Actions): Restructure actions into one file Test and Format now rely on Build, reducing duplicate code (if this works the way I think it will) --- .github/workflows/format.yml | 21 --------- .../workflows/{build.yml => pr-review.yml} | 43 +++++++++++++------ .github/workflows/test.yml | 23 ---------- 3 files changed, 30 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/format.yml rename .github/workflows/{build.yml => pr-review.yml} (53%) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index bc10430d..00000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,21 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Format - -on: pull_request - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '16.x' - cache: 'npm' - - run: npm ci - - run: npm run format diff --git a/.github/workflows/build.yml b/.github/workflows/pr-review.yml similarity index 53% rename from .github/workflows/build.yml rename to .github/workflows/pr-review.yml index 4a3902bb..46c12a1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/pr-review.yml @@ -1,17 +1,17 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Build +name: PR Review on: pull_request jobs: build: + name: Prepare environment and build runs-on: ubuntu-latest strategy: - fail-fast: false matrix: node-version: [16.x, 18.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ @@ -23,15 +23,32 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: docker run - --name typeorm-postgres - -p 5432:5432 - -e POSTGRES_PASSWORD=password - -e POSTGRES_DB=typescript_api - -e POSTGRES_USER=typescript_user - -d postgres - - run: npm ci - - run: npm run generate-config - - run: npm run typeorm -- migration:run + - name: Prepare environment + run: | + docker run --name typeorm-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=typescript_api -e POSTGRES_USER=typescript_user -d postgres + npm ci + npm run generate-config + npm run typeorm -- migration:run - run: npm run build - - run: npm test + + + test: + name: Run tests + + needs: build + + runs-on: ubuntu-latest + + steps: + - uses: mattallty/jest-github-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + format: + name: Run formatter + + runs-on: ubuntu-latest + + steps: + - run: npm run format diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 2f7eab88..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Test - -on: pull_request - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '16.x' - cache: 'npm' - - run: npm ci - - uses: mattallty/jest-github-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a2624cf21695cf5e392e022ae1a8dc9309d73915 Mon Sep 17 00:00:00 2001 From: Alex M Date: Fri, 14 Oct 2022 16:36:02 -0400 Subject: [PATCH 23/37] ci(GH Actions): Fix actions again Last commit: > Test and Format now rely on Build, reducing duplicate code > (if this works the way I think it will) It did not. They're still unique environments, so it still has to be set up for each action --- .github/workflows/pr-review.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 46c12a1f..20b7697d 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -29,7 +29,8 @@ jobs: npm ci npm run generate-config npm run typeorm -- migration:run - - run: npm run build + - name: Build project + run: npm run build test: @@ -40,7 +41,22 @@ jobs: runs-on: ubuntu-latest steps: - - uses: mattallty/jest-github-action@v1 + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Prepare environment + run: | + docker run --name typeorm-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=typescript_api -e POSTGRES_USER=typescript_user -d postgres + npm ci + npm run generate-config + npm run typeorm -- migration:run + - name: Build project + run: npm run build + - name: Run tests + uses: mattallty/jest-github-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -51,4 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - - run: npm run format + - name: Prepare environment + run: npm ci + - name: Run formatter + run: npm run format From 16e4c4281e35a35a42b18b74ab1030c0903604b6 Mon Sep 17 00:00:00 2001 From: Alex M Date: Fri, 14 Oct 2022 16:46:40 -0400 Subject: [PATCH 24/37] ci(GH Actions): Clean up action runs --- .github/workflows/pr-review.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 20b7697d..d9b8e6e0 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -7,7 +7,7 @@ on: pull_request jobs: build: - name: Prepare environment and build + name: Build runs-on: ubuntu-latest @@ -42,10 +42,9 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} cache: 'npm' - name: Prepare environment run: | @@ -67,6 +66,11 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + cache: 'npm' - name: Prepare environment run: npm ci - name: Run formatter From ddc6ce614834cc4e4a84923681d203a9cd73e6aa Mon Sep 17 00:00:00 2001 From: Alex M Date: Fri, 14 Oct 2022 17:33:05 -0400 Subject: [PATCH 25/37] test(GH Actions): Ex. of failing test, formatting Intentionally failing a test and messing up file formatting to see how the actions deal with that --- src/controller/tests/assignmentProblems.controller.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controller/tests/assignmentProblems.controller.test.ts b/src/controller/tests/assignmentProblems.controller.test.ts index 560d322a..612e1825 100644 --- a/src/controller/tests/assignmentProblems.controller.test.ts +++ b/src/controller/tests/assignmentProblems.controller.test.ts @@ -65,6 +65,7 @@ describe('AssignmentProblemController', () => { fail('Expected test to throw') } catch { expect(next).toBeCalledWith(expectedError) +fail('Example of failing test, with poor formatting that should be fixed') } }) }) From 810bf9aa1ba09bf61bf950aedddbf376293f37be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 22:54:08 +0000 Subject: [PATCH 26/37] Bump @xmldom/xmldom from 0.7.5 to 0.7.6 Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.7.5 to 0.7.6. - [Release notes](https://github.com/xmldom/xmldom/releases) - [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md) - [Commits](https://github.com/xmldom/xmldom/compare/0.7.5...0.7.6) --- updated-dependencies: - dependency-name: "@xmldom/xmldom" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 09f7d873..d828feb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1980,9 +1980,9 @@ "license": "MIT" }, "node_modules/@xmldom/xmldom": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz", - "integrity": "sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==", + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.6.tgz", + "integrity": "sha512-HHXP9hskkFQHy8QxxUXkS7946FFIhYVfGqsk0WLwllmexN9x/+R4UBLvurHEuyXRfVEObVR8APuQehykLviwSQ==", "engines": { "node": ">=10.0.0" } @@ -11452,9 +11452,9 @@ "version": "0.8.3" }, "@xmldom/xmldom": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz", - "integrity": "sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==" + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.6.tgz", + "integrity": "sha512-HHXP9hskkFQHy8QxxUXkS7946FFIhYVfGqsk0WLwllmexN9x/+R4UBLvurHEuyXRfVEObVR8APuQehykLviwSQ==" }, "abab": { "version": "2.0.5", From 46c88c0e58bc9ed0306501435fdb363a0bcb0143 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 17:37:15 -0400 Subject: [PATCH 27/37] ci(GH Actions): Formatter needs to commit results I won't tell it to actually commit yet, first I'll review the output to make sure it isn't committing too much --- .github/workflows/pr-review.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index d9b8e6e0..718180cd 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -75,3 +75,7 @@ jobs: run: npm ci - name: Run formatter run: npm run format + - name: Commit results (but not yet for testing) + run: | + git add . + git status From 3e7a255464cf0dffbe894197e29b50849eaebd42 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 17:40:13 -0400 Subject: [PATCH 28/37] ci(GH Actions): Looks good, actually committing --- .github/workflows/pr-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 718180cd..04b01ad0 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -78,4 +78,4 @@ jobs: - name: Commit results (but not yet for testing) run: | git add . - git status + git commit From 5412e59a36bb1685e7bb51ee5d906e6b55cafdf5 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 17:50:55 -0400 Subject: [PATCH 29/37] ci(GH Actions): Try different method to commit --- .github/workflows/pr-review.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 04b01ad0..bf6d8120 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -75,7 +75,7 @@ jobs: run: npm ci - name: Run formatter run: npm run format - - name: Commit results (but not yet for testing) - run: | - git add . - git commit + - name: Commit results + uses: maxgfr/github-commit-push-file@main + with: + commit_name: 'style: run formatter' From 2f80b8ab7665d02095c53df05780f8ed174837c2 Mon Sep 17 00:00:00 2001 From: WeirdAlex03 Date: Wed, 19 Oct 2022 21:51:47 +0000 Subject: [PATCH 30/37] style: run formatter --- README.md | 1 - docs/SCHEMA.md | 126 +++++++++--------- docs/localAuth.md | 7 +- docs/postman-setup.md | 4 +- .../assignmentProblems.controller.test.ts | 2 +- .../tests/userCourses.controller.test.ts | 4 +- src/controller/userCourses.controller.ts | 2 +- 7 files changed, 72 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 7cc451a0..9a0cf415 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ Run the setup script to create local development auth keys. These are used in lo npm run generate-config ``` - Run the initial migrations to setup our DB schema ``` diff --git a/docs/SCHEMA.md b/docs/SCHEMA.md index 5f962b44..ce74396b 100644 --- a/docs/SCHEMA.md +++ b/docs/SCHEMA.md @@ -13,109 +13,107 @@ - [ ] [Category](#category) - [ ] [CourseScore](#coursescore) - - # Entity Details ### Generic Entity Attributes -* id -* createdAt -* updatedAt -* deletedAt +- id +- createdAt +- updatedAt +- deletedAt ### User -*Student user for devu* -* email: string -* externalId: foreign_key -* preferredName: string +_Student user for devu_ + +- email: string +- externalId: foreign_key +- preferredName: string ### Course -* name: string -* semester: string -* number: string *ex: cse220* -* startDate: ? -* endDate: ? +- name: string +- semester: string +- number: string _ex: cse220_ +- startDate: ? +- endDate: ? ### UserCourse -*Links a user to a course* -* userId: foreign_key -* courseId: foreign_key -* level: ? -* dropped: boolean +_Links a user to a course_ + +- userId: foreign_key +- courseId: foreign_key +- level: ? +- dropped: boolean ### Assignment -* courseId: foreign_key -* name: string -* startDate: ? -* dueDate: ? -* endDate: ? -* gradingType: ? -* categoryName: ? -* description: string -* maxFileSize: ? -* maxSubmissions: ? -* disableHandins: boolean +- courseId: foreign_key +- name: string +- startDate: ? +- dueDate: ? +- endDate: ? +- gradingType: ? +- categoryName: ? +- description: string +- maxFileSize: ? +- maxSubmissions: ? +- disableHandins: boolean ### Submission -* courseId: foreign_key -* assignmentId: foreign_key -* userId: foreign_key -* content: ? -* type: ? -* submitterIp: ? -* submittedBy: ? -* orignalSubmissionId: ? +- courseId: foreign_key +- assignmentId: foreign_key +- userId: foreign_key +- content: ? +- type: ? +- submitterIp: ? +- submittedBy: ? +- orignalSubmissionId: ? ### AssignmentProblem -* assignmentId: foreign_key -* problemName: ? -* maxScore: ? +- assignmentId: foreign_key +- problemName: ? +- maxScore: ? **------ Everything above this line exists in the code. Everything below needs to be built ------** - ### SubmissionProblemScore -* submissionId: foreign_key -* assignmentProblemId: foreign_key -* score: ? -* feedback: ? -* released: ? +- submissionId: foreign_key +- assignmentProblemId: foreign_key +- score: ? +- feedback: ? +- released: ? ### SubmissionScore -* submissionId: foreign_key -* score: ? -* feedback: ? -* released: ? +- submissionId: foreign_key +- score: ? +- feedback: ? +- released: ? ### AssignmentScore -* assignmentId: foreign_key -* userId: foreign_key -* score: ? +- assignmentId: foreign_key +- userId: foreign_key +- score: ? ### CategoryScore -* categoryId: foreign_key -* userId: foreign_key -* *missing attributes* +- categoryId: foreign_key +- userId: foreign_key +- _missing attributes_ ### Category -* courseId: foreign_key -* *missing attributes* +- courseId: foreign_key +- _missing attributes_ ### CourseScore -* courseId: foreign_key -* userId: foreign_key -* *missing attributes* - +- courseId: foreign_key +- userId: foreign_key +- _missing attributes_ diff --git a/docs/localAuth.md b/docs/localAuth.md index 4bdd1a5a..6dcd7595 100644 --- a/docs/localAuth.md +++ b/docs/localAuth.md @@ -14,12 +14,12 @@ If you wish to better understand how this works, here's a bit more information. When developer auth is enabled, users can provide the email & externalId of the user they wish to login as (or create) and recieve a valid refresh/ access token. - ### Fetching the bearer token Request: `POST /login/developer` Sample Request body: + ``` { "email": "name@buffalo.edu", @@ -36,6 +36,7 @@ Sample Response: ``` Sample Response Headers: + ``` { "Set-Cookie": "refreshToken=;" @@ -43,7 +44,7 @@ Sample Response Headers: ``` ### Using the Bearer token - + Request: `GET /users` Request headers (notice the space between `Bearer` and ``!): @@ -56,8 +57,6 @@ Request headers (notice the space between `Bearer` and ``!): With this flag on, it enabled the `/login/developer` route (see `./router/login.router.ts` for more details). - - ## Testing SAML Authentication Locally To test SAML authentication, you will need to configure an Identity Provider (IDP) for the API to authenticate against. As we don't expect anyone to just have a configured IDP laying around ready to go, this will walk through using [SamlTest.id](https://samltest.id/). diff --git a/docs/postman-setup.md b/docs/postman-setup.md index 5d301ea3..de563696 100644 --- a/docs/postman-setup.md +++ b/docs/postman-setup.md @@ -2,16 +2,18 @@ [JSON configuration file for Postman](https://www.getpostman.com/collections/b817928ddd3489a9f8a4) -Postman is a great tool for testing API endpoints. The link above is a configuration file that +Postman is a great tool for testing API endpoints. The link above is a configuration file that will help setup the basic configuration for working with most of the basic endpoints. ### Get Started + 1. Install/Open Postman 2. Copy JSON configuration file link 3. Select `Import > Link` 4. Paste the link, click continue, and then click `Import` ### Setup Auth + See `docs/localAuth.md` for examples 1. Using the auth folder, run `retrieve auth token` diff --git a/src/controller/tests/assignmentProblems.controller.test.ts b/src/controller/tests/assignmentProblems.controller.test.ts index 612e1825..f5f778d8 100644 --- a/src/controller/tests/assignmentProblems.controller.test.ts +++ b/src/controller/tests/assignmentProblems.controller.test.ts @@ -65,7 +65,7 @@ describe('AssignmentProblemController', () => { fail('Expected test to throw') } catch { expect(next).toBeCalledWith(expectedError) -fail('Example of failing test, with poor formatting that should be fixed') + fail('Example of failing test, with poor formatting that should be fixed') } }) }) diff --git a/src/controller/tests/userCourses.controller.test.ts b/src/controller/tests/userCourses.controller.test.ts index 63c0f19b..69bbf425 100644 --- a/src/controller/tests/userCourses.controller.test.ts +++ b/src/controller/tests/userCourses.controller.test.ts @@ -53,8 +53,8 @@ describe('UserCourseController', () => { UserCourseService.list = jest.fn().mockImplementation(() => Promise.resolve(mockedUserCourses)) await controller.get(req, res, next) // what we're testing }) - - test('UserId is passed to UserCourseService',() => expect(UserCourseService.list).toBeCalledWith(expectedUserId)) + + test('UserId is passed to UserCourseService', () => expect(UserCourseService.list).toBeCalledWith(expectedUserId)) test('Returns list of userCourses', () => expect(res.json).toBeCalledWith(expectedResults)) test('Status code is 200', () => expect(res.status).toBeCalledWith(200)) }) diff --git a/src/controller/userCourses.controller.ts b/src/controller/userCourses.controller.ts index 5de934c9..c6d83e19 100644 --- a/src/controller/userCourses.controller.ts +++ b/src/controller/userCourses.controller.ts @@ -8,7 +8,7 @@ import { GenericResponse, NotFound, Updated } from '../utils/apiResponse.utils' export async function get(req: Request, res: Response, next: NextFunction) { try { if (!req.currentUser?.userId) return res.status(400).json(new GenericResponse('Request requires auth')) - + const userCourses = await UserCourseService.list(req.currentUser.userId) res.status(200).json(userCourses.map(serialize)) From a2f07bee0f7bdb78033f7d61d6497eca9953462f Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 18:02:45 -0400 Subject: [PATCH 31/37] ci(GH Actions): Different commit technique --- .github/workflows/pr-review.yml | 5 +++-- src/controller/tests/assignmentProblems.controller.test.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index bf6d8120..dcf30abd 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -76,6 +76,7 @@ jobs: - name: Run formatter run: npm run format - name: Commit results - uses: maxgfr/github-commit-push-file@main + uses: EndBug/add-and-commit@v9 with: - commit_name: 'style: run formatter' + message: 'style: run formatter' + default_author: github_actions diff --git a/src/controller/tests/assignmentProblems.controller.test.ts b/src/controller/tests/assignmentProblems.controller.test.ts index f5f778d8..612e1825 100644 --- a/src/controller/tests/assignmentProblems.controller.test.ts +++ b/src/controller/tests/assignmentProblems.controller.test.ts @@ -65,7 +65,7 @@ describe('AssignmentProblemController', () => { fail('Expected test to throw') } catch { expect(next).toBeCalledWith(expectedError) - fail('Example of failing test, with poor formatting that should be fixed') +fail('Example of failing test, with poor formatting that should be fixed') } }) }) From 0c35121be99f719ebe14b63ede413bc2797a30bb Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 18:07:49 -0400 Subject: [PATCH 32/37] ci(GH Actions): Fix checkout to work with commit --- .github/workflows/pr-review.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index dcf30abd..722e2084 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -67,6 +67,9 @@ jobs: steps: - uses: actions/checkout@v3 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} - name: Use Node.js uses: actions/setup-node@v3 with: From bec0ff1a2a56240be945f87bfbc63654398d7a90 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Oct 2022 22:08:48 +0000 Subject: [PATCH 33/37] style: run formatter --- src/controller/tests/assignmentProblems.controller.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/tests/assignmentProblems.controller.test.ts b/src/controller/tests/assignmentProblems.controller.test.ts index 612e1825..f5f778d8 100644 --- a/src/controller/tests/assignmentProblems.controller.test.ts +++ b/src/controller/tests/assignmentProblems.controller.test.ts @@ -65,7 +65,7 @@ describe('AssignmentProblemController', () => { fail('Expected test to throw') } catch { expect(next).toBeCalledWith(expectedError) -fail('Example of failing test, with poor formatting that should be fixed') + fail('Example of failing test, with poor formatting that should be fixed') } }) }) From c84da6341b82344e289456b6b8f691691afe6aad Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 18:41:10 -0400 Subject: [PATCH 34/37] test(GH Actions): It works, undo broken test This reverts the failing test intentionally added in ddc6ce614834cc4e4a84923681d203a9cd73e6aa --- src/controller/tests/assignmentProblems.controller.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/controller/tests/assignmentProblems.controller.test.ts b/src/controller/tests/assignmentProblems.controller.test.ts index f5f778d8..560d322a 100644 --- a/src/controller/tests/assignmentProblems.controller.test.ts +++ b/src/controller/tests/assignmentProblems.controller.test.ts @@ -65,7 +65,6 @@ describe('AssignmentProblemController', () => { fail('Expected test to throw') } catch { expect(next).toBeCalledWith(expectedError) - fail('Example of failing test, with poor formatting that should be fixed') } }) }) From 66084d4f3708cb97e52261e052da6e4082bf57c8 Mon Sep 17 00:00:00 2001 From: Alex M Date: Wed, 19 Oct 2022 18:41:28 -0400 Subject: [PATCH 35/37] ci(GH Actions): Formatter needs to commit results I won't tell it to actually commit yet, first I'll review the output to make sure it isn't committing too much --- .github/workflows/pr-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 722e2084..b759e792 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -3,7 +3,7 @@ name: PR Review -on: pull_request +on: [ pull_request, workflow_dispatch ] jobs: build: From b422558d60c08e8c4c7e6d275d1271b297d46c1b Mon Sep 17 00:00:00 2001 From: Emil Kovacev Date: Wed, 16 Nov 2022 17:56:19 -0500 Subject: [PATCH 36/37] Added to docs - Added postman file config - Edited docs for postman file --- docs/devU.postman_collection.json | 801 ++++++++++++++++++++++++++++++ docs/localAuth.md | 2 +- docs/postman-setup.md | 8 +- 3 files changed, 805 insertions(+), 6 deletions(-) create mode 100644 docs/devU.postman_collection.json diff --git a/docs/devU.postman_collection.json b/docs/devU.postman_collection.json new file mode 100644 index 00000000..7bc1b040 --- /dev/null +++ b/docs/devU.postman_collection.json @@ -0,0 +1,801 @@ +{ + "info": { + "_postman_id": "e226b901-52c8-4987-b8dc-c2877db66612", + "name": "devU", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "16727143" + }, + "item": [ + { + "name": "auth", + "item": [ + { + "name": "retrieve auth token", + "request": { + "method": "POST", + "header": [ + { + "key": "", + "value": "", + "type": "text", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"email\": \"emil@gmail.com\",\n \"externalId\": \"776\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/login/developer", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "login", + "developer" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "users", + "item": [ + { + "name": "get users", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/users/", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "users", + "" + ] + } + }, + "response": [] + }, + { + "name": "get (single) user", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/users/", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "users", + "" + ] + } + }, + "response": [] + }, + { + "name": "create (single) user", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"email\": \"emilkovacev@gmail.com\",\n \"externalId\": \"abc\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/users/", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "users", + "" + ] + } + }, + "response": [] + }, + { + "name": "get (single) user", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/users/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "users", + "1" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "courses", + "item": [ + { + "name": "get courses", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/courses/", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "courses", + "" + ] + } + }, + "response": [] + }, + { + "name": "get (single) course", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/courses/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "courses", + "1" + ] + } + }, + "response": [] + }, + { + "name": "create (single) course", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Systems Programming\",\n \"semester\": \"f2021\",\n \"number\": \"cse220\",\n \"startDate\": \"2021-09-03\",\n \"endDate\": \"2021-12-10\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/courses/", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "courses", + "" + ] + } + }, + "response": [] + }, + { + "name": "delete (single) course", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/courses/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "courses", + "1" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "user-courses", + "item": [ + { + "name": "get (single) user-course", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/user-courses/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "user-courses", + "1" + ] + } + }, + "response": [] + }, + { + "name": "create (single) user-course", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"userId\": 1,\n \"courseId\": 1,\n \"level\": \"student\",\n \"dropped\": false\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/user-courses/", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "user-courses", + "" + ] + } + }, + "response": [] + }, + { + "name": "delete (single) user-course", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/user-courses/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "user-courses", + "1" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "assignments", + "item": [ + { + "name": "get assignments", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/assignments", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "assignments" + ] + } + }, + "response": [] + }, + { + "name": "get (single) assignment", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/assignments/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "assignments", + "1" + ] + } + }, + "response": [] + }, + { + "name": "create (single) assignment", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"courseId\": 1,\n \"name\": \"PA0\",\n \"gradingType\": \"code\",\n \"categoryName\": \"PA\",\n \"description\": \"run-line encoder\",\n \"startDate\": \"2021-09-10\",\n \"dueDate\": \"2021-10-02\",\n \"endDate\": \"2021-10-10\",\n \"maxFileSize\": 1000,\n \"disableHandins\": false\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/assignments", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "assignments" + ] + } + }, + "response": [] + }, + { + "name": "delete (single) assignment", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/assignments/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "assignments", + "1" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "submissions", + "item": [ + { + "name": "get submissions", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/submissions", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "submissions" + ] + } + }, + "response": [] + }, + { + "name": "get (single) submission", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/submissions/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "submissions", + "1" + ] + } + }, + "response": [] + }, + { + "name": "create (single) submission", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"userId\": 1,\n \"assignmentId\": 1,\n \"courseId\": 1,\n \"type\": \"text\",\n \"content\": \"uhhhhh\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/submissions", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "submissions" + ] + } + }, + "response": [] + }, + { + "name": "delete (single) submission", + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{authorization}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:3001/submissions/1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "3001", + "path": [ + "submissions", + "1" + ] + } + }, + "response": [] + } + ] + } + ], + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InNrMDcxMTIwMjEifQ.eyJ1c2VySWQiOjEsImlzUmVmcmVzaFRva2VuIjp0cnVlLCJpYXQiOjE2NjY4MTk1MTUsImV4cCI6MTY2NzY4MzUxNSwiYXVkIjpbImRldlUtYXBpIiwiZGV2VS1jbGllbnQiXSwiaXNzIjoiZGV2VS1hdXRoIiwic3ViIjoiMSJ9.v-fWfekwbQwS5baoV384bBVVE4c3PoJLnfqr_oCrsgANR5MneI6Fs05Ek3dowRGWTL-VPBHq_pFBeF93dGkHwjoOF2Rs-1gzmsz0suTZUrmb0Nw7V3cHeppKfnPDjrmReDvESAEEQ3aTmX1TzvNbe_hEwBqrBtzdrbn456MbIOjJJuXlrL2J_m3wEe1_OW9ijg9wYf603g_6mWHbrc7B-71ZoVE4nNw3wEAAL_aHuFcqgOsyIyN6jmF4ItdVbHt9gUtpG7d694CLKzmyByVhhk356-sXJ2HVJaivl-jkkWxeRVEB8eKOHcYi1BWzMG_S-ItdMBj8lU8UtZ21plcxc7rJUe6hO4bLh3O1vaU4_gCS0EZbD2p-E7-l18WNMs40XybmNH4kjtmI8if8i720DBMUiy0-eHB0ocnmri2sN8aA0sQzWEbpKJ8fcQENEeBdQimyKDQkmQ4lUc8yrqscUs8_MfqaT3kat-lhiEKu4B2CvtHs_9ucMjDuvnTUNdXu", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "authorization", + "value": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InNrMDcxMTIwMjEifQ.eyJ1c2VySWQiOjEsImlzUmVmcmVzaFRva2VuIjp0cnVlLCJpYXQiOjE2NjY4MTk1MTUsImV4cCI6MTY2NzY4MzUxNSwiYXVkIjpbImRldlUtYXBpIiwiZGV2VS1jbGllbnQiXSwiaXNzIjoiZGV2VS1hdXRoIiwic3ViIjoiMSJ9.v-fWfekwbQwS5baoV384bBVVE4c3PoJLnfqr_oCrsgANR5MneI6Fs05Ek3dowRGWTL-VPBHq_pFBeF93dGkHwjoOF2Rs-1gzmsz0suTZUrmb0Nw7V3cHeppKfnPDjrmReDvESAEEQ3aTmX1TzvNbe_hEwBqrBtzdrbn456MbIOjJJuXlrL2J_m3wEe1_OW9ijg9wYf603g_6mWHbrc7B-71ZoVE4nNw3wEAAL_aHuFcqgOsyIyN6jmF4ItdVbHt9gUtpG7d694CLKzmyByVhhk356-sXJ2HVJaivl-jkkWxeRVEB8eKOHcYi1BWzMG_S-ItdMBj8lU8UtZ21plcxc7rJUe6hO4bLh3O1vaU4_gCS0EZbD2p-E7-l18WNMs40XybmNH4kjtmI8if8i720DBMUiy0-eHB0ocnmri2sN8aA0sQzWEbpKJ8fcQENEeBdQimyKDQkmQ4lUc8yrqscUs8_MfqaT3kat-lhiEKu4B2CvtHs_9ucMjDuvnTUNdXu", + "type": "string" + } + ] +} \ No newline at end of file diff --git a/docs/localAuth.md b/docs/localAuth.md index 6dcd7595..978990f3 100644 --- a/docs/localAuth.md +++ b/docs/localAuth.md @@ -2,7 +2,7 @@ ## Enabling Developer Auth -By default (aka in the `default.yml.template` file) developer auth is enabled. If you don't care how that works you can just use the config as is and you should be good to go. (It'll look something like this) +By default (aka in the `config/default.yml.template` file) developer auth is enabled. If you don't care how that works you can just use the config as is and you should be good to go. (It'll look something like this) ```yaml providers: diff --git a/docs/postman-setup.md b/docs/postman-setup.md index de563696..49bac695 100644 --- a/docs/postman-setup.md +++ b/docs/postman-setup.md @@ -1,16 +1,14 @@ # Postman Setup -[JSON configuration file for Postman](https://www.getpostman.com/collections/b817928ddd3489a9f8a4) - Postman is a great tool for testing API endpoints. The link above is a configuration file that will help setup the basic configuration for working with most of the basic endpoints. ### Get Started 1. Install/Open Postman -2. Copy JSON configuration file link -3. Select `Import > Link` -4. Paste the link, click continue, and then click `Import` +2. Copy JSON configuration file `./devU.postman_collection.json` +3. Select `Import > File` +4. Open the file, select both collections, and click `Import` ### Setup Auth From a7536dc66607998f013097d9d47770f4916054ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Dec 2022 06:05:13 +0000 Subject: [PATCH 37/37] build(deps): bump jsonwebtoken from 8.5.1 to 9.0.0 Bumps [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) from 8.5.1 to 9.0.0. - [Release notes](https://github.com/auth0/node-jsonwebtoken/releases) - [Changelog](https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md) - [Commits](https://github.com/auth0/node-jsonwebtoken/compare/v8.5.1...v9.0.0) --- updated-dependencies: - dependency-name: jsonwebtoken dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 112 +++++++++++++++------------------------------- package.json | 2 +- 2 files changed, 37 insertions(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4867dda6..6b7162f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "express": "^4.17.1", "express-validator": "^6.11.1", "helmet": "^4.6.0", - "jsonwebtoken": "^8.5.1", + "jsonwebtoken": "^9.0.0", "morgan": "^1.10.0", "passport": "^0.6.0", "passport-saml": "^3.2.2", @@ -7264,29 +7264,38 @@ } }, "node_modules/jsonwebtoken": { - "version": "8.5.1", - "license": "MIT", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", "dependencies": { "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", + "lodash": "^4.17.21", "ms": "^2.1.1", - "semver": "^5.6.0" + "semver": "^7.3.8" }, "engines": { - "node": ">=4", - "npm": ">=1.4.28" + "node": ">=12", + "npm": ">=6" } }, "node_modules/jsonwebtoken/node_modules/ms": { "version": "2.1.3", "license": "MIT" }, + "node_modules/jsonwebtoken/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/jwa": { "version": "1.4.1", "license": "MIT", @@ -7510,42 +7519,14 @@ "version": "4.4.2", "license": "MIT" }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "license": "MIT" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "license": "MIT" - }, "node_modules/lodash.isequal": { "version": "4.5.0", "license": "MIT" }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "license": "MIT" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "license": "MIT" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "license": "MIT" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "license": "MIT" - }, "node_modules/lodash.mergewith": { "version": "4.6.2", "license": "MIT" }, - "node_modules/lodash.once": { - "version": "4.1.1", - "license": "MIT" - }, "node_modules/log-symbols": { "version": "4.1.0", "dev": true, @@ -7703,7 +7684,6 @@ }, "node_modules/lru-cache": { "version": "6.0.0", - "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -9985,7 +9965,6 @@ }, "node_modules/yallist": { "version": "4.0.0", - "dev": true, "license": "ISC" }, "node_modules/yaml": { @@ -14816,22 +14795,26 @@ } }, "jsonwebtoken": { - "version": "8.5.1", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", "requires": { "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", + "lodash": "^4.17.21", "ms": "^2.1.1", - "semver": "^5.6.0" + "semver": "^7.3.8" }, "dependencies": { "ms": { "version": "2.1.3" + }, + "semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "requires": { + "lru-cache": "^6.0.0" + } } } }, @@ -14980,33 +14963,12 @@ "lodash.get": { "version": "4.4.2" }, - "lodash.includes": { - "version": "4.3.0" - }, - "lodash.isboolean": { - "version": "3.0.3" - }, "lodash.isequal": { "version": "4.5.0" }, - "lodash.isinteger": { - "version": "4.0.4" - }, - "lodash.isnumber": { - "version": "3.0.3" - }, - "lodash.isplainobject": { - "version": "4.0.6" - }, - "lodash.isstring": { - "version": "4.0.1" - }, "lodash.mergewith": { "version": "4.6.2" }, - "lodash.once": { - "version": "4.1.1" - }, "log-symbols": { "version": "4.1.0", "dev": true, @@ -15104,7 +15066,6 @@ }, "lru-cache": { "version": "6.0.0", - "dev": true, "requires": { "yallist": "^4.0.0" } @@ -16516,8 +16477,7 @@ "version": "5.0.8" }, "yallist": { - "version": "4.0.0", - "dev": true + "version": "4.0.0" }, "yaml": { "version": "2.0.0-1" diff --git a/package.json b/package.json index 88330291..f0b0149f 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "express": "^4.17.1", "express-validator": "^6.11.1", "helmet": "^4.6.0", - "jsonwebtoken": "^8.5.1", + "jsonwebtoken": "^9.0.0", "morgan": "^1.10.0", "passport": "^0.6.0", "passport-saml": "^3.2.2",