diff options
| author | xengineering <me@xengineering.eu> | 2026-08-13 20:53:24 +0200 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2026-08-15 19:56:51 +0200 |
| commit | 53a5b271eae38913307793fa9884856709c4f822 (patch) | |
| tree | 41cc0f119c25b581f0b3739e0c90faa4f0776c69 /model/recipes.go | |
| parent | 99cff9a3102c64cd146d524524001bd6ecb246c4 (diff) | |
| download | ceres-53a5b271eae38913307793fa9884856709c4f822.tar ceres-53a5b271eae38913307793fa9884856709c4f822.tar.zst ceres-53a5b271eae38913307793fa9884856709c4f822.zip | |
Add JSON-based API under `/api`
This commit provides an unstable JSON API for communication with an
upcoming Dart frontend.
Later it might be part of the public interface for integration into
other services. For this step it has to be ensured the semantics are not
changing a lot in the future which is currently out of scope.
Diffstat (limited to 'model/recipes.go')
| -rw-r--r-- | model/recipes.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/model/recipes.go b/model/recipes.go index e4fd1b8..09b51e7 100644 --- a/model/recipes.go +++ b/model/recipes.go @@ -7,13 +7,21 @@ import ( ) type RecipesElement struct { - Id int64 // TODO change to string - Title string - IsFavorite bool + Id int64 `json:"id"` // TODO change to string + Title string `json:"title"` + IsFavorite bool `json:"is_favorite"` } type Recipes []RecipesElement +func NewRecipes() Object { + return &Recipes{} +} + +func (r *Recipes) SetID(id int) { + // singleton object, ignoring ID +} + func (r *Recipes) Create(tx *sql.Tx) error { return fmt.Errorf("Impossible to create a recipe list") } |
