Skip to content

Commit 4f5c626

Browse files
authored
Merge branch 'main' into feat/lesson_10
2 parents 803989e + 03b51f8 commit 4f5c626

File tree

74 files changed

+14623
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+14623
-5
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check Lesson 12 Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_12/structs_java/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '21'
23+
distribution: 'temurin'
24+
25+
- name: Build Lesson 12 with Java
26+
working-directory: ./lesson_12/structs_java
27+
run: ./gradlew check
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Lesson 12 Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_12/structs_ts/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20.x'
23+
24+
- name: Build Lesson 12 with Node.js
25+
working-directory: ./lesson_12/structs_ts
26+
run: |
27+
npm ci
28+
npm run check
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check Lesson 13 Java Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_13/maps_java/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '21'
23+
distribution: 'temurin'
24+
25+
- name: Build Lesson 13 with Java
26+
working-directory: ./lesson_13/maps_java
27+
run: ./gradlew check
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Lesson 13 TS Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_13/maps_ts/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20.x'
23+
24+
- name: Build Lesson 13 with Node.js
25+
working-directory: ./lesson_13/maps_ts
26+
run: |
27+
npm ci
28+
npm run check

.github/workflows/check_push.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
- "lesson_10/libraries/**"
1616
- "lesson_11/arrays_java/**"
1717
- "lesson_11/arrays_ts/**"
18+
- "lesson_12/structs_java/**"
19+
- "lesson_12/structs_ts/**"
20+
- "lesson_13/maps_java/**"
21+
- "lesson_13/maps_ts/**"
1822
jobs:
1923
build:
2024
runs-on: ubuntu-latest
@@ -117,3 +121,23 @@ jobs:
117121
run: |
118122
npm ci
119123
npm run compile
124+
125+
- name: Build Lesson 12 with Java
126+
working-directory: ./lesson_12/structs_java
127+
run: ./gradlew assemble
128+
129+
- name: Build Lesson 12 with Node.js
130+
working-directory: ./lesson_12/structs_ts
131+
run: |
132+
npm ci
133+
npm run compile
134+
135+
- name: Build Lesson 13 with Java
136+
working-directory: ./lesson_13/maps_java
137+
run: ./gradlew assemble
138+
139+
- name: Build Lesson 13 with Node.js
140+
working-directory: ./lesson_13/maps_ts
141+
run: |
142+
npm ci
143+
npm run compile
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import csv from 'csv-parser';
2+
import fs from 'fs';
3+
import { Credit, MediaItem } from '../models/index.js';
4+
import { Loader } from './loader.js';
5+
6+
export class JBeyLoader implements Loader {
7+
getLoaderName(): string {
8+
return 'JBey';
9+
}
10+
11+
async loadData(): Promise<MediaItem[]> {
12+
const credits = await this.loadCredits();
13+
const mediaItems = await this.loadMediaItems();
14+
15+
console.log(
16+
`Loaded ${credits.length} credits and ${mediaItems.length} media items`,
17+
);
18+
19+
return [...mediaItems.values()];
20+
}
21+
22+
async loadMediaItems(): Promise<MediaItem[]> {
23+
// TODO: Implement this method.
24+
const mediaItems = [];
25+
const readable = fs
26+
.createReadStream('data/media_items.csv', 'utf-8')
27+
.pipe(csv());
28+
for await (const row of readable) {
29+
const { id, title, type, year } = row;
30+
mediaItems.push(new MediaItem(id, title, type, year, []));
31+
}
32+
return mediaItems;
33+
}
34+
35+
async loadCredits(): Promise<Credit[]> {
36+
const credits = [];
37+
const readable = fs
38+
.createReadStream('data/credits.csv', 'utf-8')
39+
.pipe(csv());
40+
for await (const row of readable) {
41+
const { media_item_id, role, name } = row;
42+
credits.push(new Credit(media_item_id, name, role));
43+
}
44+
return credits;
45+
}
46+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import csv from 'csv-parser';
2+
import fs from 'fs';
3+
import { Credit, MediaItem } from '../models/index.js';
4+
import { Loader } from './loader.js';
5+
6+
export class BryanaSingletonBarnhartLoader implements Loader {
7+
getLoaderName(): string {
8+
return 'bryanasingletonbarnhart';
9+
}
10+
11+
async loadData(): Promise<MediaItem[]> {
12+
const credits = await this.loadCredits();
13+
const mediaItems = await this.loadMediaItems();
14+
15+
console.log(
16+
`Loaded ${credits.length} credits and ${mediaItems.length} media items`,
17+
);
18+
19+
return [...mediaItems.values()];
20+
}
21+
22+
async loadMediaItems(): Promise<MediaItem[]> {
23+
// TODO: Implement this method.g
24+
const mediaItems = [];
25+
const readable = fs
26+
.createReadStream('data/media_items.csv', 'utf-8')
27+
.pipe(csv());
28+
for await (const row of readable) {
29+
const { id, title, year, type } = row;
30+
mediaItems.push(new MediaItem(id, title, type, year, []));
31+
}
32+
return mediaItems;
33+
34+
}
35+
36+
async loadCredits(): Promise<Credit[]> {
37+
const credits = [];
38+
const readable = fs
39+
.createReadStream('data/credits.csv', 'utf-8')
40+
.pipe(csv());
41+
for await (const row of readable) {
42+
const { media_item_id, role, name } = row;
43+
credits.push(new Credit(media_item_id, name, role));
44+
}
45+
return credits;
46+
}
47+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import csv from 'csv-parser';
2+
import fs from 'fs';
3+
import { Credit, MediaItem } from '../models/index.js';
4+
import { Loader } from './loader.js';
5+
6+
export class ChanelHuttLoader implements Loader {
7+
getLoaderName(): string {
8+
return 'chanelhutt';
9+
}
10+
11+
async loadData(): Promise<MediaItem[]> {
12+
const credits = await this.loadCredits();
13+
const mediaItems = await this.loadMediaItems();
14+
// Create a Hashmap to where the key is a string(MediaItem ID) and the value is the MediaItem object.
15+
const hashMapIndex = new Map<string, MediaItem>();
16+
// Loops through the mediaItems and adds them to the map by their ID.
17+
for (const mediaItem of mediaItems) {
18+
hashMapIndex.set(mediaItem.getId(), mediaItem);
19+
}
20+
// Loops through the credits and adds them to the mediaItem by getting the mediaItem ID.
21+
for (const credit of credits) {
22+
const mediaItem = hashMapIndex.get(credit.getMediaItemId());
23+
if (mediaItem) {
24+
mediaItem.addCredit(credit);
25+
}
26+
}
27+
// Returns an array of the values from the hashmap.
28+
return Array.from(hashMapIndex.values());
29+
}
30+
31+
async loadMediaItems(): Promise<MediaItem[]> {
32+
const mediaItems = [];
33+
const readable = fs
34+
.createReadStream('data/media_items.csv', 'utf-8')
35+
.pipe(csv());
36+
for await (const row of readable) {
37+
const { id, title, type, year } = row;
38+
mediaItems.push(new MediaItem(id, title, type, year, []));
39+
}
40+
return mediaItems;
41+
}
42+
43+
async loadCredits(): Promise<Credit[]> {
44+
const credits = [];
45+
const readable = fs
46+
.createReadStream('data/credits.csv', 'utf-8')
47+
.pipe(csv());
48+
for await (const row of readable) {
49+
const { media_item_id, role, name } = row;
50+
credits.push(new Credit(media_item_id, name, role));
51+
}
52+
return credits;
53+
}
54+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import csv from 'csv-parser';
2+
import fs from 'fs';
3+
import { Credit, MediaItem } from '../models/index.js';
4+
import { Loader } from './loader.js';
5+
6+
export class DavidAdenaikeLoader implements Loader {
7+
getLoaderName(): string {
8+
return 'davidadenaike';
9+
}
10+
11+
async loadData(): Promise<MediaItem[]> {
12+
const credits = await this.loadCredits();
13+
const mediaItems = await this.loadMediaItems();
14+
15+
console.log(
16+
`Loaded ${credits.length} credits and ${mediaItems.length} media items`,
17+
);
18+
19+
return [...mediaItems.values()];
20+
}
21+
22+
async loadMediaItems(): Promise<MediaItem[]> {
23+
// TODO: Implement this method.
24+
const mediaItems = [];
25+
const readable = fs
26+
.createReadStream('data/media_items.csv', 'utf-8')
27+
.pipe(csv());
28+
for await (const row of readable) {
29+
const { id, type, title, year } = row;
30+
mediaItems.push(new MediaItem(id, title, type, year, []));
31+
}
32+
return mediaItems;
33+
}
34+
35+
async loadCredits(): Promise<Credit[]> {
36+
const credits = [];
37+
const readable = fs
38+
.createReadStream('data/credits.csv', 'utf-8')
39+
.pipe(csv());
40+
for await (const row of readable) {
41+
const { media_item_id, role, name } = row;
42+
credits.push(new Credit(media_item_id, name, role));
43+
}
44+
return credits;
45+
}
46+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import csv from 'csv-parser';
2+
import fs from 'fs';
3+
import { Credit, MediaItem } from '../models/index.js';
4+
import { Loader } from './loader.js';
5+
6+
// Do the extra credit tonight as well as prework for tommorow!!
7+
8+
export class DavisDLoader implements Loader {
9+
getLoaderName(): string {
10+
return 'davis';
11+
}
12+
13+
async loadData(): Promise<MediaItem[]> {
14+
const credits = await this.loadCredits();
15+
const mediaItems = await this.loadMediaItems();
16+
17+
console.log(
18+
`Loaded ${credits.length} credits and ${mediaItems.length} media items`,
19+
);
20+
21+
return [...mediaItems.values()];
22+
}
23+
24+
async loadMediaItems(): Promise<MediaItem[]> {
25+
// TODO: Implement this method.
26+
const MediaItems = [];
27+
const readable = fs
28+
.createReadStream('data/media_items.csv', 'utf-8')
29+
.pipe(csv());
30+
for await (const row of readable) {
31+
const { id, title, type, year } = row;
32+
MediaItems.push(new MediaItem(id, title, type, year, []));
33+
}
34+
return MediaItems;
35+
}
36+
37+
async loadCredits(): Promise<Credit[]> {
38+
const credits = [];
39+
const readable = fs
40+
.createReadStream('data/credits.csv', 'utf-8')
41+
.pipe(csv());
42+
for await (const row of readable) {
43+
const { media_item_id, role, name } = row;
44+
credits.push(new Credit(media_item_id, name, role));
45+
}
46+
return credits;
47+
}
48+
}

0 commit comments

Comments
 (0)