Provides various data collection endpoints to the faux-bingo plugin.
See BingoEndpoints.md for detailed API documentation.
This project is optimized for development using JetBrains Rider and Docker Compose.
- Docker & Docker Compose
- JetBrains Rider
- A
.envfile in the root directory (copy.env.exampleto.envif it doesn't exist).
To debug the API locally in Rider (on your host machine) while using a containerized database:
- Start the Database:
- Open the Docker tool window in Rider.
- Right-click
compose.dev.yamland select Run 'compose.dev.yaml: db'. - This starts Postgres and maps it to
localhost:5432.
- Configure API Run Configuration:
- Go to Run -> Edit Configurations.
- Select your
OSRSData.Apiprofile. - Add an environment variable to point to the local DB:
ConnectionStrings__DefaultConnection=Host=localhost;Database=OSRSData;Username=postgres;Password=postgres
- Set
ASPNETCORE_ENVIRONMENT=Development.
To run both the API and the Database in containers (closer to production):
- Right-click
compose.yamlin Rider and select Edit 'Docker Compose' Configuration. - In the Compose files field, ensure both
compose.yamlANDcompose.dev.yamlare selected. - Click Run.
- The API will be available at
http://localhost:5010.
You can use Rider's built-in Database tool window to inspect the containerized DB:
- Open the Database tool window (usually on the right).
- Click + -> Data Source -> PostgreSQL.
- Use the following settings:
- Host:
localhost - Port:
5432 - User/Password:
postgres/postgres - Database:
OSRSData
- Host:
This project uses Entity Framework Core for database management. Due to environment constraints where the Microsoft.AspNetCore.App runtime might not be available to the dotnet ef tool, migrations should be managed using the OSRSData.DAL project as both the target and the startup project.
A IDesignTimeDbContextFactory is provided in OSRSData.DAL to facilitate this.
To add a new migration, run the following command from the project root:
dotnet ef migrations add <MigrationName> --project OSRSData.DAL --startup-project OSRSData.DALTo remove the last migration:
dotnet ef migrations remove --project OSRSData.DAL --startup-project OSRSData.DALMigrations are automatically applied by the API on startup in Program.cs. However, if you need to apply them manually to a local database:
dotnet ef database update --project OSRSData.DAL --startup-project OSRSData.DALNote: Ensure the database is running (e.g., via docker compose up db) before applying migrations manually.