package Foorum::ResultSet::Share;

use strict;
use warnings;
use Foorum::Version; our $VERSION = $Foorum::VERSION;
use base 'DBIx::Class::ResultSet';

sub del_or_create {
    my ( $self, $cond ) = @_;

    my $count = $self->count($cond);
    if ($count) {
        $self->search($cond)->delete;
        return 0;
    } else {
        $cond->{time} = time();
        $self->create($cond);
        return 1;
    }
}

1;
