burguillos.info/lib/BurguillosInfo/Schema/Result/ConquerUser.pm

60 lines
1.4 KiB
Perl

package BurguillosInfo::Schema::Result::ConquerUser;
use v5.36.0;
use strict;
use warnings;
use parent 'DBIx::Class::Core';
use feature 'signatures';
__PACKAGE__->table('conquer_user');
__PACKAGE__->load_components("TimeStamp");
__PACKAGE__->add_columns(
uuid => {
data_type => 'uuid',
is_nullable => 0,
},
username => {
data_type => 'text',
is_nullable => 0,
},
encrypted_password => {
data_type => 'text',
is_nullable => 0,
},
last_activity => {
data_type => 'timestamp',
is_nullable => 0,
default_value => \'NOW()',
},
registration_date => {
data_type => 'timestamp',
is_nullable => 0,
default_value => \'NOW()',
},
is_admin => {
data_type => 'boolean',
is_nullable => 0,
default_value => \'0',
}
);
sub serialize_to_owner ($self) {
$self = $self->get_from_storage();
return {
kind => 'ConquerUser',
uuid => $self->uuid,
username => $self->username,
is_admin => $self->is_admin,
last_activity => $self->last_activity,
registration_date => $self->registration_date,
};
}
__PACKAGE__->set_primary_key('uuid');
__PACKAGE__->add_unique_constraint( "unique_constraint_username",
['username'] );
1;