Skip to content

Commit

Permalink
added Services and Models. Need to add category and choice model still
Browse files Browse the repository at this point in the history
  • Loading branch information
justinstoner2 committed May 1, 2024
1 parent 1b896ce commit a78457d
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 0 deletions.
55 changes: 55 additions & 0 deletions trivia-forge/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions trivia-forge/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.6.8",
"bootstrap": "^5.3.3",
"openai": "^4.38.3",
"react": "^18.2.0",
Expand Down
22 changes: 22 additions & 0 deletions trivia-forge/frontend/src/Model/Game.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export class Game {
constructor(id, userID, date, name, questions) {
this.id = id;
this.date = date;
this.name = name;
this.questions = [];
this.userID = userID;
}

addGame(question) {
this.questions.push(question);
}

toJsonObject() {
return {
id: this.id,
date: this.date,
name: this.name,
userID: this.userID
}
}
}
22 changes: 22 additions & 0 deletions trivia-forge/frontend/src/Model/Question.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export class Question {
constructor(id, question, answer, categoryID) {
this.id = id;
this.question = question;
this.answer = answer;
this.categoryID = categoryID;
this.choices = [];
}

addChoice(choice) {
this.choices.push(choice);
}

toJsonObject() {
return {
id: this.id,
question: this.question,
answer: this.answer,
categoryID: this.category
}
}
}
23 changes: 23 additions & 0 deletions trivia-forge/frontend/src/Model/User.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export class User {
constructor(id, date, email, password, profilePic) {
this.id = id;
this.date = date;
this.email = email;
this.password = password;
this.profilePic = profilePic;
this.games = [];
}

addGame(game) {
this.games.push(game);
}
toJsonObject() {
return {
id: this.id,
date: this.date,
email: this.email,
password: this.password,
profilePic: this.profilePic
}
}
}
Loading

0 comments on commit a78457d

Please sign in to comment.