From 1cb83dbde6e4399457345fb4f7bdd228ce5b8474 Mon Sep 17 00:00:00 2001 From: aespin Date: Wed, 2 Oct 2024 13:35:38 +0200 Subject: [PATCH] wip --- README.md | 1 + internal/storage/storage.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e69de29..6e43ddc 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +# FALCON SYSTEM \ No newline at end of file diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 1ca79ba..f5f0226 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -11,6 +11,7 @@ import ( type Storager interface { StoreBarcode(ctx context.Context, in *types.Barcode) error + ConfirmBundle(ctx context.Context, barcode string) error } type storage struct { @@ -25,6 +26,11 @@ type DBConfig struct { Name string } +// ConfirmBundle implements Storager. +func (s *storage) ConfirmBundle(ctx context.Context, barcode string) error { + return s.db.Model(&types.BundleData{}).Where("nromatricula = ?", barcode).Update("confirmed", true).Error +} + // StoreBarcode implements IStorage. func (s *storage) StoreBarcode(ctx context.Context, in *types.Barcode) error { return s.db.Save(in).Error @@ -39,7 +45,6 @@ func ProductionDataBase(conf *DBConfig) (*gorm.DB, error) { conf.Name, conf.Port, ) - // create open database connection db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) if err != nil {