# Task: Backend feedback foundation

## Goal

Add the backend foundation for product feedback reports.

## Feature Spec

- `docs/FEATURES/product-feedback.md`

## Scope

- Add a new `Developer` identity role and seed it with the existing role setup.
- Add a new FastEndpoints module under `backend/src/Socialize.Api/Modules/Feedback`.
- Add feedback report data entities and EF Core model configuration.
- Add feedback enum/value support for:
  - type: `Bug`, `Suggestion`, `Request`
  - status: `New`, `Planned`, `Resolved`, `Won't Do`, `Cancelled`
- Add `DbSet` entries and module configuration to `AppDbContext`.
- Capture reporter id, reporter display fields, submitted route, browser metadata, viewport size, app version if available, and optional workspace/client/campaign/content context.
- Add API endpoints for:
  - submit feedback
  - list current user's feedback
  - get current user's feedback detail
  - list all feedback for `Developer`
  - get feedback detail for `Developer`
  - update feedback type/status/tags for `Developer`
  - cancel own feedback with optional reason
  - list previously used tags for `Developer`
- Enforce access rules:
  - authenticated users can submit feedback
  - reporters can view only their own feedback
  - developers can view all feedback
  - only developers can update type/status/tags
  - reporters can only move their own non-final report to `Cancelled`
- Keep assignment, priority, severity, duplicate linking, and deletion out of scope.

## Likely Files

- `backend/src/Socialize.Api/Modules/Identity/Contracts/KnownRoles.cs`
- `backend/src/Socialize.Api/Modules/Identity/DependencyInjection.cs`
- `backend/src/Socialize.Api/Data/AppDbContext.cs`
- `backend/src/Socialize.Api/Modules/Feedback/**`
- `backend/tests/Socialize.Tests/**`

## Notes

- Use FastEndpoints handlers and keep request/response records near their handlers unless local module patterns suggest otherwise.
- Use FluentValidation for non-trivial inputs.
- Treat feedback as global SaaS operator data, not workspace-owned workflow data.
- Tags are free-form but should be normalized enough to support search/filter suggestions later.

## Validation

```bash
dotnet build backend/Socialize.slnx
dotnet test backend/Socialize.slnx
```

## Done When

- [ ] `Developer` role exists and is seeded.
- [ ] Feedback reports can be submitted by authenticated users.
- [ ] Reporters can list and view only their own feedback.
- [ ] Developers can list and view all feedback.
- [ ] Developers can update type, status, and tags.
- [ ] Reporters can cancel their own feedback with an optional reason.
- [ ] Backend validation rejects invalid type/status transitions and missing descriptions.
- [ ] Backend tests cover access rules and core transitions.
