🎁 feat: request to add course

This commit is contained in:
ysandler 2020-09-14 22:29:53 -05:00 committed by Joshua Shoemaker
parent 5db1e18bef
commit 3650c76175
14 changed files with 177 additions and 353 deletions

22
package-lock.json generated
View File

@ -32,15 +32,6 @@
"@types/node": "*"
}
},
"@types/dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/@types/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kGnGGipAWR7kw==",
"dev": true,
"requires": {
"dotenv": "*"
}
},
"@types/express": {
"version": "4.17.8",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.8.tgz",
@ -137,6 +128,14 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"axios": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
"integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"bl": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz",
@ -315,6 +314,11 @@
"unpipe": "~1.0.0"
}
},
"follow-redirects": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",

View File

@ -12,6 +12,7 @@
"author": "Joshua Shoemaker",
"license": "ISC",
"dependencies": {
"axios": "^0.20.0",
"body-parser": "^1.19.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",

View File

@ -0,0 +1,20 @@
import * as mongoose from 'mongoose'
const CourseRequestSchema = new mongoose.Schema({
contactName: {
type: String,
required: true
},
email: {
type: String,
required: true
},
githubRepo: {
type: String,
required: true
}
})
const CourseRequestDbModel = mongoose.model('RequestCourse', CourseRequestSchema)
export default CourseRequestDbModel

View File

@ -1,20 +1,39 @@
import * as express from 'express'
import CourseDbModel from '../DbModels/CourseDbModel'
import CourseRequestDbModel from '../DbModels/CourseRequestDbModel'
const router: express.Router = express.Router()
router.get('/', (request, response) => {
response.send({ message: 'Hello Api!' })
})
router.get('/courses', async (request, response) => {
try {
const courses = await CourseDbModel.find()
response.send(courses)
return
} catch (err) {
console.log(err)
response.send('Error finding')
return
}
})
router.post('/requestCourse', async (request, response) => {
const { contactName, email, githubRepo } = request.body
let responseToClient = {
status: 'ERR',
messages: ['Could not save Add Course Request']
}
try {
const createDocuimentResponse = await CourseRequestDbModel.create({ contactName, email, githubRepo })
if (createDocuimentResponse._id) {
responseToClient.status = 'OK'
responseToClient.messages = ['Add Courese Requested']
}
} catch (err) {
console.log(err)
}
response.send(responseToClient)
})
export default router

View File

@ -21,7 +21,7 @@ class Server {
this.app.use('/api', apiRouter)
}
async connectToDatabase () {
connectToDatabase () {
mongoose.connect(process.env.DBCONNECTION, {
useCreateIndex: true,
useNewUrlParser: true,

327
web/package-lock.json generated
View File

@ -1756,11 +1756,6 @@
"jest-diff": "^24.3.0"
}
},
"@types/js-cookie": {
"version": "2.2.6",
"resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-2.2.6.tgz",
"integrity": "sha512-+oY0FDTO2GYKEV0YPvSshGq9t7YozVkgvXLty7zogQNuCxBhT9/3INX9Q7H1aRZ4SUDRXAKlJuA4EA5nTt7SNw=="
},
"@types/json-schema": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
@ -2132,11 +2127,6 @@
"@xtuc/long": "4.2.2"
}
},
"@xobotyi/scrollbar-width": {
"version": "1.9.5",
"resolved": "https://registry.npmjs.org/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz",
"integrity": "sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ=="
},
"@xtuc/ieee754": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@ -2566,6 +2556,14 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz",
"integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA=="
},
"axios": {
"version": "0.20.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
"integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"axobject-query": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
@ -3136,11 +3134,6 @@
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"bowser": {
"version": "1.9.4",
"resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.4.tgz",
"integrity": "sha512-9IdMmj2KjigRq6oWhmwv1W36pDuA4STQZ8q6YO9um+x07xgYNCD3Oou+WP/3L1HNz7iqythGet3/p4wvc8AAwQ=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@ -3914,14 +3907,6 @@
"resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
},
"copy-to-clipboard": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz",
"integrity": "sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==",
"requires": {
"toggle-selection": "^1.0.6"
}
},
"core-js": {
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz",
@ -4117,15 +4102,6 @@
}
}
},
"css-in-js-utils": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/css-in-js-utils/-/css-in-js-utils-2.0.1.tgz",
"integrity": "sha512-PJF0SpJT+WdbVVt0AOYp9C8GnuruRlL/UFW7932nLWmFLQTaWEzTBQEx7/hn4BuV+WON75iAViSUJLiU3PKbpA==",
"requires": {
"hyphenate-style-name": "^1.0.2",
"isobject": "^3.0.1"
}
},
"css-loader": {
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/css-loader/-/css-loader-3.4.2.tgz",
@ -4415,11 +4391,6 @@
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ="
},
"deepmerge": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg=="
},
"default-gateway": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz",
@ -4901,14 +4872,6 @@
"is-arrayish": "^0.2.1"
}
},
"error-stack-parser": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.6.tgz",
"integrity": "sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ==",
"requires": {
"stackframe": "^1.1.1"
}
},
"es-abstract": {
"version": "1.18.0-next.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz",
@ -5827,16 +5790,6 @@
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
},
"fast-shallow-equal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-shallow-equal/-/fast-shallow-equal-1.0.0.tgz",
"integrity": "sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw=="
},
"fastest-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fastest-stable-stringify/-/fastest-stable-stringify-1.0.1.tgz",
"integrity": "sha1-kSLUBtTJ2YvqZEpraFPVh0uHsCg="
},
"faye-websocket": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz",
@ -6668,11 +6621,6 @@
"resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM="
},
"hyphenate-style-name": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
"integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@ -6790,15 +6738,6 @@
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
},
"inline-style-prefixer": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/inline-style-prefixer/-/inline-style-prefixer-4.0.2.tgz",
"integrity": "sha512-N8nVhwfYga9MiV9jWlwfdj1UDIaZlBFu4cJSJkIr7tZX7sHpHhGR5su1qdpW+7KPL8ISTvCIkcaFi/JdBknvPg==",
"requires": {
"bowser": "^1.7.3",
"css-in-js-utils": "^2.0.0"
}
},
"inquirer": {
"version": "7.3.3",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz",
@ -7794,11 +7733,6 @@
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
"integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
},
"js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -8027,11 +7961,6 @@
"strip-bom": "^3.0.0"
}
},
"load-script": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/load-script/-/load-script-1.0.0.tgz",
"integrity": "sha1-BJGTngvuVkPuSUp+PaPSuscMbKQ="
},
"loader-fs-cache": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/loader-fs-cache/-/loader-fs-cache-1.0.3.tgz",
@ -8571,28 +8500,6 @@
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
},
"nano-css": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/nano-css/-/nano-css-5.3.0.tgz",
"integrity": "sha512-uM/9NGK9/E9/sTpbIZ/bQ9xOLOIHZwrrb/CRlbDHBU/GFS7Gshl24v/WJhwsVViWkpOXUmiZ66XO7fSB4Wd92Q==",
"requires": {
"css-tree": "^1.0.0-alpha.28",
"csstype": "^2.5.5",
"fastest-stable-stringify": "^1.0.1",
"inline-style-prefixer": "^4.0.0",
"rtl-css-js": "^1.9.0",
"sourcemap-codec": "^1.4.1",
"stacktrace-js": "^2.0.0",
"stylis": "3.5.0"
},
"dependencies": {
"csstype": {
"version": "2.6.13",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.13.tgz",
"integrity": "sha512-ul26pfSQTZW8dcOnD2iiJssfXw0gdNVX9IJDH/X3K5DGPfj+fUYe3kB+swUY6BF3oZDxaID3AJt+9/ojSAE05A=="
}
}
},
"nanomatch": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
@ -9218,14 +9125,6 @@
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
},
"p4-css": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/p4-css/-/p4-css-1.5.1.tgz",
"integrity": "sha512-CRyakHYb77Hw9UbMdZ/nQi/roS9C9ahvl5FfCKUhVPtpCcTyOnYNwtFQ8VgcBXybT3nwil61TE/ujH6b5kNDDg==",
"requires": {
"nano-css": "^5.3.0"
}
},
"pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
@ -10894,59 +10793,16 @@
"scheduler": "^0.19.1"
}
},
"react-embed": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/react-embed/-/react-embed-3.3.2.tgz",
"integrity": "sha512-McwDWAZIKRW/HdPyz1znAzDym1EL+lC/9Zdx+gWq8dwRL89jNUcGZ7lIiLNWZt8EE1tUhLgpdoIDZ6bOTkAb4Q==",
"requires": {
"p4-css": "^1.5.1",
"react-instagram-embed": "^1.5.0",
"react-player": "^1.15.3",
"react-simple-player": "^1.0.3",
"react-youtube": "^7.11.2",
"scriptjs": "^2.5.9"
}
},
"react-error-overlay": {
"version": "6.0.7",
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.7.tgz",
"integrity": "sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA=="
},
"react-instagram-embed": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/react-instagram-embed/-/react-instagram-embed-1.5.0.tgz",
"integrity": "sha512-8HGBHjK4k6xJjActGLll22TCE8G9GI6aIlb7r8UJB9MYMnJpk15SuAQOoAeujb4pkOQGlWgfU3TW7R+97dp8mg==",
"requires": {
"query-string": "^5.1.1"
},
"dependencies": {
"query-string": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz",
"integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==",
"requires": {
"decode-uri-component": "^0.2.0",
"object-assign": "^4.1.0",
"strict-uri-encode": "^1.0.0"
}
}
}
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"react-player": {
"version": "1.15.3",
"resolved": "https://registry.npmjs.org/react-player/-/react-player-1.15.3.tgz",
"integrity": "sha512-8fc0R1AipFIy7l4lKgnIg+gMU2IY32ZMxxBlINjXAq/YnN3HUP3hOaE+aQ0lQv+a1/MMZgbekWD86ZGDO7kB8g==",
"requires": {
"deepmerge": "^4.0.0",
"load-script": "^1.0.0",
"prop-types": "^15.7.2"
}
},
"react-popper": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/react-popper/-/react-popper-1.3.7.tgz",
@ -11021,51 +10877,6 @@
"workbox-webpack-plugin": "4.3.1"
}
},
"react-simple-player": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/react-simple-player/-/react-simple-player-1.0.3.tgz",
"integrity": "sha512-o1/AMini1xcSaaetXbEVA3JUOh3MVSC7K9NRn9I8UVcsx57lIIkM7uPxqCaFX0jszRavwkNixAeXioTmNLtkIQ==",
"requires": {
"p4-css": "^1.5.1",
"react-use": "^14.2.0"
}
},
"react-universal-interface": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/react-universal-interface/-/react-universal-interface-0.6.2.tgz",
"integrity": "sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw=="
},
"react-use": {
"version": "14.3.0",
"resolved": "https://registry.npmjs.org/react-use/-/react-use-14.3.0.tgz",
"integrity": "sha512-Jx7Zl0k8dHA0UKpTVwYUThC5/V+Dt6JzCGiMHPNIhsxJGkiKuB1AQ7J7pNq4zj3l37ABd/RF+jRGThw0czrJXA==",
"requires": {
"@types/js-cookie": "2.2.6",
"@xobotyi/scrollbar-width": "1.9.5",
"copy-to-clipboard": "^3.2.0",
"fast-deep-equal": "^3.1.1",
"fast-shallow-equal": "^1.0.0",
"js-cookie": "^2.2.1",
"nano-css": "^5.2.1",
"react-universal-interface": "^0.6.0",
"resize-observer-polyfill": "^1.5.1",
"screenfull": "^5.0.0",
"set-harmonic-interval": "^1.0.1",
"throttle-debounce": "^2.1.0",
"ts-easing": "^0.2.0",
"tslib": "^1.10.0"
}
},
"react-youtube": {
"version": "7.12.0",
"resolved": "https://registry.npmjs.org/react-youtube/-/react-youtube-7.12.0.tgz",
"integrity": "sha512-26ARkEJlTnS4xLSbxvSf/SFYq76x9n+u8YQHwPn5EEd/LOA09uq+TOl0R2ren7U02BsPSZQq+MIZY/XUYzhYng==",
"requires": {
"fast-deep-equal": "3.1.3",
"prop-types": "15.7.2",
"youtube-player": "5.5.2"
}
},
"read-pkg": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
@ -11367,11 +11178,6 @@
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"resolve": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",
@ -11535,14 +11341,6 @@
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
"integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA=="
},
"rtl-css-js": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/rtl-css-js/-/rtl-css-js-1.14.0.tgz",
"integrity": "sha512-Dl5xDTeN3e7scU1cWX8c9b6/Nqz3u/HgR4gePc1kWXYiQWVQbKCEyK6+Hxve9LbcJ5EieHy1J9nJCN3grTtGwg==",
"requires": {
"@babel/runtime": "^7.1.2"
}
},
"run-async": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
@ -11672,16 +11470,6 @@
"ajv-keywords": "^3.5.2"
}
},
"screenfull": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.0.2.tgz",
"integrity": "sha512-cCF2b+L/mnEiORLN5xSAz6H3t18i2oHh9BA8+CQlAh5DRw2+NFAGQJOSYbcGw8B2k04g/lVvFcfZ83b3ysH5UQ=="
},
"scriptjs": {
"version": "2.5.9",
"resolved": "https://registry.npmjs.org/scriptjs/-/scriptjs-2.5.9.tgz",
"integrity": "sha512-qGVDoreyYiP1pkQnbnFAUIS5AjenNwwQBdl7zeos9etl+hYKWahjRTfzAZZYBv5xNHx7vNKCmaLDQZ6Fr2AEXg=="
},
"select-hose": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
@ -11847,11 +11635,6 @@
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"set-harmonic-interval": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/set-harmonic-interval/-/set-harmonic-interval-1.0.1.tgz",
"integrity": "sha512-AhICkFV84tBP1aWqPwLZqFvAwqEoVA9kxNMniGEUvzOlm4vLmOFLiTT3UZ6bziJTy4bOVpzWGTfSCbmaayGx8g=="
},
"set-value": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
@ -11975,11 +11758,6 @@
}
}
},
"sister": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/sister/-/sister-3.0.2.tgz",
"integrity": "sha512-p19rtTs+NksBRKW9qn0UhZ8/TUI9BPw9lmtHny+Y3TinWlOa9jWh9xB0AtPSdmOy49NJJJSSe0Ey4C7h0TrcYA=="
},
"sisteransi": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
@ -12204,11 +11982,6 @@
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM="
},
"sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
},
"spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
@ -12305,50 +12078,11 @@
"resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz",
"integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w=="
},
"stack-generator": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.5.tgz",
"integrity": "sha512-/t1ebrbHkrLrDuNMdeAcsvynWgoH/i4o8EGGfX7dEYDoTXOYVAkEpFdtshlvabzc6JlJ8Kf9YdFEoz7JkzGN9Q==",
"requires": {
"stackframe": "^1.1.1"
}
},
"stack-utils": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz",
"integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA=="
},
"stackframe": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.2.0.tgz",
"integrity": "sha512-GrdeshiRmS1YLMYgzF16olf2jJ/IzxXY9lhKOskuVziubpTYcYqyOwYeJKzQkwy7uN0fYSsbsC4RQaXf9LCrYA=="
},
"stacktrace-gps": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/stacktrace-gps/-/stacktrace-gps-3.0.4.tgz",
"integrity": "sha512-qIr8x41yZVSldqdqe6jciXEaSCKw1U8XTXpjDuy0ki/apyTn/r3w9hDAAQOhZdxvsC93H+WwwEu5cq5VemzYeg==",
"requires": {
"source-map": "0.5.6",
"stackframe": "^1.1.1"
},
"dependencies": {
"source-map": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz",
"integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI="
}
}
},
"stacktrace-js": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-2.0.2.tgz",
"integrity": "sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg==",
"requires": {
"error-stack-parser": "^2.0.6",
"stack-generator": "^2.0.5",
"stacktrace-gps": "^3.0.4"
}
},
"static-extend": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@ -12723,11 +12457,6 @@
}
}
},
"stylis": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.0.tgz",
"integrity": "sha512-pP7yXN6dwMzAR29Q0mBrabPCe0/mNO1MSr93bhay+hcZondvMMTpeGyd8nbhYJdyperNT2DRxONQuUGcJr5iPw=="
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
@ -12943,11 +12672,6 @@
"resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz",
"integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo="
},
"throttle-debounce": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.3.0.tgz",
"integrity": "sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ=="
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
@ -13055,11 +12779,6 @@
"repeat-string": "^1.6.1"
}
},
"toggle-selection": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
"integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI="
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
@ -13082,11 +12801,6 @@
"punycode": "^2.1.0"
}
},
"ts-easing": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/ts-easing/-/ts-easing-0.2.0.tgz",
"integrity": "sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ=="
},
"ts-pnp": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.6.tgz",
@ -14348,31 +14062,6 @@
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
},
"youtube-player": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/youtube-player/-/youtube-player-5.5.2.tgz",
"integrity": "sha512-ZGtsemSpXnDky2AUYWgxjaopgB+shFHgXVpiJFeNB5nWEugpW1KWYDaHKuLqh2b67r24GtP6HoSW5swvf0fFIQ==",
"requires": {
"debug": "^2.6.6",
"load-script": "^1.0.0",
"sister": "^3.0.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
}
}
}

