Added Card model, updated database initialization, udated readme.

This commit is contained in:
2025-12-29 16:03:16 -06:00
parent 80c4deb674
commit 41d1cc4fc0
7 changed files with 161 additions and 32 deletions

View File

@@ -15,27 +15,40 @@ Follow these steps to set up your local PostgreSQL database:
If you haven't already, create a database and a user with appropriate permissions. You can use `psql` or a tool like pgAdmin.
```sql
-- Create the database
CREATE DATABASE "SDG-Backend";
-- Create the user
-- Create SDG-Backend-Admin
CREATE USER "SDG-Backend-Admin" WITH ENCRYPTED PASSWORD 'password';
-- Grant privileges
GRANT ALL PRIVILEGES ON DATABASE "SDG-Backend" TO "SDG-Backend-Admin";
-- Create the database
CREATE DATABASE "SDG-Backend" OWNER "SDG-Backend-Admin";
```
### 2. Configure Connection String
#### Initialize User Secrets
Run this in the project directory (`SDG-Backend-Barracuda\SDG-Backend-Barracuda`):
```bash
dotnet user-secrets init
```
#### Set the Connection String
Replace `password` if you used a different one during setup:
```bash
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Host=localhost;Database=SDG-Backend;Username=SDG-Backend-Admin;Password=password;Maximum Pool Size=100;"
```
## Development
### Installing Dependencies
The project uses `Npgsql` and `Dapper`. These can be installed via:
The project uses `Npgsql`, `Dapper`, and `Npgsql.DependencyInjection`.
```bash
dotnet add package Npgsql
dotnet add package Dapper
dotnet add package Npgsql.DependencyInjection
```
### Running the Application
From the root directory:
```bash
dotnet run --project SDG-Backend-Barracuda
```