Skip to content

feat: adding Reading.cs model and Get, GetById and Post method#14

Merged
joaoferreira-dev merged 3 commits into
mainfrom
feature/Reading-Model
Feb 8, 2026
Merged

feat: adding Reading.cs model and Get, GetById and Post method#14
joaoferreira-dev merged 3 commits into
mainfrom
feature/Reading-Model

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions Bot commented Feb 8, 2026

No description provided.

@github-actions github-actions Bot requested a review from a team as a code owner February 8, 2026 13:50
@joaoferreira-dev joaoferreira-dev changed the title Automated PR feature/Reading-Model into Main feat: adding Reading.cs model and Get, GetById and Post method Feb 8, 2026
@joaoferreira-dev joaoferreira-dev linked an issue Feb 8, 2026 that may be closed by this pull request
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Reading” domain object and basic CRUD-ish API endpoints to persist and retrieve air-quality readings in the AirAware backend.

Changes:

  • Introduces Reading model and CreateReadingViewModel.
  • Adds Readings DbSet to AppDbContext.
  • Adds ReadingController with GET /readings, GET /readings/{id}, and POST /readings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
AirAware/ViewModels/CreateReadingViewModel.cs Adds request DTO for creating readings.
AirAware/Models/Reading.cs Introduces EF Core entity for readings, including station relationship and timestamps.
AirAware/Data/AppDbContext.cs Registers Readings set in EF Core context.
AirAware/Controllers/ReadingController.cs Adds REST endpoints to list, fetch by id, and create readings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AirAware/ViewModels/CreateReadingViewModel.cs
Comment thread AirAware/Models/Reading.cs
Comment thread AirAware/Controllers/ReadingController.cs
Comment thread AirAware/Controllers/ReadingController.cs Outdated
Comment thread AirAware/Controllers/ReadingController.cs
Comment on lines 8 to 12
public DbSet<Station> Stations { get; set; }
public DbSet<Reading> Readings { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
optionsBuilder.UseSqlite("DataSource=app.db;Cache=Shared");
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This PR adds a new Readings DbSet/entity, but the repo appears to have no EF Core migrations and no startup call to EnsureCreated()/Migrate(). Without schema initialization, hitting the new endpoints will fail at runtime with “no such table: Readings”. Add a migration (and document/apply it) or ensure the database is created/migrated on startup.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 8, 2026

@joaoferreira-dev I've opened a new pull request, #15, to work on those changes. Once the pull request is ready, I'll request review from you.

@joaoferreira-dev joaoferreira-dev merged commit b5f537e into main Feb 8, 2026
1 check passed
@joaoferreira-dev joaoferreira-dev deleted the feature/Reading-Model branch February 8, 2026 15:28
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.

Create Reading Model and all methods

3 participants