Skip to content

DB 설계

Dongmin Shin edited this page Dec 19, 2020 · 9 revisions

Schema

User

{
    name: {
        type: String,
        trim: true,
    },
    email: {
        type: String,
        trim: true,
    },
    pwd: {
        type: String,
    },
    imageURL: {
        type: String,
        trim: true,
    },
    oauthId: {
        type: String,
        trim: true,
    },
    status: {
        type: Boolean,
    },
    projects: [
       {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Projects',
       },
    ],
    recentProject: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Projects',
    }
}

Project

 {
    title: {
      type: String,
      required: true,
      trim: true,
    },
    description: {
      type: String,
    },
    framework: {
      type: String,
    },
    dsn: {
      type: String,
    },
    owner: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'User',
    },
    members: [
      {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User',
      },
    ],
    issues: [
      {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Issue',
      },
    ],
  },
  {
    timestamps: true,
  }

ErrorEvent

{
  name: String,
  message: String,
  stack: String,
  content: String,
  issueId: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Issue',
  },
  projectId: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Project',
  },
  errArea: mongoose.Schema.Types.Mixed,
  date: {
    type: Date,
    default: Date.now,
  },
  tags: {},
  hash: String,
}

Issue

 {
    name: {
      type: String,
      required: true,
      trim: true,
    },
    resolved: {
      type: Boolean,
      default: false,
    },
    message: {
      type: String,
    },
    stack: {
      type: String,
    },
    projectId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Project',
    },
    groupHash: {
      type: String,
    },
    errorEvents: [
      {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'ErrorEvent',
      },
    ],
    assignee: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'User',
    },
    comments: [CommentSchema],
  },
  {
    timestamps: true,
  }

Comment

  {
    description: {
      type: String,
      required: true,
    },
    writer: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'User',
    },
    targetIssue: {
      type: String,
    },
  },
  {
    timestamps: true,
  }

Alert

   alertType: {
      type: mongoose.Schema.Types.Mixed,
      required: true,
    },

    issue: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Issue',
      default: null,
    },

    from: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Issue',
      default: null,
    },

    to: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Issue',
      default: null,
    },
    project: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Project',
      required: true,
    },
  },
  {
    timestamps: true,
  }

``
Clone this wiki locally