...docker test

This commit is contained in:
2026-06-18 18:35:56 -04:00
parent 5e1fe81473
commit 6a2a8abb22
31 changed files with 958 additions and 11 deletions
@@ -0,0 +1,45 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Chrono.Model;
namespace Server.Controllers;
[ApiController]
[Route("api/[controller]")]
public class NotesController : ControllerBase
{
private readonly AppDbContext _context;
public NotesController(AppDbContext context)
{
_context = context;
}
[HttpGet("{cardName}")]
public async Task<ActionResult<CardNote>> GetNote(string cardName)
{
var note = await _context.CardNotes.FindAsync(cardName);
if (note == null)
{
return Ok(new CardNote { CardName = cardName, Note = "" });
}
return Ok(note);
}
[HttpPost]
public async Task<ActionResult<CardNote>> UpdateNote(CardNote note)
{
var existing = await _context.CardNotes.FindAsync(note.CardName);
if (existing == null)
{
_context.CardNotes.Add(note);
}
else
{
existing.Note = note.Note;
}
await _context.SaveChangesAsync();
return Ok(note);
}
}