| 1 | package Smolder::DB::TestFile; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use base 'Smolder::DB'; | ||
| 5 | |||
| 6 | __PACKAGE__->set_up_table('test_file'); | ||
| 7 | |||
| 8 | __PACKAGE__->has_a( | ||
| 9 | mute_until => 'DateTime', | ||
| 10 | inflate => sub { DateTime->from_epoch(epoch => shift, time_zone => 'local') }, | ||
| 11 | deflate => sub { shift->epoch }, | ||
| 12 | ); | ||
| 13 | |||
| 14 | __PACKAGE__->has_many('comments' => 'Smolder::DB::TestFileComment', { order_by => 'added ASC' }); | ||
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | Smolder::DB::TestFile | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | L<Class::DBI> based model class for the 'test_file' table in the database. | ||
| 23 | |||
| 24 | =head1 METHODS | ||
| 25 | |||
| 26 | =head2 ACCESSSOR/MUTATORS | ||
| 27 | |||
| 28 | Each column in the borough table has a method with the same name that can be | ||
| 29 | used as an accessor and mutator. | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | sub is_muted { | ||
| 34 | my ($self) = @_; | ||
| 35 | |||
| 36 | my $mute_until = $self->mute_until; | ||
| 37 | my $is_muted = defined($mute_until) && time < $mute_until->epoch; | ||
| 38 | return $is_muted; | ||
| 39 | } | ||
| 40 | |||
| 41 | __PACKAGE__->has_a(project => 'Smolder::DB::Project'); | ||
| 42 | |||
| 43 | 1; |