summaryrefslogtreecommitdiff
path: root/Api/Utils
diff options
context:
space:
mode:
authorLuca Matei Pintilie <luca@lucamatei.com>2024-10-30 20:59:53 +0000
committerLuca Matei Pintilie <luca@lucamatei.com>2024-10-30 20:59:53 +0000
commitdc1938dbb98dc9edf16558e505b2961246c83e6e (patch)
tree7953186976085ceca6c03a208d1ffd9596f745be /Api/Utils
parentfc3c7e3b3c955cc274d4668768466fecb8fb727b (diff)
downloadwikiwaka-master.tar
wikiwaka-master.tar.gz
wikiwaka-master.tar.bz2
wikiwaka-master.tar.lz
wikiwaka-master.tar.xz
wikiwaka-master.tar.zst
wikiwaka-master.zip
Add API and TestHEADmaster
Diffstat (limited to 'Api/Utils')
-rw-r--r--Api/Utils/DbInit.cs25
1 files changed, 25 insertions, 0 deletions
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();
+ }
+}