From 1c4ba17ecf1bd56198ee992ba4fae61d1a2e4fa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Sat, 13 Nov 2021 16:49:42 +0100
Subject: [PATCH] Budeme ukladat jen id objednavky

---
 .gitlab-ci.yml                    |  2 +-
 lib/CF2022/Controller/Orders.pm   |  2 +-
 lib/CF2022/Schema/Result/Order.pm | 12 ++----------
 sql/1/up.sql                      |  3 ++-
 4 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 81ad2e1..ce5f551 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: docker:20.10.9
 
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
-  IMAGE_VER: 0.6.2
+  IMAGE_VER: 0.7.0
 
 services:
   - docker:20.10.9-dind
diff --git a/lib/CF2022/Controller/Orders.pm b/lib/CF2022/Controller/Orders.pm
index 6ea3a83..4d1778e 100644
--- a/lib/CF2022/Controller/Orders.pm
+++ b/lib/CF2022/Controller/Orders.pm
@@ -148,7 +148,7 @@ sub create ($c ) {
         email    => $order->{email},
         api      => $url,
         request  => $order,
-        response => $rc->json,
+        order_id => $rc->json->{code},
     });
 
     $c->render(
diff --git a/lib/CF2022/Schema/Result/Order.pm b/lib/CF2022/Schema/Result/Order.pm
index 7297438..688d208 100644
--- a/lib/CF2022/Schema/Result/Order.pm
+++ b/lib/CF2022/Schema/Result/Order.pm
@@ -14,12 +14,13 @@ __PACKAGE__->add_columns(
     qw(
         id
         created
+        deleted
         ip
         sso_uuid
+        order_id
         email
         api
         request
-        response
     ),
 );
 
@@ -34,13 +35,4 @@ __PACKAGE__->inflate_column('request', {
     },
 });
 
-__PACKAGE__->inflate_column('response', {
-    inflate => sub {
-        return from_json(shift);
-    },
-    deflate => sub {
-        return to_json(shift);
-    },
-});
-
 1;
diff --git a/sql/1/up.sql b/sql/1/up.sql
index 77abbe0..ce09935 100644
--- a/sql/1/up.sql
+++ b/sql/1/up.sql
@@ -3,11 +3,12 @@ create sequence "uid_seq" start 100000;
 create table "orders" (
     "id" integer not null default nextval('uid_seq'),
     "created" timestamp(0) not null default now(),
+    "deleted" timestamp(0),
     "ip" inet  not null,
     "sso_uuid" varchar(36),
+    "order_id" varchar(16),
     "email" text not null,
     "api" text not null,
     "request" text,
-    "response" text,
     primary key("id")
 );
-- 
GitLab