Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
feat: update settings schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
kndonetm committed Nov 20, 2023
1 parent 9c98706 commit 07e96d2
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
16 changes: 2 additions & 14 deletions src/models/depositSettingsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,12 @@ import { Schema } from 'mongoose'

// Import schema
import IndividualSettingSchema from './individualSettingSchema.js'
import TimeSettingSchema from './timeSettingSchema.js'

const DepositSettingsSchema = new Schema(
{
interest_rate: IndividualSettingSchema,
time: new Schema(
{
type: {
type: String,
enum: ['daily', 'monthly', 'yearly'],
default: 'monthly'
},
value: {
type: Schema.Types.BigInt,
default: 0
}
},
{ _id: false }
)
time: TimeSettingSchema
},
{ _id: false }
)
Expand Down
6 changes: 2 additions & 4 deletions src/models/individualSettingSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import { Schema } from 'mongoose'

const InvidualSettingSchema = new Schema(
{
type: {
unit: {
type: String,
required: true,
enum: ['percentage', 'fixed amount'],
default: 'percentage'
required: true
},
value: {
type: Number,
Expand Down
3 changes: 2 additions & 1 deletion src/models/loanSettingsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { Schema } from 'mongoose'

// Import schema
import IndividualSettingSchema from './individualSettingSchema.js'
import TimeSettingSchema from './timeSettingSchema.js'

const LoanSettingsSchema = new Schema(
{
interest_rate: IndividualSettingSchema,
service_fee: IndividualSettingSchema,
capital_build_up: IndividualSettingSchema,
savings: IndividualSettingSchema,
credit_life_insurance: IndividualSettingSchema
time: TimeSettingSchema
},
{ _id: false }
)
Expand Down
2 changes: 1 addition & 1 deletion src/models/loanTransactionSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LoanTransactionSchema = new Schema({
type: String,
required: true
},
transactionDate: {
transactionDatew: {
type: Date,
required: true
},
Expand Down
12 changes: 12 additions & 0 deletions src/models/notificationSettings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Packages
import { Schema, Model } from 'mongoose'

const NotificationSettingsSchema = new Schema({
notification_period_1: Number,
notification_period_2: Number,
notification_period_3: Number
})

const NotificationSettings = new Model('NotificationSettings', NotificationSettingsSchema)

export default NotificationSettings
16 changes: 16 additions & 0 deletions src/models/timeSettingSchema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Packages
import { Schema } from 'mongoose'

const TimeSettingSchema = new Schema({
type: {
type: String,
enum: ['daily', 'monthly', 'yearly'],
default: 'monthly'
},
value: {
type: Schema.Types.BigInt,
default: 0
}
})

export default TimeSettingSchema

0 comments on commit 07e96d2

Please sign in to comment.