generated from VLADIMIR/template
add update status methods
This commit is contained in:
@@ -184,6 +184,31 @@ func (s *ScenariosRepo) UpdateScenarioByID(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ScenariosRepo) UpdateScenarioStatusByID(
|
||||
ctx context.Context,
|
||||
id int,
|
||||
status string,
|
||||
) error {
|
||||
tag, err := s.pool.Exec(
|
||||
ctx,
|
||||
`UPDATE scenarios
|
||||
SET
|
||||
status = $1,
|
||||
published_at = NOW(),
|
||||
updated_at = NOW()
|
||||
WHERE id = $2`,
|
||||
status,
|
||||
id,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tag.RowsAffected() == 0 {
|
||||
return ErrScenarioNotFound
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ScenariosRepo) DeleteScenarioByID(
|
||||
ctx context.Context,
|
||||
id int,
|
||||
|
||||
Reference in New Issue
Block a user