# Bonat app (Database) ### on the project, we will use the Mongo DB that is dependent on objects and collections. on the app, we have many schemas/models like: --- ## ads (Advertisement) | field | type | isRequired | Description| | ---------- | ------- | ---------- | -----------| | idMerchant | String | true | | | segments | Array | true | | | title | String | true | | | content | String | true | | | byMail | Boolean | true | | | bySms | Boolean | true | | | createdAt | Date | true | | --- ## Coupons |field|type|isRequired|Description | |--|--|--|--| |idMerchant|String|true| | |idCampaign|String|true| | |startDate|Date|true| | |discount|String|true| | |createdAt|Date|true| | |latestUpdate|Date|true| | |title|String|true| | |title_ar|String|true| | |description|String|true| | |description_ar|String|true| | |oldPrice|String|true| | |newPrice|String|true| | |expirationDate|Date|true| | |numAvailable|Number|true| | |idCampaignType|String|true| | |imageUrl|Array|false| | |idCity|Number|true| | |maxOwner|Number|true| | |numOfValidDays|Number|true| | |dashboardData|Object|true| | |is_reward|Boolean|true| | |is_active|Boolean|true| | |is_drafted|Boolean|true| | |activationDate|Date|false| | --- ### CouponStatistics ``` /*this is for statisticd*/``` |field|type|isRequired| Description | |--|--|--|--| | idCampaign |String | true| | | idMerchant |String | true| | | initialPrice | String| true| | | newPrice | String| true| | | discount | String| true| | | couponsAmount | Number| true| | | customerPerCoupon | Number| true| | | activeAfterPurchased | Number| true| | | leftCoupons | Number| true| | | expiredCoupons |Number | true| | | usedCoupons |Number | true| | | purchasedCoupons | Date| true| | | createdAt | Date| true| | | expirationDate | Date| true| | | is_active |Boolean | true| | | lastUpdate|Date|true| | --- ## Customers | field | type | isRequired | Description | | -------- | ---------------------- | ---------- | ------------------------------------------------------ | | segments | mongoose`/*ObjectId*/` | true | `this field have a referance from the segmants models` | |merchant|mongoose`/*ObjectId*/`| true |`this field have a referance from the Merchent models` | | idCustomer | String | true | | | customerData | Object | true | | | updatedAt | Date | true | have a default value`Date.now`| | createdAt | Date | true | have a default value `Date.now`| --- ### CustomersFeedback | field | type | isRequired | Description | | -------- | -------- | ---------- | ------- | | merchant|mongoose`/*ObjectId*/`| true |`this field have a referance from the Merchent models` | | customer | mongoose`/*ObjectId*/` | true | `this field have a referance from the Customers models` | | idCustomer | String | true | | | idMerchant | String | true | | | name | String | | | | message | String | | | | inboxId | String | true | this field unique| | email | String | | | | createdAt | Date | true | | | isnew | Nu | true | | | mood | String | | | | rate | Number | true | | | scale | Number | true | | --- ## DailyAverageSales | field | type | isRequired | Description | | -------- | -------- | -------- | --- | | idMerchant | String | true | | | date | Date | true | | | average | Number | true | | | total | Number | true | | | receiptsNumber | Number | true | | | customerIds | Array | true | | --- ### dailyVisit | field | type | isRequired | Description | | -------- | -------- | -------- | --- | | visitDate | Date | true | | | merchant | mongoose`/*ObjectId*/` | true | `this field have a referance from the Merchent models` | | newCustomers | Number | true | | | returnCustomers | Number | true | | --- ## DashboardBranchChart | field | type | isRequired | Description | | -------- | ---------- | ---------- | -------- | |merchant|mongoose`/*ObjectId*/`| true |`this field have a referance from the Merchent models` | | type | String | true | | | chartData | Object | true | | | idBranch | Number | | | | updatedAt | Date | | have a default value`Date.now`| | createdAt | Date | | have a default value `Date.now`| ---- ## DashboardChart | field | type| isRequired | Description | | -------- | ------- | ---------- | ------ | |merchant|mongoose`/*ObjectId*/`| true |`this field have a referance from the Merchent models` | | type | String | true | | | chartData | Object | true | | | updatedAt | Date | | have a default value`Date.now`| | createdAt | Date | | have a default value `Date.now`| --- ## DashboardBranchInsight | field | type | isRequired | Description | | -------- | -------- | ---------- | --------- | |merchant|mongoose`/*ObjectId*/`| true |`this field have a referance from the Merchent models` | | type | String | true | | | label | String | true | | | value | String | true | | | priority | Number | true | | | idBranch | Number | | | | createdAt | Date | | have a default value `Date.now`| | updatedAt | Date | | have a default value`Date.now`| --- ## DashboardInsight | field | type | isRequired | Description | | -------- | -------- | ---------- | --------- | |merchant|mongoose`/*ObjectId*/`| true |`this field have a referance from the Merchent models` | | type | String | true | | | label | String | true | | | value | String | true | | | priority | Number | true | | | createdAt | Date | | have a default value `Date.now`| | updatedAt | Date|| have a default value`Date.now`| --- ## Device | field | type | isRequired | Description | | -------- | -------- | ---------- | --------- | |deviceId|String| true |`unique` | | writeAPIKey | String | true | | | readAPIKey | String | true | | | mainUserId | String | true | | | subUsers | Array of object `/* the object has a userId key with the type string value*/` | true | | | components | Array of object `/* the object has two keys componentName key with a type string value and the other is the componentState with a number type */` | | | --- ### Device | field | type | isRequired | Description | | -------- | -------- | ---------- | --------- | |idBranch|Number| true |`unique` | | idMerchant | String | true | | | idDevice | Number | true | | | posIdBranch | String | true | |