From dc1938dbb98dc9edf16558e505b2961246c83e6e Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Wed, 30 Oct 2024 21:59:53 +0100 Subject: Add API and Test --- Api/Utils/DbInit.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Api/Utils/DbInit.cs (limited to 'Api/Utils/DbInit.cs') diff --git a/Api/Utils/DbInit.cs b/Api/Utils/DbInit.cs new file mode 100644 index 0000000..0fc2d86 --- /dev/null +++ b/Api/Utils/DbInit.cs @@ -0,0 +1,25 @@ +using WikiWaka.Api.Models; + +public static class DbInit +{ + private static readonly Language[] languages = [ + new() { + Id = 1, + LanguageCode = "nb-NO", + }, + new() { + Id = 2, + LanguageCode = "nn-NO", + }, + new() { + Id = 3, + LanguageCode = "en-US", + }, + ]; + + public static async Task InitializeLanguages(DbWikiWakaContext db) + { + await db.Language.AddRangeAsync(languages); + _ = await db.SaveChangesAsync(); + } +} -- cgit v1.2.3