Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: adds lesson 10 AmiyahJonesLoader and new typescript file #339

Merged
merged 69 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8cc92d0
Create README.md
AmiyahJo Sep 24, 2024
50b1861
Delete lesson_00/amiyahjones/README.md
AmiyahJo Sep 24, 2024
27d57c0
Merge branch 'code-differently:main' into main
AmiyahJo Sep 25, 2024
fa3c700
Merge branch 'code-differently:main' into main
AmiyahJo Sep 26, 2024
7c2d053
Merge branch 'code-differently:main' into main
AmiyahJo Sep 26, 2024
faedd1b
Merge branch 'code-differently:main' into main
AmiyahJo Sep 26, 2024
19a4187
Merge branch 'code-differently:main' into main
AmiyahJo Sep 26, 2024
7711266
Merge branch 'code-differently:main' into main
AmiyahJo Sep 27, 2024
9a10c4c
Merge branch 'code-differently:main' into main
AmiyahJo Sep 27, 2024
3ea50c4
Merge branch 'code-differently:main' into main
AmiyahJo Sep 27, 2024
d7b772d
Merge branch 'code-differently:main' into main
AmiyahJo Sep 27, 2024
de46b67
Merge branch 'code-differently:main' into main
AmiyahJo Sep 27, 2024
b891561
Merge branch 'code-differently:main' into main
AmiyahJo Sep 28, 2024
7c9f2db
Merge branch 'code-differently:main' into main
AmiyahJo Sep 30, 2024
ff3ba35
Merge branch 'code-differently:main' into main
AmiyahJo Sep 30, 2024
457feea
Merge branch 'code-differently:main' into main
AmiyahJo Sep 30, 2024
5868f9d
Merge branch 'code-differently:main' into main
AmiyahJo Oct 1, 2024
28eacd4
Merge branch 'code-differently:main' into main
AmiyahJo Oct 1, 2024
bca4933
Merge branch 'code-differently:main' into main
AmiyahJo Oct 1, 2024
9ff0f9e
Merge branch 'code-differently:main' into main
AmiyahJo Oct 1, 2024
8d02849
Merge branch 'code-differently:main' into main
AmiyahJo Oct 2, 2024
6dd3a43
Merge branch 'code-differently:main' into main
AmiyahJo Oct 2, 2024
95f56a5
Merge branch 'code-differently:main' into main
AmiyahJo Oct 3, 2024
0f4dbac
Merge branch 'code-differently:main' into main
AmiyahJo Oct 4, 2024
a3b9984
Merge branch 'code-differently:main' into main
AmiyahJo Oct 4, 2024
54cd199
Merge branch 'code-differently:main' into main
AmiyahJo Oct 4, 2024
edbe7c0
Merge branch 'code-differently:main' into main
AmiyahJo Oct 4, 2024
7f0a084
Merge branch 'code-differently:main' into main
AmiyahJo Oct 7, 2024
a905b74
Merge branch 'code-differently:main' into main
AmiyahJo Oct 8, 2024
2d69531
Merge branch 'code-differently:main' into main
AmiyahJo Oct 8, 2024
df48fbd
Merge branch 'code-differently:main' into main
AmiyahJo Oct 8, 2024
c972d14
Merge branch 'code-differently:main' into main
AmiyahJo Oct 9, 2024
bc3907c
Merge branch 'code-differently:main' into main
AmiyahJo Oct 9, 2024
c3eabbb
Merge branch 'code-differently:main' into main
AmiyahJo Oct 9, 2024
9fff7d0
Merge branch 'code-differently:main' into main
AmiyahJo Oct 11, 2024
4c57926
Merge branch 'code-differently:main' into main
AmiyahJo Oct 11, 2024
8dd5d42
Merge branch 'code-differently:main' into main
AmiyahJo Oct 14, 2024
18f65ee
Merge branch 'code-differently:main' into main
AmiyahJo Oct 14, 2024
2dd1645
Merge branch 'code-differently:main' into main
AmiyahJo Oct 14, 2024
7f95364
feat: add provider.java file
Oct 14, 2024
229e546
Merge branch 'code-differently:main' into featture/lesson_09
AmiyahJo Oct 14, 2024
5b451ba
fix: example code added
Oct 15, 2024
50c622f
feat: added columns and their data types
Oct 15, 2024
dc7eb47
chore: spacing
Oct 15, 2024
85950b7
Merge branch 'code-differently:main' into featture/lesson_09
AmiyahJo Oct 16, 2024
0552b48
feat: created a .ts file for my loader
Oct 16, 2024
e092d07
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 16, 2024
f94ec98
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 17, 2024
111fa21
fix: updated example from anothony_mays_loader.ts file
Oct 17, 2024
429a4c9
feat: test code to implement the loadMediaItems() method
Oct 17, 2024
ae9aa06
feat: testing out implementations
Oct 17, 2024
e2d502a
feat: edits to creating an object
Oct 17, 2024
b009f8c
fix: readable function
Oct 17, 2024
ebfacf5
fix: chnaged name to my array from movieitem to allMedia
Oct 17, 2024
a28cb05
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 17, 2024
da99d4d
chore: removed //TODO comment
Oct 17, 2024
d744602
Merge remote-tracking branch 'refs/remotes/origin/feature/lesson_10' …
Oct 17, 2024
1a1c339
fix: added quiz provider
Oct 17, 2024
548bf35
fix: corrected the format to my file
Oct 17, 2024
a9711ec
fix: back to version 5.6.2
Oct 17, 2024
9a5ac2b
fix: version update for package.json
Oct 17, 2024
8d5df19
fix: fixed order mediaItem
Oct 17, 2024
8b61eb5
Merge branch 'main' into feature/lesson_10
AmiyahJo Oct 18, 2024
9f5d162
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 18, 2024
4656fc8
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 21, 2024
8ad7445
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 21, 2024
e3a58d9
Merge branch 'code-differently:main' into feature/lesson_10
AmiyahJo Oct 22, 2024
f856c72
chore: undo package.json changes
anthonydmays Oct 23, 2024
f9b8ada
Merge branch 'main' into feature/lesson_10
anthonydmays Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions lesson_10/libraries/src/loaders/amiyah_jones.ts
AmiyahJo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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<MediaItem[]> {
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<MediaItem[]> {
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, title, type, year, []));
}
return allMedia;
}

async loadCredits(): Promise<Credit[]> {
const credits = [];
const readable = fs
.createReadStream('data/credits.csv', 'utf-8')
.pipe(csv());
for await (const row of readable) {
const { media_item_id, role, name } = row;
credits.push(new Credit(media_item_id, name, role));
}
return credits;
}
}
3 changes: 2 additions & 1 deletion lesson_10/libraries/src/loaders/loaders.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Module } from '@nestjs/common';

import { AmiyahJonesLoader } from './amiyah_jones.js';
import { AngelicaCastilloLoader } from './angelica_castillo_loader.js';
import { AnthonyMaysLoader } from './anthony_mays_loader.js';
import { ChelseaOgbonniaLoader } from './chelsea_ogbonnia_loader.js';
Expand All @@ -15,12 +16,12 @@ import { TommyTranLoader } from './tommy_tran_loader.js';
import { XavierCruzLoader } from './xavier_cruz_loader.js';
import { ZionBuchananLoader } from './zion_buchanan_loader.js';


export const Loaders = Symbol.for('Loaders');

// Add your quiz provider here.

const LOADER_PROVIDERS = [
AmiyahJonesLoader,
AngelicaCastilloLoader,
AnthonyMaysLoader,
ChelseaOgbonniaLoader,
Expand Down