From 62b52879a7192df43cc25a0d64096ffea80ba6a9 Mon Sep 17 00:00:00 2001 From: yahya mawhoub Date: Wed, 18 Dec 2024 20:47:16 -0500 Subject: [PATCH] changed model --- src/models/game.model.ts | 18 +----------------- src/services/gameInsertionTobd.ts | 2 +- src/tests/games.test.ts | 19 ++++--------------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/models/game.model.ts b/src/models/game.model.ts index d6ef5ce..f3aa67d 100644 --- a/src/models/game.model.ts +++ b/src/models/game.model.ts @@ -31,35 +31,19 @@ const GameSchema = new Schema({ 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, }, ], }, diff --git a/src/services/gameInsertionTobd.ts b/src/services/gameInsertionTobd.ts index f950c0a..2623000 100644 --- a/src/services/gameInsertionTobd.ts +++ b/src/services/gameInsertionTobd.ts @@ -17,7 +17,7 @@ async function delay(ms: number): Promise { return new Promise(resolve => setTimeout(resolve, ms)); } async function fetchGameDetail(arg0: number): Promise { - 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); diff --git a/src/tests/games.test.ts b/src/tests/games.test.ts index ec3bed9..060e9fd 100644 --- a/src/tests/games.test.ts +++ b/src/tests/games.test.ts @@ -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: [ @@ -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: [