Implement Thread model
This commit is contained in:
parent
98a44773d5
commit
7eb6d2d37e
22
PostText.pl
22
PostText.pl
|
@ -4,6 +4,26 @@
|
|||
# Jul 22
|
||||
|
||||
use Mojolicious::Lite -signatures;
|
||||
use Mojo::Pg;
|
||||
|
||||
# Load the local modules too
|
||||
use lib 'lib';
|
||||
use PostText::Model::Thread;
|
||||
|
||||
# Load Mojo plugins
|
||||
plugin 'Config';
|
||||
|
||||
# Helpers
|
||||
helper pg => sub {
|
||||
state $pg = Mojo::Pg->new(app->config->{app->mode}{'pg_string'})
|
||||
};
|
||||
|
||||
# Begin routing
|
||||
under sub ($c) {
|
||||
$c->session(expires => time() + 1800);
|
||||
|
||||
1;
|
||||
};
|
||||
|
||||
# Root redirect
|
||||
get '/', sub ($c) { $c->redirect_to('view') };
|
||||
|
@ -12,4 +32,6 @@ get '/view', sub ($c) {
|
|||
$c->render()
|
||||
};
|
||||
|
||||
app->secrets(app->config->{'secrets'}) || die $@;
|
||||
|
||||
app->start();
|
||||
|
|
|
@ -24,5 +24,6 @@ Run the tests locally (against development environment)
|
|||
|
||||
## TODOs
|
||||
|
||||
1. Where is prototype lmao
|
||||
1. Moar tests...
|
||||
1. Need migrations for PostText::Model::Thread
|
||||
1. Implement threads
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
package PostText::Model::Thread;
|
||||
|
||||
use Mojo::Base -base, -signatures;
|
||||
|
||||
has 'pg';
|
||||
|
||||
sub new($class, $pg, $pg_object) {
|
||||
bless {$pg => $pg_object}
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in a new issue