From 6f668e71325b1ee6c735207198b958b108d8ab4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Sun, 20 Dec 2020 02:25:32 +0100 Subject: [PATCH] Zmena attributu --- lib/CF/Schema/Result/Announcement.pm | 17 +++++++++++++++-- sql/3/up.sql | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/CF/Schema/Result/Announcement.pm b/lib/CF/Schema/Result/Announcement.pm index 97b05ab..97c4159 100644 --- a/lib/CF/Schema/Result/Announcement.pm +++ b/lib/CF/Schema/Result/Announcement.pm @@ -18,10 +18,9 @@ __PACKAGE__->add_columns( }, qw( datetime - is_archived + deleted user_id type - state content link related_post_id @@ -32,4 +31,18 @@ __PACKAGE__->set_primary_key('id'); 1; +sub format { + my $self = shift; + my $announcement = { + id => $self->id, + datetime => $self->datetime, + type => $self->type, + content => $self->content, + link => $self->link, + related_post_id => $self->related_post_id, + }; + + return $announcement; + +} diff --git a/sql/3/up.sql b/sql/3/up.sql index 7c84966..87aa61b 100644 --- a/sql/3/up.sql +++ b/sql/3/up.sql @@ -1,7 +1,7 @@ create table "announcements" ( "id" integer not null default nextval('uid_seq'), "datetime" timestamp(0) not null default now(), - "is_archived" bool not null default 'false', + "deleted" timestamp(0), "user_id" integer, "type" integer not null, "content" text, -- GitLab