Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 1 addition & 17 deletions src/models/game.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,19 @@ const GameSchema = new Schema<GameDocument>({
sample_cover: {
height: {
type: Number,
required: true,
},
width: {
type: Number,
required: true,
},
image: {
type: String,
required: true,
},
thumbnail_image: {
type: String,
required: true,
},
platforms: [
{
_id: false,
platform_id: {
type: Number,
required: true,
},
platform_name: {
type: String,
required: true,
},
first_release_date: {
type: String,
required: true,
},
type: String,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/services/gameInsertionTobd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function delay(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fetchGameDetail(arg0: number): Promise<GameI[]> {
const response = await fetch(`https://api.mobygames.com/v1/games?limit=100&api_key=moby_HBxa5enVtuiho2QA4dUqi6dsFNy&format=normal&offset=${105298+arg0*100}`);
const response = await fetch(`https://api.mobygames.com/v1/games?limit=100&api_key=moby_HBxa5enVtuiho2QA4dUqi6dsFNy&format=normal&offset=${50000+arg0*100}`);

if(response.status !== 200) {
console.log("Failed to fetch data from batch: ", arg0);
Expand Down
19 changes: 4 additions & 15 deletions src/tests/games.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,9 @@ describe(`Testing game routes`, function () {
image: "https://example.com/images/zelda_cover.jpg",
thumbnail_image: "https://example.com/images/zelda_thumb.jpg",
platforms: [
{
platform_id: 1,
platform_name: "Nintendo Switch",
first_release_date: "2017-03-03"
},
{
platform_id: 2,
platform_name: "Wii U",
first_release_date: "2017-03-03"
}
"Nintendo Switch",
"Wii U",
"Windows",
]
},
genres: [
Expand Down Expand Up @@ -157,11 +150,7 @@ describe(`Testing game routes`, function () {
image: "https://example.com/images/zelda_cover.jpg",
thumbnail_image: "https://example.com/images/zelda_thumb.jpg",
platforms: [
{
platform_id: 1,
platform_name: "Nintendo Switch",
first_release_date: "2017-03-03"
}
"Nintendo Switch"
]
},
genres: [
Expand Down
Loading