Move Crypt and Schema into Model namespace (#6)

This commit is contained in:
ngoomie 2024-08-08 02:05:26 -06:00
parent 3735c17926
commit ebcaf364ac
15 changed files with 28 additions and 28 deletions

View File

@ -6,7 +6,7 @@ use warnings;
use experimental qw(try smartmatch);
use Mojo::Base 'Mojolicious', -signatures;
use CharmBoard::Schema;
use CharmBoard::Model::Schema;
# this method will run once at server start
sub startup {
@ -53,7 +53,7 @@ sub startup {
Valid options: 'sqlite', 'mariadb'"
}
our $schema = CharmBoard::Schema->connect(
our $schema = CharmBoard::Model::Schema->connect(
$_dsn,
$config->{database}->{user},
$config->{database}->{pass},

View File

@ -6,8 +6,8 @@ use warnings;
use experimental qw(try smartmatch);
use Mojo::Base 'Mojolicious::Controller', -signatures;
use CharmBoard::Crypt::Password;
use CharmBoard::Crypt::Seasoning;
use CharmBoard::Model::Crypt::Password;
use CharmBoard::Model::Crypt::Seasoning;
sub login {
my $self = shift;

View File

@ -6,7 +6,7 @@ use warnings;
use experimental qw(try smartmatch);
use Mojo::Base 'Mojolicious::Controller', -signatures;
use CharmBoard::Crypt::Password;
use CharmBoard::Model::Crypt::Password;
# initial registration page
sub register {

View File

@ -1,4 +1,4 @@
package CharmBoard::Crypt::Password;
package CharmBoard::Model::Crypt::Password;
use utf8;
use strict;
@ -6,7 +6,7 @@ use warnings;
use experimental qw(try smartmatch);
use Authen::Passphrase::Argon2;
use CharmBoard::Crypt::Seasoning;
use CharmBoard::Model::Crypt::Seasoning;
use Exporter qw(import);
our @EXPORT = qw(passgen passchk);
@ -42,16 +42,16 @@ sub passchk {
__END__
=pod
=head1 NAME
CharmBoard::Crypt::Password - password processing module
CharmBoard::Model::Crypt::Password - password processing module
=head1 SYNOPSIS
=begin perl
use CharmBoard::Crypt::Password;
use CharmBoard::Model::Crypt::Password;
($salt, $hash) = passgen($plaintextPassword);
$passwordVerification = passchk($salt, $hash, $plaintextPassword)
=end perl
=head1 DESCRIPTION
CharmBoard::Crypt::Password processes passwords, either processing
CharmBoard::Model::Crypt::Password processes passwords, either processing
new passwords for database storage, or checking passwords entered
when logging in to make sure they're correct.

View File

@ -1,4 +1,4 @@
package CharmBoard::Crypt::Seasoning;
package CharmBoard::Model::Crypt::Seasoning;
use utf8;
use strict;

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema;
package CharmBoard::Model::Schema;
use utf8;
use strict;

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Set::Categories;
package CharmBoard::Model::Schema::Set::Categories;
use utf8;
use strict;
@ -28,7 +28,7 @@ sub title_from_id {
__END__
=pod
=head1 NAME
CharmBoard::Schema::Set::Categories - DBIC ResultSet for the
CharmBoard::Model::Schema::Set::Categories - DBIC ResultSet for the
categories table
=head1 SYNOPSIS

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Set::Subforums;
package CharmBoard::Model::Schema::Set::Subforums;
use utf8;
use strict;

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Set::Threads;
package CharmBoard::Model::Schema::Set::Threads;
use utf8;
use strict;

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Source::Categories;
package CharmBoard::Model::Schema::Source::Categories;
use utf8;
use strict;

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Source::Posts;
package CharmBoard::Model::Schema::Source::Posts;
use utf8;
use strict;
@ -33,11 +33,11 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key('post_id');
__PACKAGE__->belongs_to(
user_id => 'CharmBoard::Schema::Source::Users',
user_id => 'CharmBoard::Model::Schema::Source::Users',
'user_id'
);
__PACKAGE__->belongs_to(
thread_id => 'CharmBoard::Schema::Source::Threads',
thread_id => 'CharmBoard::Model::Schema::Source::Threads',
'thread_id'
);

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Source::Session;
package CharmBoard::Model::Schema::Source::Session;
use utf8;
use strict;
@ -34,7 +34,7 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key('session_key');
__PACKAGE__->belongs_to(
user_id => 'CharmBoard::Schema::Source::Users',
user_id => 'CharmBoard::Model::Schema::Source::Users',
'user_id'
);

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Source::Subforums;
package CharmBoard::Model::Schema::Source::Subforums;
use utf8;
use strict;
@ -37,7 +37,7 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key('subf_id');
__PACKAGE__->belongs_to(
subf_cat => 'CharmBoard::Schema::Source::Categories',
subf_cat => 'CharmBoard::Model::Schema::Source::Categories',
{ 'foreign.cat_id' => 'self.subf_cat' }
);

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Source::Threads;
package CharmBoard::Model::Schema::Source::Threads;
use utf8;
use strict;
@ -33,11 +33,11 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key('thread_id');
__PACKAGE__->belongs_to(
thread_subf => 'CharmBoard::Schema::Source::Subforums',
thread_subf => 'CharmBoard::Model::Schema::Source::Subforums',
{ 'foreign.subf_id' => 'self.thread_subf' }
);
__PACKAGE__->belongs_to(
thread_op => 'CharmBoard::Schema::Source::Posts',
thread_op => 'CharmBoard::Model::Schema::Source::Posts',
{ 'foreign.post_id' => 'self.thread_op' }
);

View File

@ -1,4 +1,4 @@
package CharmBoard::Schema::Source::Users;
package CharmBoard::Model::Schema::Source::Users;
use utf8;
use strict;