FlavioAandres / FinancesApp

FinancesAPP to keep your finances handled
0 stars 0 forks source link

Categories Command [UPDATE/ADD/DELETE] #79

Closed AndresMorelos closed 3 years ago

AndresMorelos commented 3 years ago

Will fix #72

ScreenShots

image

Add

image

Delete

image image

Update

image image

AndresMorelos commented 3 years ago

Breaking Change

Steps to run before deploy it

  1. Replace in the User Model in the categories property from:

    {
            type: mongoose.Types.ObjectId,
            ref: CategoryModel,
            autopopulate: true
     }

    To:

    {
            label: String, 
            budget: {
                value: {
                    type: Number,
                    default: 0
                },
                current: {
                    type: Number,
                    default: 0
                },
                progress: {
                    type: Number,
                    default: 0
                }
            }, 
            value: String,
            type: {
                type: String,
                index: false,
                required: true,
                trim: true,
                enum: ['INCOME', 'EXPENSE']
            }
        }
  2. Run
     node ./devultis/migrationCategories/migrateCategories.js
  3. Then restore the User Model
  4. Run
     node ./devultis/migrationCategories/updateCategories.js
  5. Replace for Payment and Income Models category property from:

    { 
      type: String, 
      default: null 
    }

    To:

    {
            type: mongoose.Types.ObjectId,
            ref: CategoryModel,
            autopopulate: true
        }
  6. Run
     node ./devultis/migrationCategories/updatePaymentIncomesCategories.js