Skip to content

Db Schema

gyim1345 edited this page Nov 23, 2020 · 6 revisions

Collections

erd

Mongoose schema

const user = new Schema(
  {
    authName: String,
    authId: Number,
  },
);
const accountBook = new Schema(
  {
    accountBookId: Number,
    accountBookName: String,
    accountBookAuthorizedUsers: [String],
  },
);
const transactions = new Schema(
  {
    accountBookId: Number,
    date: Date,
    category: String,
    paymentMethod: String,
    description: String,
    cost: Number,
    tag: [String],
    imageUrl: String,
    author: String,
  },
);
const paymentMethod = new Schema(
  {
    name: String
  },
);
const category = new Schema(
  {
    name: String
  },
);
const tag = new Schema(
  {
    name: String
  },
);

Db Collection sample

user

const user = [{
  "_id": 1,
  "authName": "name",
  "authId": 1234,
},]

accountBook

const accountBook = [{
  "_id": 1,
  "accountBookId": 1,
  "accountBookName": 'Name',
  "accountBookAuthorizedUsers": ['Name'],
},]

transactions

const transactions = [{
  "_id": 1,
  "accountBookId": 1,
  "date": "2020-01-15 14:20",
  "category": "food",
  "card": "naver card",
  "description": "λΆ„μ‹μ§‘μ—μ„œ 떑볢이 λ¨Ήμ—‡μœΌ~",
  "cost": 20000,
  "tag": ["뢄식집", "떑볢이"],
  "imageUrl": "https://www.asiatime.co.kr/news/data/20191217/p1065600532377147_587_thum.jpg",
  "author": "name",
},]

account

const account = [{
  "_id": 1,
  "name": "ν˜„λŒ€μΉ΄λ“œ",
},{
  "_id": 2,
  "name": "λ„€μ΄λ²„νŽ˜μ΄"
},]

category

const category = [{
  "_id": 1,
  "name": "food"
}, {
  "_id": 2,
  "name": "transportation"
}, {
  "_id": 3,
  "name": "education"
},]

tag

const tag = [{
  "_id": 1,
  "name": "뢄식집"
}, {
  "_id": 1,
  "name": "떑볢이"
},]

Clone this wiki locally