Skip to content

Icon - #344

Open
Hitha245 wants to merge 2 commits into
fencer-so:mainfrom
Hitha245:icon
Open

Icon#344
Hitha245 wants to merge 2 commits into
fencer-so:mainfrom
Hitha245:icon

Conversation

@Hitha245

Copy link
Copy Markdown

What changed

This PR adds backend support for optional emoji icons on Goals, so the icon selected on the client can be persisted to MongoDB and returned by the API.

  • Models/Goal.cs: Added an optional Icon field (string?) to the Goal model. It's a plain string (not an ObjectId), so it needs no [BsonRepresentation] attribute — Mongo's driver serializes/deserializes it automatically. Existing seeded goals with no icon simply come back with "icon": null.
  • CommBank.Tests/GoalControllerTests.cs: Filled in the previously-empty GetForUser test, following the same Arrange/Act/Assert pattern as GetAll/Get — asserts the result isn't null and that every returned goal is assignable from Goal with the expected UserId.

Why

The frontend now lets users pick an emoji for a goal (via emoji-mart) and needs the server to accept and return that field so the icon persists across page refreshes. This closes the loop on the client → server → database round trip.

Testing

  • Verified via Postman that POST/PUT on /api/Goal now accepts an icon field and GET returns it.
  • Added unit test coverage for the previously-untested GetForUser route.

Notes for reviewers

No breaking changes — Icon is optional and nullable, so existing clients/documents are unaffected.

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