$history = SL::DB::BackgroundJobHistory
->new(package_name => $self->package_name,
run_at => $run_at,
- status => 'success',
+ status => SL::DB::BackgroundJobHistory::SUCCESS(),
result => $result,
data => $self->data);
$history->save;
$history = SL::DB::BackgroundJobHistory
->new(package_name => $self->package_name,
run_at => $run_at,
- status => 'failure',
+ status => SL::DB::BackgroundJobHistory::FAILURE(),
error_col => $error,
data => $self->data);
$history->save;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::BackgroundJobHistory;
use strict;
__PACKAGE__->meta->initialize;
+use constant SUCCESS => 'success';
+use constant FAILURE => 'failure';
+
+sub has_succeeded { $_[0] && (($_[0]->status || '') eq SUCCESS()) }
+sub has_failed { $_[0] && (($_[0]->status || '') eq FAILURE()) }
+
1;