WIP first entry creation

This commit is contained in:
Niko Abeler 2023-07-06 19:42:54 +02:00
parent ff193f62e9
commit 8fc82b86a3
4 changed files with 9 additions and 1 deletions

3
.gitignore vendored
View File

@ -24,3 +24,6 @@ users/
.vscode/ .vscode/
*.swp *.swp
*.db

View File

@ -2,6 +2,7 @@ package main
import ( import (
"owl-blogs/app" "owl-blogs/app"
"owl-blogs/domain/model"
"owl-blogs/infra" "owl-blogs/infra"
"owl-blogs/web" "owl-blogs/web"
) )
@ -9,6 +10,9 @@ import (
func main() { func main() {
db := infra.NewSqliteDB("owlblogs.db") db := infra.NewSqliteDB("owlblogs.db")
registry := app.NewEntryTypeRegistry() registry := app.NewEntryTypeRegistry()
registry.Register(&model.ImageEntry{})
repo := infra.NewEntryRepository(db, registry) repo := infra.NewEntryRepository(db, registry)
entryService := app.NewEntryService(repo) entryService := app.NewEntryService(repo)
webApp := web.NewWebApp(entryService) webApp := web.NewWebApp(entryService)

Binary file not shown.

View File

@ -39,7 +39,8 @@ func (h *EditorHandler) HandlePost(c *fiber.Ctx) error {
// create entry // create entry
now := time.Now() now := time.Now()
err = h.entrySvc.Create(&model.ImageEntry{}, &now, metaData) entry := &model.ImageEntry{}
err = h.entrySvc.Create(entry, &now, metaData.MetaData())
if err != nil { if err != nil {
return err return err
} }