Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,8 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Local secrets (connection strings) - do not commit
CommBank-Server/Secrets.json
Secrets.json


4 changes: 3 additions & 1 deletion CommBank-Server/Models/Goal.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using MongoDB.Bson;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace CommBank.Models;
Expand All @@ -19,6 +19,8 @@ public class Goal

public DateTime Created { get; set; } = DateTime.Now;

public string? Icon { get; set; }

[BsonRepresentation(BsonType.ObjectId)]
public List<string>? TransactionIds { get; set; }

Expand Down
5 changes: 5 additions & 0 deletions CommBank-Server/Secrets.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"CommBank": "mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?retryWrites=true&w=majority"
}
}
24 changes: 21 additions & 3 deletions CommBank.Tests/GoalControllerTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CommBank.Controllers;
using CommBank.Controllers;
using CommBank.Services;
using CommBank.Models;
using CommBank.Tests.Fake;
Expand Down Expand Up @@ -66,9 +66,27 @@ public async void Get()
public async void GetForUser()
{
// Arrange

var goals = collections.GetGoals();
var users = collections.GetUsers();
IGoalsService goalsService = new FakeGoalsService(goals, goals[0]);
IUsersService usersService = new FakeUsersService(users, users[0]);
GoalController controller = new(goalsService, usersService);

// Act

var httpContext = new Microsoft.AspNetCore.Http.DefaultHttpContext();
controller.ControllerContext.HttpContext = httpContext;
var result = await controller.GetForUser(users[0].Id!);

// Assert
Assert.NotNull(result);
var index = 0;
foreach (Goal goal in result)
{
Assert.IsAssignableFrom<Goal>(goal);
Assert.Equal(goals[index].Id, goal.Id);
Assert.Equal(goals[index].Name, goal.Name);
index++;
}
Assert.Equal(goals.Count, result.Count);
}
}
58 changes: 58 additions & 0 deletions TASK5_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Task 5: Create a Pull Request – Instructions

Your branch **feature/goal-manager** is created and all changes are **committed** locally. You need to push to **your fork** and then open a PR on GitHub.

---

## Step 1: Fork the repository (if you haven’t already)

1. Go to: **https://github.com/fencer-so/commbank-server**
2. Click **Fork** (top right) to create a fork under your account (e.g. `https://github.com/deepakgoudasirsi/commbank-server`).

---

## Step 2: Add your fork as a remote and push

In your project folder (`cc`), run (replace `YOUR_GITHUB_USERNAME` with your GitHub username, e.g. `deepakgoudasirsi`):

```bash
cd /Users/deepakgouda/cc

# Add your fork as remote (name: myfork)
git remote add myfork https://github.com/YOUR_GITHUB_USERNAME/commbank-server.git

# Push your branch to your fork
git push -u myfork feature/goal-manager
```

If you already added a fork with a different remote name, use that name instead of `myfork` (e.g. `git push -u origin feature/goal-manager` if origin was changed to your fork).

---

## Step 3: Open the Pull Request on GitHub

1. Go to **your fork** on GitHub: `https://github.com/YOUR_GITHUB_USERNAME/commbank-server`
2. You should see a banner: **“feature/goal-manager had recent pushes”** with a button **“Compare & pull request”**. Click it.
- Or: switch branch to `feature/goal-manager`, then click **“Contribute”** → **“Open pull request”**.
3. Set:
- **Base repository:** `fencer-so/commbank-server`, branch **main**
- **Head repository:** `YOUR_GITHUB_USERNAME/commbank-server`, branch **feature/goal-manager**
4. **Title:** e.g. `Add Goal Manager: backend API, frontend UI, and tests`
5. **Description:** Copy the contents of **docs/PULL_REQUEST_DESCRIPTION.md** from this repo and paste into the PR description.
6. Click **“Create pull request”**.

---

## Step 4: Submit the task

1. Copy the URL of the new pull request (e.g. `https://github.com/fencer-so/commbank-server/pull/123`).
2. Put that link in the file **task5-submission.txt** (see below).
3. Upload **task5-submission.txt** where the task asks you to submit your file.

---

## Summary of what’s already done

- Branch **feature/goal-manager** created
- All relevant changes committed (backend, frontend, tests, data, docs)
- Push to **fencer-so/commbank-server** failed (no write access) — so you push to **your fork** and open a PR from there.
23 changes: 23 additions & 0 deletions commbank-web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
8 changes: 8 additions & 0 deletions commbank-web/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"trailingComma": "all",
"semi": false
}
1 change: 1 addition & 0 deletions commbank-web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CommBank Goal Tracker
Loading