wip
This commit is contained in:
parent
cc3cd8cad0
commit
1cb83dbde6
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user