Switch from token to cookie auth

This commit is contained in:
2026-03-11 18:58:55 +00:00
parent 01f42c22d6
commit b3355831d8
9 changed files with 46 additions and 59 deletions

View File

@@ -13,8 +13,8 @@ using Seasoned.Backend.Data;
namespace Seasoned.Backend.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260306062007_InitialCreate")]
partial class InitialCreate
[Migration("20260311160009_AddRecipeFields")]
partial class AddRecipeFields
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -234,7 +234,8 @@ namespace Seasoned.Backend.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("Ingredients")

View File

@@ -8,7 +8,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Seasoned.Backend.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
public partial class AddRecipeFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@@ -168,7 +168,7 @@ namespace Seasoned.Backend.Migrations
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true),
Icon = table.Column<string>(type: "text", nullable: false),
Ingredients = table.Column<List<string>>(type: "text[]", nullable: false),
Instructions = table.Column<List<string>>(type: "text[]", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),

View File

@@ -231,7 +231,8 @@ namespace Seasoned.Backend.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("Ingredients")

View File

@@ -5,6 +5,9 @@ using Microsoft.EntityFrameworkCore;
using Seasoned.Backend.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using DotNetEnv;
Env.Load("../.env");
var builder = WebApplication.CreateBuilder(args);
@@ -49,7 +52,7 @@ var app = builder.Build();
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
db.Database.EnsureCreated();
db.Database.Migrate();
}
app.UseDefaultFiles();

View File

@@ -8,6 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="dotenv.net" Version="4.0.1" />
<PackageReference Include="DotNetEnv" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.13" />
<PackageReference Include="Mscc.GenerativeAI" Version="2.2.8" />

View File

@@ -42,12 +42,12 @@ public class RecipeService : IRecipeService
""instructions"": [""string"", ""string""]
}";
var config = new GenerationConfig {
var generationConfig = new GenerationConfig {
ResponseMimeType = "application/json",
Temperature = 0.1f
};
var request = new GenerateContentRequest(prompt, config);
var request = new GenerateContentRequest(prompt, generationConfig);
await Task.Run(() => request.AddMedia(base64Image, image.ContentType ?? "image/png"));