Skip to content

Conversation

@aryanthopate
Copy link

🎯 Overview

This PR implements complete backend API functionality for the CommBank server, including MongoDB integration, icon support, and the GetForUserAsync endpoint for user-specific goal retrieval.

✅ Features Implemented

1. MongoDB Integration & Database Seeding

  • Connected to MongoDB Atlas cluster
  • Implemented complete database seeding with sample data
  • Added users, accounts, goals, transactions, and tags
  • Included sample icons for comprehensive testing

2. Updated Goal Model with Icon Field

  • Added optional public string? Icon { get; set; } field
  • Maintained MongoDB BSON serialization attributes
  • Ensured backward compatibility with existing data

3. Complete GoalsService Implementation

  • Implemented all CRUD operations for goals
  • Added GetForUserAsync method for user-specific queries
  • Proper MongoDB.Driver integration with async/await
  • Comprehensive error handling and data validation

4. Enhanced GoalController

  • Added GetForUser endpoint: GET /api/Goal/User/{id}
  • Updated all endpoints to support icon field
  • Proper HTTP status codes and error responses
  • Full REST API compliance

5. Database Seeding System

  • Automatic database population on startup
  • Sample data with icons for testing
  • Clean data management and reset functionality
  • Production-ready seeding implementation

🔧 Technical Implementation

Files Modified:

  • Models/Goal.cs - Added Icon field with MongoDB attributes
  • Services/GoalsService.cs - Complete service layer implementation
  • Services/IGoalsService.cs - Updated interface with GetForUserAsync
  • Controllers/GoalController.cs - Added GetForUser endpoint
  • Data/SeedDatabase.cs - Database seeding implementation
  • Program.cs - Updated to call seeding on startup
  • Secrets.json - MongoDB connection configuration

API Integration:

  • ✅ MongoDB Atlas connection established
  • ✅ Complete CRUD operations for goals
  • ✅ User-specific goal retrieval
  • ✅ Icon field persistence across all operations
  • ✅ Proper error handling and validation

🎨 Database Schema

Goal Collection Structure:

{
  "_id": "ObjectId",
  "name": "string",
  "targetAmount": "number",
  "targetDate": "Date",
  "balance": "number",
  "created": "Date",
  "userId": "ObjectId",
  "transactionIds": ["ObjectId"],
  "tagIds": ["ObjectId"],
  "icon": "string"  // ✅ NEW FIELD
}

@gitguardian
Copy link

gitguardian bot commented Jan 19, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- - MongoDB Credentials 2e8056d CommBank-Server/Secrets.json View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant