From aa3accb4127c492281530fcd77c749aed8d4fc0a Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Wed, 8 May 2024 01:34:16 +0000 Subject: [PATCH 1/2] use alpine image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cb5813c..b435921 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ COPY . . RUN dotnet publish "BinaryDad.Notes.csproj" -c Release -o /app/publish /p:UseAppHost=false -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base WORKDIR /app RUN mkdir notes COPY --from=build /app/publish . From e5cb210df235d13dcb55e6b55fbb39a597488c35 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 7 May 2024 21:43:09 -0400 Subject: [PATCH 2/2] method renames --- Controllers/ApiController.cs | 2 +- Controllers/NoteController.cs | 2 +- NoteHub.cs | 2 +- Services/FileNoteService.cs | 6 +++--- Services/INoteService.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs index 88d6c5d..049eb56 100644 --- a/Controllers/ApiController.cs +++ b/Controllers/ApiController.cs @@ -11,6 +11,6 @@ namespace BinaryDad.Notes.Controllers public ApiController(INoteService noteService) => this.noteService = noteService; [Route("note/{noteName}")] - public string Note(string noteName) => noteService.GetText(noteName); + public string Note(string noteName) => noteService.GetNote(noteName); } } diff --git a/Controllers/NoteController.cs b/Controllers/NoteController.cs index 67401d4..3f22767 100644 --- a/Controllers/NoteController.cs +++ b/Controllers/NoteController.cs @@ -18,7 +18,7 @@ public class NoteController : Controller var model = new ContentModel { CurrentNote = noteName, - Text = noteService.GetText(noteName), + Text = noteService.GetNote(noteName), NoteNames = noteService.GetNoteNames() }; diff --git a/NoteHub.cs b/NoteHub.cs index 44a9972..5e84bbc 100644 --- a/NoteHub.cs +++ b/NoteHub.cs @@ -25,7 +25,7 @@ namespace BinaryDad.Notes public async Task SaveNote(string content, string noteName) { - noteService.SaveText(content, noteName); + noteService.SaveNote(content, noteName); // find all other connections except for the current one var clientConnections = NoteContext.ClientNotes diff --git a/Services/FileNoteService.cs b/Services/FileNoteService.cs index cc8ffb2..6e6b0f8 100644 --- a/Services/FileNoteService.cs +++ b/Services/FileNoteService.cs @@ -16,7 +16,7 @@ } } - public string GetText(string noteName) + public string GetNote(string noteName) { CheckFile(noteName); @@ -30,7 +30,7 @@ .ToList(); } - public void SaveText(string content, string noteName) + public void SaveNote(string content, string noteName) { File.WriteAllText(GetFilePath(noteName), content); } @@ -51,7 +51,7 @@ { Directory.CreateDirectory(folderPath); - SaveText("Hi! Feel free to start typing. Everything will be saved soon after you are done typing.", noteName); + SaveNote("Hi! Feel free to start typing. Everything will be saved soon after you are done typing.", noteName); } } diff --git a/Services/INoteService.cs b/Services/INoteService.cs index 9ba6fc7..eef389b 100644 --- a/Services/INoteService.cs +++ b/Services/INoteService.cs @@ -3,8 +3,8 @@ public interface INoteService { ICollection GetNoteNames(); - string GetText(string noteName); - void SaveText(string content, string noteName); + string GetNote(string noteName); + void SaveNote(string content, string noteName); void DeleteNote(string noteName); } }