MLH-Fellowship / CodeOfDuty

Gamified Sprint System
MIT License
3 stars 0 forks source link

MongoDB Database Schemas #8

Closed cqvu closed 3 years ago

cqvu commented 3 years ago

If possible, discuss the potential schema in the comment thread before implementation

ajwad-shaikh commented 3 years ago

Repository Model

ajwad-shaikh commented 3 years ago

Sprints Model

ajwad-shaikh commented 3 years ago

open to suggestions @cqvu @vrushti-mody

cqvu commented 3 years ago

@ajwad-shaikh Schema structure looks good. Could you make the mongoose schema definition files in the pull request as well?

https://mongoosejs.com/docs/guide.html

ajwad-shaikh commented 3 years ago

@cqvu made some changes to the Schema, I think this is a better representation

const sprintOverviewSchema = new mongoose.Schema({
  sprint_object: String,
  sprint_name: String,
  sprint_url: String,
});

const repoLevelContributorSchema = new mongoose.Schema({
  user: String,
  points_claimed: Number,
});

const sprintLevelContributorSchema = new mongoose.Schema({
  user: String,
  points_claimed: Number,
  points_at_stake: Number,
});

const taskSchema = new mongoose.Schema({
  issue_url: String,
  pr_url: String,
  task_status: String,
  contributor: String,
  reviewer: String,
  contributor_points: Number,
  reviewer_points: Number,
});

const repoSchema = new mongoose.Schema({
  _id: String,
  repo_url: String,
  maintainers: [String],
  past_sprints: [sprintOverviewSchema],
  active_sprints: [sprintOverviewSchema],
  contributors: [repoLevelContributorSchema],
});

const sprintSchema = new mongoose.Schema({
  repo: String,
  name: String,
  sprint_url: String,
  milestone_url: String,
  contributors: [sprintLevelContributorSchema],
  tasks: [taskSchema],
  boss_hp: Number,
  boss_hp_max: Number,
  victory_threshold: Number,
});