feat(repository): Add method for create status by observer
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"git.ostiwe.com/ostiwe-com/status/model"
|
"git.ostiwe.com/ostiwe-com/status/model"
|
||||||
"git.ostiwe.com/ostiwe-com/status/modules/db"
|
"git.ostiwe.com/ostiwe-com/status/modules/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Status interface {
|
type Status interface {
|
||||||
Add(status model.Status) error
|
Add(ctx context.Context, status model.Status) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type status struct {
|
type status struct {
|
||||||
@@ -19,6 +21,6 @@ func NewStatusRepository() Status {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s status) Add(status model.Status) error {
|
func (s status) Add(ctx context.Context, status model.Status) error {
|
||||||
return s.db.Create(&status).Error
|
return s.db.WithContext(ctx).Create(&status).Error
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user