diff --git a/database.sql b/database.sql index 0727b9b..f5d2f5a 100644 --- a/database.sql +++ b/database.sql @@ -1,5 +1,5 @@ -- --- File generated with SQLiteStudio v3.4.4 on Tue. May 16 22:16:54 2023 +-- File generated with SQLiteStudio v3.4.4 on Mon. Aug. 19 01:39:05 2024 -- -- Text encoding used: UTF-8 -- @@ -8,7 +8,7 @@ BEGIN TRANSACTION; -- Table: categories DROP TABLE IF EXISTS categories; -CREATE TABLE categories (cat_id INTEGER NOT NULL ON CONFLICT ROLLBACK UNIQUE ON CONFLICT ROLLBACK, cat_rank INTEGER NOT NULL, cat_name TEXT, PRIMARY KEY (cat_id AUTOINCREMENT)); +CREATE TABLE categories (cat_id INTEGER NOT NULL ON CONFLICT ROLLBACK UNIQUE ON CONFLICT ROLLBACK, cat_rank INTEGER NOT NULL, cat_name TEXT, PRIMARY KEY (cat_id)); -- Table: posts DROP TABLE IF EXISTS posts; @@ -30,18 +30,11 @@ CREATE TABLE sessions ( -- Table: subforums DROP TABLE IF EXISTS subforums; -CREATE TABLE subforums (subf_id INTEGER PRIMARY KEY UNIQUE ON CONFLICT ROLLBACK NOT NULL ON CONFLICT ROLLBACK, subf_cat INTEGER REFERENCES categories (cat_id) NOT NULL, subf_rank INTEGER NOT NULL, subf_name TEXT NOT NULL ON CONFLICT ROLLBACK, subf_desc TEXT); +CREATE TABLE subforums (subf_id TEXT (1, 5) PRIMARY KEY UNIQUE ON CONFLICT ROLLBACK NOT NULL ON CONFLICT ROLLBACK, subf_cat INTEGER REFERENCES categories (cat_id) NOT NULL, subf_rank INTEGER NOT NULL, subf_name TEXT NOT NULL ON CONFLICT ROLLBACK, subf_desc TEXT); -- Table: threads DROP TABLE IF EXISTS threads; -CREATE TABLE threads ( - thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK, - thread_title TEXT NOT NULL ON CONFLICT ROLLBACK, - thread_subf INTEGER REFERENCES categories (cat_id), - PRIMARY KEY ( - thread_id AUTOINCREMENT - ) -); +CREATE TABLE threads (thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK, thread_title TEXT NOT NULL ON CONFLICT ROLLBACK, thread_subf TEXT (1, 5) REFERENCES categories (cat_id), PRIMARY KEY (thread_id AUTOINCREMENT)); -- Table: users DROP TABLE IF EXISTS users; diff --git a/lib/CharmBoard.pm b/lib/CharmBoard.pm index b24c6e3..abdb9fa 100644 --- a/lib/CharmBoard.pm +++ b/lib/CharmBoard.pm @@ -73,17 +73,17 @@ sub startup { action => 'index' ); # view subforum - $r->get('/subforum/:id')->to( + $r->get('/:id')->to( controller => 'Controller::ViewSubf', action => 'subf_view' ); # create thread - $r->get('/thread/new/:id')->to( + $r->get('/:id/new')->to( controller => 'Controller::NewThread', action => 'thread_compose' ); - $r->post('/thread/new/:id')->to( + $r->post('/:id/new')->to( controller => 'Controller::NewThread', action => 'thread_submit' ); diff --git a/lib/CharmBoard/Controller/NewThread.pm b/lib/CharmBoard/Controller/NewThread.pm index f4aa097..9db6b1c 100644 --- a/lib/CharmBoard/Controller/NewThread.pm +++ b/lib/CharmBoard/Controller/NewThread.pm @@ -43,7 +43,7 @@ sub thread_submit { or die "Please fill both the title and post content fields" } catch ($catch_error) { $self->flash(error => $catch_error); - $self->redirect_to('/thread/new/:id') + $self->redirect_to('/:id/new') } } diff --git a/lib/CharmBoard/Model/Schema/Source/Subforums.pm b/lib/CharmBoard/Model/Schema/Source/Subforums.pm index f2fd87a..ba0e786 100644 --- a/lib/CharmBoard/Model/Schema/Source/Subforums.pm +++ b/lib/CharmBoard/Model/Schema/Source/Subforums.pm @@ -10,8 +10,7 @@ use base qw(DBIx::Class::Core); __PACKAGE__->table('subforums'); __PACKAGE__->add_columns( subf_id => - { data_type => 'integer', - is_auto_increment => 1, + { data_type => 'text', is_nullable => 0, }, subf_cat => diff --git a/templates/index.html.ep b/templates/index.html.ep index 21b338a..aeb6b7d 100644 --- a/templates/index.html.ep +++ b/templates/index.html.ep @@ -14,7 +14,7 @@
<%= $_name %>
+ "><%= $_name %> <% end %> <% diff --git a/templates/subf.html.ep b/templates/subf.html.ep index 841023d..b8b94f7 100644 --- a/templates/subf.html.ep +++ b/templates/subf.html.ep @@ -15,7 +15,7 @@ <% if (! @thread_list) { %> Oops! Looks like there's no threads here yet. Maybe you'd -like to make one? +like to make one? <% } else { foreach my $thread_id (@thread_list) { %> <%= $thread_item->( diff --git a/templates/thread_compose.html.ep b/templates/thread_compose.html.ep index 28c2189..22337ea 100644 --- a/templates/thread_compose.html.ep +++ b/templates/thread_compose.html.ep @@ -3,7 +3,7 @@ <%= $self->board_name %> » <%= $cat_title %> » <%= $subf_title %> » new thread

-
+