Skip to content

feat(api): align REST endpoints with gRPC, introduce DTOs and refactor controllers #43#52

Open
Seraphim200001 wants to merge 5 commits into
szigh:masterfrom
Seraphim200001:master
Open

feat(api): align REST endpoints with gRPC, introduce DTOs and refactor controllers #43#52
Seraphim200001 wants to merge 5 commits into
szigh:masterfrom
Seraphim200001:master

Conversation

@Seraphim200001
Copy link
Copy Markdown

Work on Ticket: #43
feat(api): align REST endpoints with gRPC, introduce DTOs and refactor controllers

  • Added missing REST endpoints for full parity with gRPC:

    • GET /api/models
    • PUT /api/ModelConfigurations/{instrument}/config/random-additive-walk
    • GET /api/prices/{instrument}/history
  • Refactored existing controllers to use IInstrumentModelManager:

    • Replaced direct DbContext access with business logic layer
    • Ensures consistent validation, default config creation and event triggering
  • Introduced DTOs across controllers:

    • Replaced entity responses with typed response DTOs
    • Added request DTOs for all update/create operations
    • Standardized update responses via UpdateConfigResponseDto
  • Aligned REST responses with gRPC semantics:

    • Consistent message + success flags
    • Matching field names and structures (e.g. ActiveModel, TickIntervalMs)
    • Unified configuration response structure
  • Improved API consistency and maintainability:

    • Removed anonymous object responses
    • Centralized mapping logic via DTO mappers
    • Prepared controllers for proper OpenAPI/Swagger documentation

- added missing endpoints (models, history, random-additive-walk)
- replaced direct DB access with InstrumentModelManager
- introduced request/response DTOs
- aligned REST responses with gRPC semantics
- added missing endpoints (models, history, random-additive-walk)
- replaced direct DB access with InstrumentModelManager
- introduced request/response DTOs
- aligned REST responses with gRPC semantics
@szigh szigh self-requested a review March 30, 2026 09:32
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add back the csproj

Comment thread .gitignore Outdated
!README.md
!LOGGING.md
!TESTING.md
/MarketData/MarketData.csproj
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a mistake

Copy link
Copy Markdown
Owner

@szigh szigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update the test project to use the new DTOs - it shouldn't be a big task but let me know if you can't do it and I will update.

Same with adding new tests for the new endpoints you added.

Good idea using the same service that gRPC uses (rather than directly accessing the dbContext)

  • adding a third controller is a good shout. I will probably do the same with proto at some point (3 controllers/protos for Instruments+Models+Prices).

Thanks for the contribution

@Seraphim200001
Copy link
Copy Markdown
Author

@szigh I’m so sorry, but I’ve unfortunately fallen ill, so my work will be a little delayed. If you don’t mind waiting, I’ll finish everything as soon as I’m back! However, if you’d like to finish earlier, you’re welcome to start on the test cases yourself. Thank you so much for your understanding!

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.

3 participants