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 {