From a94cf201ddf5f0425cb19fb112568ca132b2f140 Mon Sep 17 00:00:00 2001 From: sohamsshah Date: Tue, 15 Mar 2022 00:37:45 +0530 Subject: [PATCH 1/3] update video library --- .../package.json | 3 +-- .../template.json | 13 ++++-------- .../template/{.gitignore => gitignore} | 0 .../src/backend/controllers/AuthController.js | 16 +++++--------- .../template/src/backend/db/users.js | 21 +------------------ .../template/src/backend/utils/authUtils.js | 4 ++-- 6 files changed, 13 insertions(+), 44 deletions(-) rename apps/cra-template-mockbee-video-library/template/{.gitignore => gitignore} (100%) diff --git a/apps/cra-template-mockbee-video-library/package.json b/apps/cra-template-mockbee-video-library/package.json index 99d25fc..b9a895e 100644 --- a/apps/cra-template-mockbee-video-library/package.json +++ b/apps/cra-template-mockbee-video-library/package.json @@ -1,7 +1,6 @@ { "name": "cra-template-mockbee-video-library", - "version": "0.1.0", - "private": true, + "version": "1.0.0", "main": "template.json", "files": [ "template", diff --git a/apps/cra-template-mockbee-video-library/template.json b/apps/cra-template-mockbee-video-library/template.json index 39a524d..b9b5ca6 100644 --- a/apps/cra-template-mockbee-video-library/template.json +++ b/apps/cra-template-mockbee-video-library/template.json @@ -1,17 +1,12 @@ { "package": { "dependencies": { - "@testing-library/jest-dom": "^5.11.6", - "@testing-library/react": "^11.2.2", - "@testing-library/user-event": "^12.6.0", - "axios": "^0.21.4", - "bcryptjs": "^2.4.3", "dayjs": "^1.10.7", - "jsonwebtoken": "^8.5.1", + "jwt-decode": "^3.1.2", + "jwt-encode": "^1.0.1", "miragejs": "^0.1.41", - "uuid": "^8.3.2", - "web-vitals": "^0.2.4", - "yarn": "^1.22.10" + "mockman-js": "^1.0.5", + "uuid": "^8.3.2" }, "scripts": { "start": "react-scripts start", diff --git a/apps/cra-template-mockbee-video-library/template/.gitignore b/apps/cra-template-mockbee-video-library/template/gitignore similarity index 100% rename from apps/cra-template-mockbee-video-library/template/.gitignore rename to apps/cra-template-mockbee-video-library/template/gitignore diff --git a/apps/cra-template-mockbee-video-library/template/src/backend/controllers/AuthController.js b/apps/cra-template-mockbee-video-library/template/src/backend/controllers/AuthController.js index 7a98906..8f8aaed 100644 --- a/apps/cra-template-mockbee-video-library/template/src/backend/controllers/AuthController.js +++ b/apps/cra-template-mockbee-video-library/template/src/backend/controllers/AuthController.js @@ -1,9 +1,7 @@ import { v4 as uuid } from "uuid"; import { Response } from "miragejs"; import { formatDate } from "../utils/authUtils"; -import bcrypt from "bcryptjs"; -const jwt = require("jsonwebtoken"); - +const sign = require("jwt-encode"); /** * All the routes related to Auth are present here. * These are Publicly accessible routes. @@ -30,11 +28,10 @@ export const signupHandler = function (schema, request) { ); } const _id = uuid(); - const encryptedPassword = bcrypt.hashSync(password, 5); const newUser = { _id, email, - password: encryptedPassword, + password, createdAt: formatDate(), updatedAt: formatDate(), ...rest, @@ -43,10 +40,7 @@ export const signupHandler = function (schema, request) { playlists: [], }; const createdUser = schema.users.create(newUser); - const encodedToken = jwt.sign( - { _id, email }, - process.env.REACT_APP_JWT_SECRET - ); + const encodedToken = sign({ _id, email }, process.env.REACT_APP_JWT_SECRET); return new Response(201, {}, { createdUser, encodedToken }); } catch (error) { return new Response( @@ -76,8 +70,8 @@ export const loginHandler = function (schema, request) { { errors: ["The email you entered is not Registered. Not Found error"] } ); } - if (bcrypt.compareSync(password, foundUser.password)) { - const encodedToken = jwt.sign( + if (password === foundUser.password) { + const encodedToken = sign( { _id: foundUser._id, email }, process.env.REACT_APP_JWT_SECRET ); diff --git a/apps/cra-template-mockbee-video-library/template/src/backend/db/users.js b/apps/cra-template-mockbee-video-library/template/src/backend/db/users.js index 8c010ed..5d904b3 100644 --- a/apps/cra-template-mockbee-video-library/template/src/backend/db/users.js +++ b/apps/cra-template-mockbee-video-library/template/src/backend/db/users.js @@ -1,5 +1,4 @@ import { v4 as uuid } from "uuid"; -import bcyrpt from "bcryptjs"; import { formatDate } from "../utils/authUtils"; /** * User Database can be added here. @@ -13,25 +12,7 @@ export const users = [ firstName: "Adarsh", lastName: "Balika", email: "adarshbalika@gmail.com", - password: bcyrpt.hashSync("adarshBalika123", 5), - createdAt: formatDate(), - updatedAt: formatDate(), - }, - { - _id: uuid(), - firstName: "Dhruvi", - lastName: "Shah", - email: "dhruvishah@gmail.com", - password: bcyrpt.hashSync("dhruviShah123", 5), - createdAt: formatDate(), - updatedAt: formatDate(), - }, - { - _id: uuid(), - firstName: "Shubham", - lastName: "Soni", - email: "shubhamsoni@gmail.com", - password: bcyrpt.hashSync("shubhamSoni123", 5), + password: "adarshBalika123", createdAt: formatDate(), updatedAt: formatDate(), }, diff --git a/apps/cra-template-mockbee-video-library/template/src/backend/utils/authUtils.js b/apps/cra-template-mockbee-video-library/template/src/backend/utils/authUtils.js index c25c453..59bcc03 100644 --- a/apps/cra-template-mockbee-video-library/template/src/backend/utils/authUtils.js +++ b/apps/cra-template-mockbee-video-library/template/src/backend/utils/authUtils.js @@ -1,10 +1,10 @@ import { Response } from "miragejs"; -const jwt = require("jsonwebtoken"); import dayjs from "dayjs"; +import jwt_decode from "jwt-decode"; export const requiresAuth = function (request) { const encodedToken = request.requestHeaders.authorization; - const decodedToken = jwt.verify( + const decodedToken = jwt_decode( encodedToken, process.env.REACT_APP_JWT_SECRET ); From 6ca60d72291cbdf0010dc96e2d77b0a1f8befa82 Mon Sep 17 00:00:00 2001 From: sohamsshah Date: Tue, 15 Mar 2022 00:38:42 +0530 Subject: [PATCH 2/3] feat: complete video library --- apps/video-library/package.json | 6 +- .../src/backend/controllers/AuthController.js | 16 +- apps/video-library/src/backend/db/users.js | 21 +- .../src/backend/utils/authUtils.js | 4 +- apps/video-library/yarn.lock | 260 +++++++++++++----- 5 files changed, 196 insertions(+), 111 deletions(-) diff --git a/apps/video-library/package.json b/apps/video-library/package.json index 0aaae4b..ff91955 100644 --- a/apps/video-library/package.json +++ b/apps/video-library/package.json @@ -7,13 +7,13 @@ "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "axios": "^0.21.4", - "bcryptjs": "^2.4.3", "dayjs": "^1.10.7", - "jsonwebtoken": "^8.5.1", + "jwt-decode": "^3.1.2", + "jwt-encode": "^1.0.1", "miragejs": "^0.1.41", + "mockman-js": "^1.0.5", "react": "^17.0.2", "react-dom": "^17.0.2", - "mockman-js": "^1.0.5", "react-scripts": "4.0.3", "uuid": "^8.3.2", "web-vitals": "^1.0.1" diff --git a/apps/video-library/src/backend/controllers/AuthController.js b/apps/video-library/src/backend/controllers/AuthController.js index 7a98906..8f8aaed 100644 --- a/apps/video-library/src/backend/controllers/AuthController.js +++ b/apps/video-library/src/backend/controllers/AuthController.js @@ -1,9 +1,7 @@ import { v4 as uuid } from "uuid"; import { Response } from "miragejs"; import { formatDate } from "../utils/authUtils"; -import bcrypt from "bcryptjs"; -const jwt = require("jsonwebtoken"); - +const sign = require("jwt-encode"); /** * All the routes related to Auth are present here. * These are Publicly accessible routes. @@ -30,11 +28,10 @@ export const signupHandler = function (schema, request) { ); } const _id = uuid(); - const encryptedPassword = bcrypt.hashSync(password, 5); const newUser = { _id, email, - password: encryptedPassword, + password, createdAt: formatDate(), updatedAt: formatDate(), ...rest, @@ -43,10 +40,7 @@ export const signupHandler = function (schema, request) { playlists: [], }; const createdUser = schema.users.create(newUser); - const encodedToken = jwt.sign( - { _id, email }, - process.env.REACT_APP_JWT_SECRET - ); + const encodedToken = sign({ _id, email }, process.env.REACT_APP_JWT_SECRET); return new Response(201, {}, { createdUser, encodedToken }); } catch (error) { return new Response( @@ -76,8 +70,8 @@ export const loginHandler = function (schema, request) { { errors: ["The email you entered is not Registered. Not Found error"] } ); } - if (bcrypt.compareSync(password, foundUser.password)) { - const encodedToken = jwt.sign( + if (password === foundUser.password) { + const encodedToken = sign( { _id: foundUser._id, email }, process.env.REACT_APP_JWT_SECRET ); diff --git a/apps/video-library/src/backend/db/users.js b/apps/video-library/src/backend/db/users.js index 0aa5206..5d904b3 100644 --- a/apps/video-library/src/backend/db/users.js +++ b/apps/video-library/src/backend/db/users.js @@ -1,5 +1,4 @@ import { v4 as uuid } from "uuid"; -import bcyrpt from "bcryptjs"; import { formatDate } from "../utils/authUtils"; /** * User Database can be added here. @@ -13,25 +12,7 @@ export const users = [ firstName: "Adarsh", lastName: "Balika", email: "adarshbalika@gmail.com", - password: bcyrpt.hashSync("adarshBalika123", 5), - createdAt: formatDate(), - updatedAt: formatDate(), - }, - { - _id: uuid(), - firstName: "John", - lastName: "Doe", - email: "johndoe@gmail.com", - password: bcyrpt.hashSync("johnDoe123", 5), - createdAt: formatDate(), - updatedAt: formatDate(), - }, - { - _id: uuid(), - firstName: "Adarsh", - lastName: "Balak", - email: "adarshbalak@gmail.com", - password: bcyrpt.hashSync("adarshBalaki123", 5), + password: "adarshBalika123", createdAt: formatDate(), updatedAt: formatDate(), }, diff --git a/apps/video-library/src/backend/utils/authUtils.js b/apps/video-library/src/backend/utils/authUtils.js index c25c453..59bcc03 100644 --- a/apps/video-library/src/backend/utils/authUtils.js +++ b/apps/video-library/src/backend/utils/authUtils.js @@ -1,10 +1,10 @@ import { Response } from "miragejs"; -const jwt = require("jsonwebtoken"); import dayjs from "dayjs"; +import jwt_decode from "jwt-decode"; export const requiresAuth = function (request) { const encodedToken = request.requestHeaders.authorization; - const decodedToken = jwt.verify( + const decodedToken = jwt_decode( encodedToken, process.env.REACT_APP_JWT_SECRET ); diff --git a/apps/video-library/yarn.lock b/apps/video-library/yarn.lock index 9d40945..44b955d 100644 --- a/apps/video-library/yarn.lock +++ b/apps/video-library/yarn.lock @@ -2371,7 +2371,7 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -asap@~2.0.6: +asap@~2.0.3, asap@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= @@ -2466,6 +2466,13 @@ axios@^0.21.4: dependencies: follow-redirects "^1.14.0" +axios@^0.24.0: + version "0.24.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6" + integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA== + dependencies: + follow-redirects "^1.14.4" + axobject-query@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be" @@ -2665,6 +2672,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base16@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/base16/-/base16-1.0.0.tgz#e297f60d7ec1014a7a971a39ebc8a98c0b681e70" + integrity sha1-4pf2DX7BAUp6lxo568ipjAtoHnA= + base64-js@^1.0.2: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -2688,11 +2700,6 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= -bcryptjs@^2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/bcryptjs/-/bcryptjs-2.4.3.tgz#9ab5627b93e60621ff7cdac5da9733027df1d0cb" - integrity sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms= - bfj@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/bfj/-/bfj-7.0.2.tgz#1988ce76f3add9ac2913fd8ba47aad9e651bfbb2" @@ -2903,11 +2910,6 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" -buffer-equal-constant-time@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" - integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= - buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" @@ -3530,6 +3532,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +cross-fetch@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" + integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== + dependencies: + node-fetch "2.6.7" + cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -4169,13 +4178,6 @@ duplexify@^3.4.2, duplexify@^3.6.0: readable-stream "^2.0.0" stream-shift "^1.0.0" -ecdsa-sig-formatter@1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" - integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== - dependencies: - safe-buffer "^5.0.1" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -4861,6 +4863,31 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fbemitter@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/fbemitter/-/fbemitter-3.0.0.tgz#00b2a1af5411254aab416cd75f9e6289bee4bff3" + integrity sha512-KWKaceCwKQU0+HPoop6gn4eOHk50bBv/VxjJtGMfwmJt3D29JpN4H4eisCtIPA+a8GVBam+ldMMpMjJUvpDyHw== + dependencies: + fbjs "^3.0.0" + +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs@^3.0.0, fbjs@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.4.tgz#e1871c6bd3083bac71ff2da868ad5067d37716c6" + integrity sha512-ucV0tDODnGV3JCnnkmoszb5lf4bNpzjv80K41wd4k798Etq+UYD0y0TIfalLjZoKgjive6/adkRnszwapiDgBQ== + dependencies: + cross-fetch "^3.1.5" + fbjs-css-vars "^1.0.0" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.30" + figgy-pudding@^3.5.1: version "3.5.2" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e" @@ -4987,11 +5014,24 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" +flux@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/flux/-/flux-4.0.3.tgz#573b504a24982c4768fdfb59d8d2ea5637d72ee7" + integrity sha512-yKAbrp7JhZhj6uiT1FTuVMlIAT1J4jqEyBpFApi1kxpGZCvacMVc/t1pMQyotqHhAgvoE3bNvAykhCo2CLjnYw== + dependencies: + fbemitter "^3.0.0" + fbjs "^3.0.1" + follow-redirects@^1.0.0, follow-redirects@^1.14.0: version "1.14.7" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685" integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== +follow-redirects@^1.14.4: + version "1.14.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" + integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -6738,22 +6778,6 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -jsonwebtoken@^8.5.1: - version "8.5.1" - resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d" - integrity sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w== - 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" - ms "^2.1.1" - semver "^5.6.0" - "jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.2.1.tgz#720b97bfe7d901b927d87c3773637ae8ea48781b" @@ -6762,22 +6786,17 @@ jsonwebtoken@^8.5.1: array-includes "^3.1.3" object.assign "^4.1.2" -jwa@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" - integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA== - dependencies: - buffer-equal-constant-time "1.0.1" - ecdsa-sig-formatter "1.0.11" - safe-buffer "^5.0.1" +jwt-decode@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59" + integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A== -jws@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" - integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== +jwt-encode@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/jwt-encode/-/jwt-encode-1.0.1.tgz#6602a0475f757c7d5d559a7e923f3d3d5ecd938c" + integrity sha512-QrGiNhynbAYyFdbC1GbjborzenSFs5Ga+2nE0uBokGXsH11xrgd1AX55HR7P+wGQyyZOn6LUO5iKlh74dlhBkA== dependencies: - jwa "^1.4.1" - safe-buffer "^5.0.1" + ts.cryptojs256 "^1.0.1" killable@^1.0.1: version "1.0.1" @@ -6953,6 +6972,11 @@ lodash.compact@^3.0.1: resolved "https://registry.yarnpkg.com/lodash.compact/-/lodash.compact-3.0.1.tgz#540ce3837745975807471e16b4a2ba21e7256ca5" integrity sha1-VAzjg3dFl1gHRx4WtKK6IeclbKU= +lodash.curry@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.curry/-/lodash.curry-4.1.1.tgz#248e36072ede906501d75966200a86dab8b23170" + integrity sha1-JI42By7ekGUB11lmIAqG2riyMXA= + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -6968,6 +6992,11 @@ lodash.flatten@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= +lodash.flow@^3.3.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/lodash.flow/-/lodash.flow-3.5.0.tgz#87bf40292b8cf83e4e8ce1a3ae4209e20071675a" + integrity sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o= + lodash.forin@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.forin/-/lodash.forin-4.4.0.tgz#5d3f20ae564011fbe88381f7d98949c9c9519731" @@ -6983,21 +7012,11 @@ lodash.has@^4.5.2: resolved "https://registry.yarnpkg.com/lodash.has/-/lodash.has-4.5.2.tgz#d19f4dc1095058cccbe2b0cdf4ee0fe4aa37c862" integrity sha1-0Z9NwQlQWMzL4rDN9O4P5Ko3yGI= -lodash.includes@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" - integrity sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8= - lodash.invokemap@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.invokemap/-/lodash.invokemap-4.6.0.tgz#1748cda5d8b0ef8369c4eb3ec54c21feba1f2d62" integrity sha1-F0jNpdiw74NpxOs+xUwh/rofLWI= -lodash.isboolean@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" - integrity sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY= - lodash.isempty@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" @@ -7018,21 +7037,11 @@ lodash.isinteger@^4.0.4: resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" integrity sha1-YZwK89A/iwTDH1iChAt3sRzWg0M= -lodash.isnumber@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" - integrity sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w= - lodash.isplainobject@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= -lodash.isstring@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" - integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= - lodash.lowerfirst@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/lodash.lowerfirst/-/lodash.lowerfirst-4.3.1.tgz#de3c7b12e02c6524a0059c2f6cb7c5c52655a13d" @@ -7058,11 +7067,6 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.once@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" - integrity sha1-DdOXEhPHxW34gJd9UEyI+0cal6w= - lodash.pick@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" @@ -7118,7 +7122,7 @@ loglevel@^1.6.8: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.0.tgz#e7ec73a57e1e7b419cb6c6ac06bf050b67356114" integrity sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA== -loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -7460,6 +7464,14 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mockman-js@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/mockman-js/-/mockman-js-1.0.5.tgz#9347b726606d565715a530f2fa11fefa660ef57f" + integrity sha512-fMQ4K7/M0j/UpfMpU3NNCKyJkuHDPxbJ11AIwn85BNnb3ktsKpAl3M5zXzNWHaBNcjpjySfNrJVpQfET7EVgKA== + dependencies: + axios "^0.24.0" + react-json-view "^1.21.3" + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -7567,6 +7579,13 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" +node-fetch@2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + node-forge@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" @@ -8956,6 +8975,13 @@ promise-inflight@^1.0.1: resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + promise@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/promise/-/promise-8.1.0.tgz#697c25c3dfe7435dd79fcd58c38a135888eaf05e" @@ -9058,6 +9084,11 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +pure-color@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/pure-color/-/pure-color-1.3.0.tgz#1fe064fb0ac851f0de61320a8bf796836422f33e" + integrity sha1-H+Bk+wrIUfDeYTIKi/eWg2Qi8z4= + q@^1.1.2: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -9150,6 +9181,16 @@ react-app-polyfill@^2.0.0: regenerator-runtime "^0.13.7" whatwg-fetch "^3.4.1" +react-base16-styling@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/react-base16-styling/-/react-base16-styling-0.6.0.tgz#ef2156d66cf4139695c8a167886cb69ea660792c" + integrity sha1-7yFW1mz0E5aVyKFniGy2nqZgeSw= + dependencies: + base16 "^1.0.0" + lodash.curry "^4.0.1" + lodash.flow "^3.3.0" + pure-color "^1.2.0" + react-dev-utils@^11.0.3: version "11.0.4" resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-11.0.4.tgz#a7ccb60257a1ca2e0efe7a83e38e6700d17aa37a" @@ -9204,6 +9245,21 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-json-view@^1.21.3: + version "1.21.3" + resolved "https://registry.yarnpkg.com/react-json-view/-/react-json-view-1.21.3.tgz#f184209ee8f1bf374fb0c41b0813cff54549c475" + integrity sha512-13p8IREj9/x/Ye4WI/JpjhoIwuzEgUAtgJZNBJckfzJt1qyh24BdTm6UQNGnyTq9dapQdrqvquZTo3dz1X6Cjw== + dependencies: + flux "^4.0.1" + react-base16-styling "^0.6.0" + react-lifecycles-compat "^3.0.4" + react-textarea-autosize "^8.3.2" + +react-lifecycles-compat@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" + integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== + react-refresh@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f" @@ -9275,6 +9331,15 @@ react-scripts@4.0.3: optionalDependencies: fsevents "^2.1.3" +react-textarea-autosize@^8.3.2: + version "8.3.3" + resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-8.3.3.tgz#f70913945369da453fd554c168f6baacd1fa04d8" + integrity sha512-2XlHXK2TDxS6vbQaoPbMOfQ8GK7+irc2fVK6QFIcC8GOnH3zI/v481n+j1L0WaPVvKxwesnY93fEfH++sus2rQ== + dependencies: + "@babel/runtime" "^7.10.2" + use-composed-ref "^1.0.0" + use-latest "^1.0.0" + react@^17.0.2: version "17.0.2" resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" @@ -9889,7 +9954,7 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: +setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= @@ -10697,6 +10762,11 @@ tr46@^2.1.0: dependencies: punycode "^2.1.1" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + tryer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" @@ -10707,6 +10777,11 @@ ts-pnp@1.2.0, ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== +ts.cryptojs256@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ts.cryptojs256/-/ts.cryptojs256-1.0.1.tgz#56a3d3a3bc022ad358b3e62cd8dae3224d9384f1" + integrity sha1-VqPTo7wCKtNYs+Ys2NrjIk2ThPE= + tsconfig-paths@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz#19769aca6ee8f6a1a341e38c8fa45dd9fb18899b" @@ -10813,6 +10888,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +ua-parser-js@^0.7.30: + version "0.7.31" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6" + integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ== + unbox-primitive@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" @@ -10957,6 +11037,23 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +use-composed-ref@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/use-composed-ref/-/use-composed-ref-1.2.1.tgz#9bdcb5ccd894289105da2325e1210079f56bf849" + integrity sha512-6+X1FLlIcjvFMAeAD/hcxDT8tmyrWnbSPMU0EnxQuDLIxokuFzWliXBiYZuGIx+mrAMLBw0WFfCkaPw8ebzAhw== + +use-isomorphic-layout-effect@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.1.tgz#7bb6589170cd2987a152042f9084f9effb75c225" + integrity sha512-L7Evj8FGcwo/wpbv/qvSfrkHFtOpCzvM5yl2KVyDJoylVuSvzphiiasmjgQPttIGBAy2WKiBNR98q8w7PiNgKQ== + +use-latest@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-latest/-/use-latest-1.2.0.tgz#a44f6572b8288e0972ec411bdd0840ada366f232" + integrity sha512-d2TEuG6nSLKQLAfW3By8mKr8HurOlTkul0sOpxbClIv4SQ4iOd7BYr7VIzdbktUCnv7dua/60xzd8igMU6jmyw== + dependencies: + use-isomorphic-layout-effect "^1.0.0" + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" @@ -11107,6 +11204,11 @@ web-vitals@^1.0.1: resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-1.1.2.tgz#06535308168986096239aa84716e68b4c6ae6d1c" integrity sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig== +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + webidl-conversions@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" @@ -11253,6 +11355,14 @@ whatwg-mimetype@^2.3.0: resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + whatwg-url@^8.0.0, whatwg-url@^8.5.0: version "8.7.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77" From d70ff26faac40bf12e9e3e7768a2ff18f03cde40 Mon Sep 17 00:00:00 2001 From: Saurabh Suthar Date: Wed, 23 Mar 2022 00:28:10 +0530 Subject: [PATCH 3/3] fix: getVideosFromPlaylistHandler fixed getVideosFromPlaylistHandler had a wrong check while finding the videos for a playlist. It was returning videos whose video id is not equal to playlist ID. So, just changed !== to ===. --- .../template/src/backend/controllers/PlaylistController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cra-template-mockbee-video-library/template/src/backend/controllers/PlaylistController.js b/apps/cra-template-mockbee-video-library/template/src/backend/controllers/PlaylistController.js index cf18033..f2fc142 100644 --- a/apps/cra-template-mockbee-video-library/template/src/backend/controllers/PlaylistController.js +++ b/apps/cra-template-mockbee-video-library/template/src/backend/controllers/PlaylistController.js @@ -89,7 +89,7 @@ export const getVideosFromPlaylistHandler = function (schema, request) { const user = requiresAuth.call(this, request); if (user) { const playlistId = request.params.playlistId; - const playlist = user.playlists.find((item) => item._id !== playlistId); + const playlist = user.playlists.find((item) => item._id === playlistId); return new Response(200, {}, { playlist }); } return new Response(