From 8cc92d0bd494f33e734436fd3cc8018833c8b792 Mon Sep 17 00:00:00 2001 From: AmiyahJo <86239804+AmiyahJo@users.noreply.github.com> Date: Tue, 24 Sep 2024 15:05:50 -0400 Subject: [PATCH 01/20] Create README.md Accidentally removed my work the 1st time by merging --- lesson_00/amiyahjones/README.md | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lesson_00/amiyahjones/README.md diff --git a/lesson_00/amiyahjones/README.md b/lesson_00/amiyahjones/README.md new file mode 100644 index 00000000..14fc62d7 --- /dev/null +++ b/lesson_00/amiyahjones/README.md @@ -0,0 +1,43 @@ +# Mya.README + ```Javascript +const Mya = class SoftwareEngineer { + intern(code, tools) { + self.code = Javascript, HTML, CSS, Java; + self.tools = React, Docker; + } +}; + +// Intrested in bringing ideas to life within a web browser. +// Learning how websites become quick, responsive, and accesssible to everyone. +``` + + + +### ☴ My work hours +9AM-5PM I'm an early bird and often begin the day with a head start of my work. Feel free to reach me by email during this time, and I'll get back to you as soon as I'm able! + +### What's the best way to communicate with me? .☘︎ ݁˖ +Private message through google chat works perfectly. Email works too as a follow up or if I happened to miss one of your messages. +> [!TIP] +> _In case I don't respond:_ Ping me again on google chat or send me another email! + +### I'd be happy to help you with ꒰ ﹍ ꒱ +* Code suggestions +* Explain or understand a code snippet +* Photos + design ideas + +## Extra ⓘ +* ✦ procreate artist ↓
+ - I like to combine my art and code together! + - In case you find me with my ipad, that's why +* visual learner
+* Jr Developer HS Intern for 4 years with Code Differently (youth program) +* No, I don't drink coffee. ~~Hot chocolate is my go to~~ + +> I'm the type of person that if you ask me a question and I don't know the answer, I'm gonna tell you that I don't know. But I bet you what, I know how to find the answer and I will find the answer.
- Will smith + + +###### // readme inspired by [Kaeti's repo][kaeti-repo] , code snippet inspired by [Thai Brega] + +[kaeti-repo]: https://github.com/kaeti/personal-readme +[Thai brega]: https://github.com/Thaiane/Thaiane From 50b18619d9de9203384f678c1e0eee84a70510a0 Mon Sep 17 00:00:00 2001 From: AmiyahJo <86239804+AmiyahJo@users.noreply.github.com> Date: Tue, 24 Sep 2024 15:07:22 -0400 Subject: [PATCH 02/20] Delete lesson_00/amiyahjones/README.md --- lesson_00/amiyahjones/README.md | 43 --------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 lesson_00/amiyahjones/README.md diff --git a/lesson_00/amiyahjones/README.md b/lesson_00/amiyahjones/README.md deleted file mode 100644 index 14fc62d7..00000000 --- a/lesson_00/amiyahjones/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Mya.README - ```Javascript -const Mya = class SoftwareEngineer { - intern(code, tools) { - self.code = Javascript, HTML, CSS, Java; - self.tools = React, Docker; - } -}; - -// Intrested in bringing ideas to life within a web browser. -// Learning how websites become quick, responsive, and accesssible to everyone. -``` - - - -### ☴ My work hours -9AM-5PM I'm an early bird and often begin the day with a head start of my work. Feel free to reach me by email during this time, and I'll get back to you as soon as I'm able! - -### What's the best way to communicate with me? .☘︎ ݁˖ -Private message through google chat works perfectly. Email works too as a follow up or if I happened to miss one of your messages. -> [!TIP] -> _In case I don't respond:_ Ping me again on google chat or send me another email! - -### I'd be happy to help you with ꒰ ﹍ ꒱ -* Code suggestions -* Explain or understand a code snippet -* Photos + design ideas - -## Extra ⓘ -* ✦ procreate artist ↓
- - I like to combine my art and code together! - - In case you find me with my ipad, that's why -* visual learner
-* Jr Developer HS Intern for 4 years with Code Differently (youth program) -* No, I don't drink coffee. ~~Hot chocolate is my go to~~ - -> I'm the type of person that if you ask me a question and I don't know the answer, I'm gonna tell you that I don't know. But I bet you what, I know how to find the answer and I will find the answer.
- Will smith - - -###### // readme inspired by [Kaeti's repo][kaeti-repo] , code snippet inspired by [Thai Brega] - -[kaeti-repo]: https://github.com/kaeti/personal-readme -[Thai brega]: https://github.com/Thaiane/Thaiane From 7f9536469ada5de81ce66fec0c1bfdfb71e9e542 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Mon, 14 Oct 2024 20:29:15 +0000 Subject: [PATCH 03/20] feat: add provider.java file feat: create a DateProvider implementation --- .../dataprovider/AmiyahJonesProvider.java | 46 ++++++++++ .../src/main/resources/data/amiyahjones.json | 92 +++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java create mode 100644 lesson_09/types/types_app/src/main/resources/data/amiyahjones.json diff --git a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java new file mode 100644 index 00000000..606d8ff8 --- /dev/null +++ b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java @@ -0,0 +1,46 @@ +package com.codedifferently.lesson9.dataprovider; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public abstract class AmiyahJonesProvider { + + public abstract String getProviderName(); + + public abstract Map getColumnTypeByName(); + + /** + * Given a list of data objects, returns the list with values converted to the appropriate type. + * + * @param data A list of data objects containing values keyed by column name. + * @return A new list with object values converted to the appropriate type. + */ + public List> parseData(List> data) throws Exception { + Map columnTypeByName = getColumnTypeByName(); + return data.stream().map(row -> parseRow(columnTypeByName, row)).collect(Collectors.toList()); + } + + /** + * Parses a single row of data using the provided column types mapping. + * + * @param columnTypeByName A map containing the type of a column keyed by its name. + * @param row A bag of values keyed by column name. + * @return A new list of data values converted to the appropriate type. + */ + private Map parseRow( + Map columnTypeByName, Map row) { + var parsedRow = new java.util.HashMap(); + row.forEach( + (key, value) -> { + Class type = columnTypeByName.get(key); + try { + parsedRow.put(key, type.getConstructor(String.class).newInstance(value)); + } catch (Exception e) { + throw new RuntimeException( + "Error parsing data for " + key + " as type " + type.getName()); + } + }); + return parsedRow; + } +} diff --git a/lesson_09/types/types_app/src/main/resources/data/amiyahjones.json b/lesson_09/types/types_app/src/main/resources/data/amiyahjones.json new file mode 100644 index 00000000..8342230e --- /dev/null +++ b/lesson_09/types/types_app/src/main/resources/data/amiyahjones.json @@ -0,0 +1,92 @@ +[ + { + "column1": "5731499272613477376", + "column2": "2002066591", + "column3": "vo591", + "column4": "false", + "column5": "11686", + "column6": "2.90396E38", + "column7": "7.899162733804963E307" + }, + { + "column1": "3629992685213369344", + "column2": "394292213", + "column3": "arxbjv", + "column4": "false", + "column5": "25971", + "column6": "3.3176412E38", + "column7": "1.422747221356426E307" + }, + { + "column1": "3634306241562193408", + "column2": "1759402995", + "column3": "rp95ft", + "column4": "true", + "column5": "15517", + "column6": "4.4703475E37", + "column7": "1.5779687820629317E308" + }, + { + "column1": "2268654800340631040", + "column2": "893983092", + "column3": "lfk8u", + "column4": "true", + "column5": "2526", + "column6": "2.8990186E38", + "column7": "7.688984742776194E307" + }, + { + "column1": "3054712055809444864", + "column2": "1143998344", + "column3": "rxbse3ki", + "column4": "false", + "column5": "24432", + "column6": "2.612388E36", + "column7": "5.274382911630398E307" + }, + { + "column1": "1352645309887328256", + "column2": "503833821", + "column3": "qbz6jdowfe", + "column4": "false", + "column5": "7617", + "column6": "1.9916393E38", + "column7": "3.3191786026811584E307" + }, + { + "column1": "8637983229365371904", + "column2": "1185216615", + "column3": "9sn7fw2o3q", + "column4": "false", + "column5": "23224", + "column6": "1.4122802E38", + "column7": "1.580014576135557E308" + }, + { + "column1": "9067948480444420096", + "column2": "1081656270", + "column3": "7f0ne", + "column4": "false", + "column5": "32102", + "column6": "1.3807303E38", + "column7": "1.2057784493311825E308" + }, + { + "column1": "6604084776146575360", + "column2": "1701387671", + "column3": "3v2qgcaetf0", + "column4": "true", + "column5": "14055", + "column6": "1.0123542E38", + "column7": "1.7725263417131191E308" + }, + { + "column1": "8522793738323822592", + "column2": "583151778", + "column3": "p4zuv5m", + "column4": "false", + "column5": "4456", + "column6": "2.3024422E37", + "column7": "9.653626411185625E307" + } +] \ No newline at end of file From 5b451ba4ab8b3328353acee241e7b1a703fbefd1 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Tue, 15 Oct 2024 12:40:00 +0000 Subject: [PATCH 04/20] fix: example code added feat: changed provider name to my own (using my name) --- .../dataprovider/AmiyahJonesProvider.java | 51 +++++-------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java index 606d8ff8..0d3c73fc 100644 --- a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java +++ b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java @@ -1,46 +1,23 @@ package com.codedifferently.lesson9.dataprovider; -import java.util.List; import java.util.Map; -import java.util.stream.Collectors; -public abstract class AmiyahJonesProvider { +import org.springframework.stereotype.Service; - public abstract String getProviderName(); - - public abstract Map getColumnTypeByName(); - - /** - * Given a list of data objects, returns the list with values converted to the appropriate type. - * - * @param data A list of data objects containing values keyed by column name. - * @return A new list with object values converted to the appropriate type. - */ - public List> parseData(List> data) throws Exception { - Map columnTypeByName = getColumnTypeByName(); - return data.stream().map(row -> parseRow(columnTypeByName, row)).collect(Collectors.toList()); +@Service +public class AmiyahJonesProvider extends DataProvider { + public String getProviderName() { + return "amiyahjones"; } - /** - * Parses a single row of data using the provided column types mapping. - * - * @param columnTypeByName A map containing the type of a column keyed by its name. - * @param row A bag of values keyed by column name. - * @return A new list of data values converted to the appropriate type. - */ - private Map parseRow( - Map columnTypeByName, Map row) { - var parsedRow = new java.util.HashMap(); - row.forEach( - (key, value) -> { - Class type = columnTypeByName.get(key); - try { - parsedRow.put(key, type.getConstructor(String.class).newInstance(value)); - } catch (Exception e) { - throw new RuntimeException( - "Error parsing data for " + key + " as type " + type.getName()); - } - }); - return parsedRow; + public Map getColumnTypeByName() { + return Map.of( + "column1", Integer.class, + "column2", String.class, + "column3", Boolean.class, + "column4", Float.class, + "column5", Double.class, + "column6", Long.class, + "column7", Short.class); } } From 50c622ff3501f7e8b5de59edf69fafbd1f62f3b2 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Tue, 15 Oct 2024 13:13:52 +0000 Subject: [PATCH 05/20] feat: added columns and their data types --- .../lesson9/dataprovider/AmiyahJonesProvider.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java index 0d3c73fc..f678e7a5 100644 --- a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java +++ b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java @@ -12,12 +12,12 @@ public String getProviderName() { public Map getColumnTypeByName() { return Map.of( - "column1", Integer.class, - "column2", String.class, - "column3", Boolean.class, - "column4", Float.class, - "column5", Double.class, - "column6", Long.class, - "column7", Short.class); + "column4", Boolean.class, + "column2", Integer.class, + "column1", Long.class, + "column3", String.class, + "column6", Float.class, + "column7", Double.class, + "column5", Short.class); } } From dc7eb479098dc399376535918eefbfddd5a1dacc Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Tue, 15 Oct 2024 13:22:25 +0000 Subject: [PATCH 06/20] chore: spacing --- .../lesson9/dataprovider/AmiyahJonesProvider.java | 1 - 1 file changed, 1 deletion(-) diff --git a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java index f678e7a5..09e344e6 100644 --- a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java +++ b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/AmiyahJonesProvider.java @@ -1,7 +1,6 @@ package com.codedifferently.lesson9.dataprovider; import java.util.Map; - import org.springframework.stereotype.Service; @Service From 0552b484e0fddb093bdfd43c85afcbf38209d34d Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Wed, 16 Oct 2024 20:13:23 +0000 Subject: [PATCH 07/20] feat: created a .ts file for my loader amiyah_jones.ts --- .../libraries/src/loaders/amiyah_jones.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lesson_10/libraries/src/loaders/amiyah_jones.ts diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts new file mode 100644 index 00000000..8a38facf --- /dev/null +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -0,0 +1,38 @@ +import csv from 'csv-parser'; +import fs from 'fs'; +import { Credit, MediaItem } from '../models/index.js'; +import { Loader } from './loader.js'; + +export class AmiyahJonesLoader implements Loader { + getLoaderName(): string { + return 'amiyahjones'; + } + + async loadData(): Promise { + const credits = await this.loadCredits(); + const mediaItems = await this.loadMediaItems(); + + console.log( + `Loaded ${credits.length} credits and ${mediaItems.length} media items`, + ); + + return [...mediaItems.values()]; + } + + async loadMediaItems(): Promise { + // TODO: Implement this method. + return []; + } + + async loadCredits(): Promise { + const credits = []; + const readable = fs + .createReadStream('data/credits.csv', 'utf-8') + .pipe(csv()); + for await (const row of readable) { + const { media_item_id: mediaItemId, role, name } = row; + credits.push({ mediaItemId, name, role }); + } + return credits; + } +} \ No newline at end of file From 111fa21932c7e2caa5b61f63657d99775f5bdfcc Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 13:20:19 +0000 Subject: [PATCH 08/20] fix: updated example from anothony_mays_loader.ts file --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index 8a38facf..3a47d562 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -21,7 +21,9 @@ export class AmiyahJonesLoader implements Loader { async loadMediaItems(): Promise { // TODO: Implement this method. - return []; + return [ + + ]; } async loadCredits(): Promise { @@ -30,8 +32,8 @@ export class AmiyahJonesLoader implements Loader { .createReadStream('data/credits.csv', 'utf-8') .pipe(csv()); for await (const row of readable) { - const { media_item_id: mediaItemId, role, name } = row; - credits.push({ mediaItemId, name, role }); + const { media_item_id, role, name } = row; + credits.push(new Credit(media_item_id, name, role)); } return credits; } From 429a4c96038b1de2bda5d72796f05bebd9ca9856 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 14:31:20 +0000 Subject: [PATCH 09/20] feat: test code to implement the loadMediaItems() method --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index 3a47d562..0d6c08c3 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -22,7 +22,17 @@ export class AmiyahJonesLoader implements Loader { async loadMediaItems(): Promise { // TODO: Implement this method. return [ + class Test { + id = '1'; + type = 'movie'; + title = 'Inception'; + genre = 'Sci-Fi'; + year = 2010; + load() { + this.loadMediaItems(); + } + } ]; } From ae9aa06354c3eeb8b05fcd37ff796da7c05bd249 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 14:47:25 +0000 Subject: [PATCH 10/20] feat: testing out implementations --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index 0d6c08c3..44ee3034 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -22,17 +22,15 @@ export class AmiyahJonesLoader implements Loader { async loadMediaItems(): Promise { // TODO: Implement this method. return [ - class Test { + class movie1 { id = '1'; type = 'movie'; title = 'Inception'; genre = 'Sci-Fi'; year = 2010; - - load() { - this.loadMediaItems(); - } } + + let itemText = this.loadMediaItems(movie1); ]; } From e2d502a979c5db47c6ba41dbcf6599ee24e8b32a Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 16:07:54 +0000 Subject: [PATCH 11/20] feat: edits to creating an object --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index 44ee3034..c6bf54a0 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -22,15 +22,19 @@ export class AmiyahJonesLoader implements Loader { async loadMediaItems(): Promise { // TODO: Implement this method. return [ - class movie1 { - id = '1'; + + class Movie1 { + + constructor(id: number , type: string, title: string, genre: string, year: number){ + id = 1; type = 'movie'; title = 'Inception'; genre = 'Sci-Fi'; year = 2010; - } + } + } - let itemText = this.loadMediaItems(movie1); + let testMovie = this.loadMediaItems(Movie1); ]; } From b009f8c0f14cfd88c894f5fc3365520340cba6ec Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 17:48:19 +0000 Subject: [PATCH 12/20] fix: readable function --- lesson_10/libraries/package-lock.json | 8 +++--- lesson_10/libraries/package.json | 2 +- .../libraries/src/loaders/amiyah_jones.ts | 26 +++++++------------ 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lesson_10/libraries/package-lock.json b/lesson_10/libraries/package-lock.json index ba9d2c42..c46dc169 100644 --- a/lesson_10/libraries/package-lock.json +++ b/lesson_10/libraries/package-lock.json @@ -31,7 +31,7 @@ "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsc-watch": "^6.2.0", - "typescript": "^5.6.2", + "typescript": "^5.6.3", "typescript-eslint": "^8.7.0" } }, @@ -5737,9 +5737,9 @@ } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/lesson_10/libraries/package.json b/lesson_10/libraries/package.json index 987ad775..036442ad 100644 --- a/lesson_10/libraries/package.json +++ b/lesson_10/libraries/package.json @@ -32,7 +32,7 @@ "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsc-watch": "^6.2.0", - "typescript": "^5.6.2", + "typescript": "^5.6.3", "typescript-eslint": "^8.7.0" }, "dependencies": { diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index c6bf54a0..c0162851 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -20,22 +20,16 @@ export class AmiyahJonesLoader implements Loader { } async loadMediaItems(): Promise { - // TODO: Implement this method. - return [ - - class Movie1 { - - constructor(id: number , type: string, title: string, genre: string, year: number){ - id = 1; - type = 'movie'; - title = 'Inception'; - genre = 'Sci-Fi'; - year = 2010; - } - } - - let testMovie = this.loadMediaItems(Movie1); - ]; + // TODO: Implement this method. + const movieItem = []; + const readable = fs + .createReadStream('data/media_items.csv', 'utf-8') + .pipe(csv()); + for await (const row of readable) { + const { id,type,title,year } = row; + movieItem.push(new MediaItem(id,type,title,year, [])); + } + return movieItem; } async loadCredits(): Promise { From ebfacf560291e98d356e9cd3b0256f7e58afd7fd Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 17:49:53 +0000 Subject: [PATCH 13/20] fix: chnaged name to my array from movieitem to allMedia --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index c0162851..b297f286 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -21,15 +21,15 @@ export class AmiyahJonesLoader implements Loader { async loadMediaItems(): Promise { // TODO: Implement this method. - const movieItem = []; + const allMedia = []; const readable = fs .createReadStream('data/media_items.csv', 'utf-8') .pipe(csv()); for await (const row of readable) { const { id,type,title,year } = row; - movieItem.push(new MediaItem(id,type,title,year, [])); + allMedia.push(new MediaItem(id,type,title,year, [])); } - return movieItem; + return allMedia; } async loadCredits(): Promise { From da99d4d768c48634ab4fe8611fd190ee2aa032bd Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 18:18:17 +0000 Subject: [PATCH 14/20] chore: removed //TODO comment --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index b297f286..0d26be7c 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -19,8 +19,7 @@ export class AmiyahJonesLoader implements Loader { return [...mediaItems.values()]; } - async loadMediaItems(): Promise { - // TODO: Implement this method. + async loadMediaItems(): Promise { const allMedia = []; const readable = fs .createReadStream('data/media_items.csv', 'utf-8') From 1a1c339a9f570d8078d94e45a8d7d3b0edffe2dd Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 18:29:41 +0000 Subject: [PATCH 15/20] fix: added quiz provider --- lesson_10/libraries/src/loaders/loaders.module.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lesson_10/libraries/src/loaders/loaders.module.ts b/lesson_10/libraries/src/loaders/loaders.module.ts index 5997b6f7..f178fb5a 100644 --- a/lesson_10/libraries/src/loaders/loaders.module.ts +++ b/lesson_10/libraries/src/loaders/loaders.module.ts @@ -1,11 +1,12 @@ import { Module } from '@nestjs/common'; import { AnthonyMaysLoader } from './anthony_mays_loader.js'; import { XavierCruzLoader } from './xavier_cruz_loader.js'; +import { AmiyahJonesLoader } from './amiyah_jones.js'; export const Loaders = Symbol.for('Loaders'); // Add your quiz provider here. -const LOADER_PROVIDERS = [AnthonyMaysLoader, XavierCruzLoader]; +const LOADER_PROVIDERS = [AnthonyMaysLoader, XavierCruzLoader, AmiyahJonesLoader]; @Module({ providers: [ From 548bf356bac51e176ec88365ab9f41139d8b872e Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 18:36:50 +0000 Subject: [PATCH 16/20] fix: corrected the format to my file --- .../libraries/src/loaders/amiyah_jones.ts | 22 +++++++++---------- .../libraries/src/loaders/loaders.module.ts | 6 ++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index 0d26be7c..58b24f20 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -19,16 +19,16 @@ export class AmiyahJonesLoader implements Loader { return [...mediaItems.values()]; } - async loadMediaItems(): Promise { - const allMedia = []; - const readable = fs - .createReadStream('data/media_items.csv', 'utf-8') - .pipe(csv()); - for await (const row of readable) { - const { id,type,title,year } = row; - allMedia.push(new MediaItem(id,type,title,year, [])); - } - return allMedia; + async loadMediaItems(): Promise { + const allMedia = []; + const readable = fs + .createReadStream('data/media_items.csv', 'utf-8') + .pipe(csv()); + for await (const row of readable) { + const { id, type, title, year } = row; + allMedia.push(new MediaItem(id, type, title, year, [])); + } + return allMedia; } async loadCredits(): Promise { @@ -42,4 +42,4 @@ export class AmiyahJonesLoader implements Loader { } return credits; } -} \ No newline at end of file +} diff --git a/lesson_10/libraries/src/loaders/loaders.module.ts b/lesson_10/libraries/src/loaders/loaders.module.ts index f178fb5a..e8f07e8c 100644 --- a/lesson_10/libraries/src/loaders/loaders.module.ts +++ b/lesson_10/libraries/src/loaders/loaders.module.ts @@ -6,7 +6,11 @@ import { AmiyahJonesLoader } from './amiyah_jones.js'; export const Loaders = Symbol.for('Loaders'); // Add your quiz provider here. -const LOADER_PROVIDERS = [AnthonyMaysLoader, XavierCruzLoader, AmiyahJonesLoader]; +const LOADER_PROVIDERS = [ + AnthonyMaysLoader, + XavierCruzLoader, + AmiyahJonesLoader, +]; @Module({ providers: [ From a9711eccb5d5201da3dc7e0c574f3047d7a1d8a8 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 18:55:31 +0000 Subject: [PATCH 17/20] fix: back to version 5.6.2 --- lesson_10/libraries/package-lock.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lesson_10/libraries/package-lock.json b/lesson_10/libraries/package-lock.json index c46dc169..264f81f4 100644 --- a/lesson_10/libraries/package-lock.json +++ b/lesson_10/libraries/package-lock.json @@ -31,7 +31,7 @@ "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsc-watch": "^6.2.0", - "typescript": "^5.6.3", + "typescript": "^5.6.2", "typescript-eslint": "^8.7.0" } }, @@ -5737,9 +5737,9 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -6067,4 +6067,4 @@ } } } -} +} \ No newline at end of file From 9a5ac2b69a168a74f75cbb08db193112ffb223ef Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 18:56:04 +0000 Subject: [PATCH 18/20] fix: version update for package.json --- lesson_10/libraries/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson_10/libraries/package.json b/lesson_10/libraries/package.json index 036442ad..987ad775 100644 --- a/lesson_10/libraries/package.json +++ b/lesson_10/libraries/package.json @@ -32,7 +32,7 @@ "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsc-watch": "^6.2.0", - "typescript": "^5.6.3", + "typescript": "^5.6.2", "typescript-eslint": "^8.7.0" }, "dependencies": { From 8d5df191587d57557cfdda6c70ce3b24e1f0eec3 Mon Sep 17 00:00:00 2001 From: AmiyahJo Date: Thu, 17 Oct 2024 20:56:50 +0000 Subject: [PATCH 19/20] fix: fixed order mediaItem --- lesson_10/libraries/src/loaders/amiyah_jones.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson_10/libraries/src/loaders/amiyah_jones.ts b/lesson_10/libraries/src/loaders/amiyah_jones.ts index 58b24f20..9a4372c1 100644 --- a/lesson_10/libraries/src/loaders/amiyah_jones.ts +++ b/lesson_10/libraries/src/loaders/amiyah_jones.ts @@ -26,7 +26,7 @@ export class AmiyahJonesLoader implements Loader { .pipe(csv()); for await (const row of readable) { const { id, type, title, year } = row; - allMedia.push(new MediaItem(id, type, title, year, [])); + allMedia.push(new MediaItem(id, title, type, year, [])); } return allMedia; } From f856c72649990b633140f689b20c7b43c4d53acb Mon Sep 17 00:00:00 2001 From: "Anthony D. Mays" Date: Wed, 23 Oct 2024 01:17:46 +0000 Subject: [PATCH 20/20] chore: undo package.json changes Signed-off-by: Anthony D. Mays --- lesson_10/libraries/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesson_10/libraries/package-lock.json b/lesson_10/libraries/package-lock.json index 264f81f4..ba9d2c42 100644 --- a/lesson_10/libraries/package-lock.json +++ b/lesson_10/libraries/package-lock.json @@ -6067,4 +6067,4 @@ } } } -} \ No newline at end of file +}