View File

@ -10,6 +10,7 @@
"@types/node": "^12.12.58",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"axios": "^0.20.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3",

View File

@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
content="brightScreen is a VS Code Extension for interactive code challenges created by independent instructors."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--

View File

@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "brightScreen",
"name": "brightScreen Interactive Challenges",
"icons": [
{
"src": "favicon.ico",

View File

@ -0,0 +1,14 @@
import AddCourseRequestInterface from '../Interfaces/AddCourseRequestInterface'
import axios from 'axios'
class RequestCourseController {
async handleAddCourseRequest (props: AddCourseRequestInterface) {
const addCourseRequestResponse = await axios.post('/api/requestCourse', props)
if (!props.contactName || !props.email || !props.githubRepo) return { status: 'ERR', messages: ['Not all required data was provided.'] }
return addCourseRequestResponse.data
}
}
export default RequestCourseController

View File

@ -0,0 +1,7 @@
interface AddCourseRequestInterface {
contactName: string,
email: string,
githubRepo: string,
}
export default AddCourseRequestInterface

View File

@ -38,4 +38,8 @@
.courseListSubheader {
color: aqua;
}
.courseInput {
margin-top: 26px;
}

View File

@ -1,24 +1,36 @@
import React, { Component } from 'react'
import 'semantic-ui-css/semantic.min.css'
import { Button, Header, Image, List, Segment, Icon, Modal, Input } from 'semantic-ui-react'
import logo from '../../media/logoBlue.svg'
import './Home.css'
import logo from '../../media/logoBlue.svg'
import { Button, Header, Image, List, Segment, Icon } from 'semantic-ui-react'
interface CourseInterface {
name: string,
repo: string,
username: string,
link: string
}
import CourseInterface from '../Interfaces/CourseInterface'
import RequestCourseController from '../../Controllers/RequestCourseController'
type HomeProps = {}
type HomeState = { courses: CourseInterface[] }
type HomeState = {
courses: CourseInterface[],
requestAddCourseFormOpen: boolean,
githubRepo: string,
contactName: string,
email: string
}
class Home extends Component<HomeProps, HomeState> {
requestCourseController: RequestCourseController
constructor (props = {}) {
super(props)
this.state = {courses: []}
this.state = {
courses: [],
requestAddCourseFormOpen: false,
githubRepo: '',
contactName: '',
email: ''
}
this.requestCourseController = new RequestCourseController()
}
async componentDidMount () {
@ -26,7 +38,22 @@ class Home extends Component<HomeProps, HomeState> {
this.setState({courses: courses})
}
getCourseElements (courses: CourseInterface[]) {
setOpen (value: boolean) {
this.setState({ requestAddCourseFormOpen: value })
}
async submitCourse () {
const { email, contactName, githubRepo } = this.state
const addCourseResponse = await this.requestCourseController.handleAddCourseRequest({ email, contactName, githubRepo })
if (addCourseResponse.status === 'OK') {
window.alert(addCourseResponse.messages[0])
this.setOpen(false)
} else {
window.alert(addCourseResponse.messages[0])
}
}
renderCourseElements (courses: CourseInterface[]) {
if (!courses) return []
const coureseElements = courses.map((c: CourseInterface ) => {
@ -61,8 +88,8 @@ class Home extends Component<HomeProps, HomeState> {
<section>
<Segment className='homeInfoColumn'>
brightScreen is an extention for your favorite text editor (as long as your text
editor is VS Code) that brings interactive coding tutorials to help bring a new
brightScreen is an extention for your favorite text editor (as long as your favorite
editor is VS Code) that brings interactive coding challenges to help bring a new
dynamic to learning. Instead of just following along with an article or video,
you can download coding challanges that help solidify those theoretical lessons
into something tangible.
@ -83,15 +110,45 @@ class Home extends Component<HomeProps, HomeState> {
<Icon name='code' />
<Header.Content>
Current Courses
<Header.Subheader><Button fluid basic href='mailto:joshua@jshoemaker.dev' as='a'>Contact to Add Course</Button></Header.Subheader>
<Header.Subheader>
<Modal
className='requestAddCourseForm'
onClose={() => this.setOpen(false)}
onOpen={() => this.setOpen(true)}
open={this.state.requestAddCourseFormOpen}
trigger={<Button fluid basic >Request to Add Course</Button>}
>
<Modal.Header>Add Course to Waitlist</Modal.Header>
<Modal.Content>
<Modal.Description>
We wish to verify every course submission to make sure it meets our standards.
Enter all the details below and we will varify it as quickly as possible.
</Modal.Description>
<Input className='courseInput' fluid label='Course Name' onChange={(e) => this.setState({contactName: e.target.value})}></Input>
<Input className='courseInput' fluid label='Contact Email' onChange={(e) => this.setState({email: e.target.value})}></Input>
<Input className='courseInput' fluid label='GitHub Repo' onChange={(e) => this.setState({githubRepo: e.target.value})}></Input>
</Modal.Content>
<Modal.Actions>
<Button basic onClick={() => this.setOpen(false)}>Later</Button>
<Button
positive
onClick={() => {this.submitCourse()}}
style={{ backgroundColor: 'rgb(102,252,241)', color: 'black' }}
>
Submit
</Button>
</Modal.Actions>
</Modal>
</Header.Subheader>
</Header.Content>
</Header>
<List divided relaxed>
{ this.getCourseElements(this.state.courses)}
{ this.renderCourseElements(this.state.courses)}
</List>
</Segment>
</section>
</div>
)
}

View File

@ -0,0 +1,8 @@
interface CourseInterface {
name: string,
repo: string,
username: string,
link: string
}
export default CourseInterface