To run the code, navigate to the revibe folder and type 'flutter run' in the terminal.
Designing the data model for your Waste Reduction Tracker app:
-
User:
UserID
(Unique identifier)Username
Email
Password
(Hashed and salted)
GooglePayLink
(Link to the user's Google Pay account)
-
Reusable Item:
ItemID
(Unique identifier)ItemType
(e.g., Coffee Cup, Straw, Smoothie Cup, Takeaway Box)Assets
(Image etc)
-
Shop:
ShopID
(Unique identifier)ShopName
Location
(Latitude and Longitude, Address, etc)Category
(e.g., Cafe, Restaurant)AccumulationThreshold
(Total points required for a discount)DiscountAmount
(Amount of discount for a certain threshold)NGOList
(List of NGOs (IDs) partnering with the shop)
-
Transaction:
TransactionID
(Unique identifier)UserID
(Reference to the user making the purchase)ShopID
(Reference to the shop where the purchase is made)ScannableBarcode
(Generated by concatenating UserID and ItemID for scanning)PointsEarned
(Points earned for the transaction)DonationOption
(Boolean indicating whether the user opted for donation) if applicableDonationAmount
(Amount donated if donation option is selected) if applicable
-
NGO:
NGOID
(Unique identifier)NGOName
Cause
(e.g., Reforestation, Hunger)Advertisement
(Information about the NGO's cause and promotion)
-
User-Transaction: One-to-Many relationship. A user can have multiple transactions, and each transaction is associated with one user.
-
Shop-Transaction: One-to-Many relationship. A shop can have multiple transactions, and each transaction is associated with one shop.
-
Shop-NGO: Many-to-Many relationship. A shop can partner with multiple NGOs, and an NGO can partner with multiple shops.
-
Shop-ReusableItem: Many-to-Many relationship. A shop can accept multiple types of reusable items, and each reusable item is associated with any shop.
-
User-ReusableItem: Many-to-Many relationship. A user can have multiple reusable items, and each reusable item is associated with any user.
- ShopPointsConfiguration:
ShopID
(Reference to the shop)ItemID
(Reference to the reusable item)PointsConfig
(Customized points for each reusable item type)
After a user scans an item at the shop, the shop can retrieve the user's identity and the scanned item(s) using the ScannableBarcode
in the transaction record.
This model ensures that each user has a unique identity, and the scannable barcode is generated based on the concatenation of the user ID and item ID. Shops can have their own points configuration for different reusable items, and the transaction records will capture the relevant information for reporting and display at the shop's end.
- see here