keanacobarde / BEDuo

0 stars 0 forks source link

SETUP - ERD + EF and PostgreSQL Setup #1

Closed keanacobarde closed 4 months ago

keanacobarde commented 4 months ago

User Story

Acceptance Criteria

Dependencies

Dev Notes

dotnet add package Microsoft.EntityFrameworkCore.Design --version 6.0

dotnet user-secrets init

dotnet user-secrets set "DbConnectionString" "Host=localhost;Port=5432;Username=postgres;Password=;Database=CreekRiver"


- Program.cs Modifications: 

using Microsoft.EntityFrameworkCore; using System.Text.Json.Serialization; using Microsoft.AspNetCore.Http.Json;

// ADDED ABOVE var app = builder.Build() // allows passing datetimes without time zone data AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

// allows our api endpoints to access the database through Entity Framework Core builder.Services.AddNpgsql(builder.Configuration["CreekRiverDbConnectionString"]);

// Set the JSON serializer options builder.Services.Configure(options => { options.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; });

builder.Services.AddCors(options => { options.AddDefaultPolicy(policy => { policy.WithOrigins("http://localhost:3000") .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); }); });

//ADDED AFTER BUILD app.UseCors();

keanacobarde commented 4 months ago

INITIAL VERSION OF ERD: image

keanacobarde commented 4 months ago

NEW AND IMPROVED ERD image