Skip to content
jongwon edited this page Dec 16, 2020 · 3 revisions

nosql 모델링

// workspace
{
  _id: ObjectId,
  name: {
    type: String,
  },
  creator: {
    type: Schema.Types.ObjectId,
    ref: 'User',
  },
  profileUrl: {
    type: String,
  },
  default_channel: {
    type: Schema.Types.ObjectId,
    ref: 'Channel',
  },

  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
},
// user
{
  _id: ObjectId,
  OAuthId: {
    type: String,
  },
  fullName: {
    type: String,
  },
  isDeleted: {
    type: Boolean,
  },
  profileUrl: {
    type: String,
  },
}
// workspaceUserInfo
{
  _id: ObjectId,
  title: {
    type: String,
  },
  fullName: {
    type: String,
  },
  displayName: {
    type: String,
  },
  pause: {
    type: Date,
  },
  phoneNumber: {
    type: Number,
  },
  timeZone: {
    type: String,
  },
  profileUrl: {
    type: String,
  },
  status: {
    type: String,
  },
  expireStatus: {
    type: Date,
  },
  isAdmin: {
    type: Boolean,
  },
  isActive: {
    type: Boolean,
  },
  userId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
  },
  workspaceId: {
    type: Schema.Types.ObjectId,
    ref: 'Workspace',
  },
  sections: {
    type: Schema.Types.Array,
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
},
// follow
{
  _id: ObjectId,
  workspaceUserInfoId: {
    type: Schema.Types.ObjectId,
    ref: 'WorkspaceUserInfo',
  },
  chatId: {
    type: Schema.Types.ObjectId,
    ref: 'Chat',
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
},
// channel
{
  _id: ObjectId,
  title: {
    type: String,
    required: true,
  },
  description: {
    type: String,
  },
  topic: {
    type: String,
  },
  creator: {
    type: Schema.Types.ObjectId,
    ref: 'WorkspaceUserInfo',
    required: true,
  },
  channelType: {
    type: Number,
    required: true,
  },
  isDeleted: {
    type: Boolean,
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
}
//channelConfig
{
  _id: ObjectId,
  workspaceUserInfoId: {
    type: Schema.Types.ObjectId,
    ref: 'WorkspaceUserInfo',
  },
  channelId: {
    type: Schema.Types.ObjectId,
    ref: 'Channel',
  },
  readChatId: {
    type: Schema.Types.ObjectId,
    ref: 'Chat',
  },
  isMute: {
    type: Boolean,
  },
  notification: {
    type: Number,
  },
  sectionName: {
    type: String,
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
}
// chat
{
  _id: ObjectId,
  pinned: {
    type: Boolean,
  },
  contents: {
    type: String,
  },
  channel: {
    type: Schema.Types.ObjectId,
    ref: 'Channel',
  },
  creator: {
    type: Schema.Types.ObjectId,
    ref: 'WorkspaceUserInfo',
  },
  parentId: {
    type: Schema.Types.ObjectId,
    ref: 'Chat',
  },
  isDelete: {
    type: Boolean,
    default: false,
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
}
// file
{
  _id: ObjectId,
  path: {
    type: String,
  },
  fileType: {
    type: String,
  },
  name: {
    type: String,
  },
  originalName: {
    type: String,
  },
  creator: {
    type: Schema.Types.ObjectId,
    ref: 'User',
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
},
// reaction
{
  _id: ObjectId,
  workspaceUserInfoId: {
    type: Schema.Types.ObjectId,
    ref: 'WorkspaceUserInfo',
  },
  chatId: {
    type: Schema.Types.ObjectId,
    ref: 'Chat',
  },
  emoticon: {
    type: String,
  },
}
// userHistory
{
  _id: ObjectId,
  userId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
  },
  workspaceId: {
    type: Schema.Types.ObjectId,
    ref: 'Workspace',
  },
  path: {
    type: Schema.Types.ObjectId,
    ref: 'channelId',
  },
  createdAt: {
    type: Date,
  },
  updatedAt: {
    type: Date,
  }
},
Clone this wiki locally