From 3cf3b22c86bd24ab9f97171bb2f9fc3893c66c9a Mon Sep 17 00:00:00 2001
From: FahrianAfdholi <16521492@mahasiswa.itb.ac.id>
Date: Mon, 30 Oct 2023 17:58:20 +0700
Subject: [PATCH] add: repo

---
 .env                             |  1 -
 Dockerfile                       |  4 ++--
 server/controller/auth/Fact.php  |  2 +-
 server/controller/auth/Meals.php |  2 +-
 server/handler/data/Content.php  | 12 ++++++------
 server/handler/data/Meal.php     | 24 ++++++++++++------------
 6 files changed, 22 insertions(+), 23 deletions(-)
 delete mode 100644 .env

diff --git a/.env b/.env
deleted file mode 100644
index 34f9062..0000000
--- a/.env
+++ /dev/null
@@ -1 +0,0 @@
-DB_PASSWORD=kelompokD
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index b2f593e..67f37f2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
 FROM php:latest
 
-WORKDIR /app
+WORKDIR /app/nutricraft-app
 
 RUN apt-get update
 
@@ -12,4 +12,4 @@ COPY . .
 
 EXPOSE 3000
 
-CMD [ "php", "-S", "0.0.0.0:3000" ]
\ No newline at end of file
+CMD [ "php", "-S", "0.0.0.0:3001" ]
\ No newline at end of file
diff --git a/server/controller/auth/Fact.php b/server/controller/auth/Fact.php
index df8fd22..049fa66 100644
--- a/server/controller/auth/Fact.php
+++ b/server/controller/auth/Fact.php
@@ -10,7 +10,7 @@ $content = new Content();
 if(isset($_GET['select'])){
     $select = $_GET['select'];
     $page = $_GET['page'];
-    $page = ($page-1)*2;
+    $page = ($page-1)*10;
     if(isset($_GET['search'])){
         $search = $_GET['search'];
         $result = $content->FindByTitle($search, $select, $page);
diff --git a/server/controller/auth/Meals.php b/server/controller/auth/Meals.php
index 6b11d1c..b3e1db7 100644
--- a/server/controller/auth/Meals.php
+++ b/server/controller/auth/Meals.php
@@ -13,7 +13,7 @@ $kiri = $_GET['lowRange'];
 $kanan = $_GET['highRange'];
 $sort = $_GET['sort'];
 $page = $_GET['page'];
-$page = ($page-1)*2;
+$page = ($page-1)*10;
 $show = $_GET['show'];
 
 
diff --git a/server/handler/data/Content.php b/server/handler/data/Content.php
index d9258f3..61c1163 100644
--- a/server/handler/data/Content.php
+++ b/server/handler/data/Content.php
@@ -160,7 +160,7 @@ class Content
                             c.created_at as created_at,
                             c.updated_at as updated_at
                             FROM content c ORDER BY c.title ASC
-                            LIMIT 2 OFFSET $page");
+                            limit 10 OFFSET $page");
         }else if($select){
             $exec = pg_query($conn, "SELECT c.id id,c.title title,c.highlight highlight,c.body body,
                             (SELECT p.path FROM file p WHERE c.id_photo_highlight = p.id) as path_photo,
@@ -169,7 +169,7 @@ class Content
                             c.created_at as created_at,
                             c.updated_at as updated_at
                             FROM content c ORDER BY c.created_at DESC
-                            LIMIT 2 OFFSET $page");
+                            LIMIT 10 OFFSET $page");
         }else{
             $exec = pg_query($conn, "SELECT c.id id,c.title title,c.highlight highlight,c.body body,
                             (SELECT p.path FROM file p WHERE c.id_photo_highlight = p.id) as path_photo,
@@ -178,7 +178,7 @@ class Content
                             c.created_at as created_at,
                             c.updated_at as updated_at
                             FROM content c ORDER BY c.created_at ASC
-                            LIMIT 2 OFFSET $page");
+                            LIMIT 10 OFFSET $page");
         }
 
         // $exec = pg_query($conn, "SELECT * FROM content ORDER BY created_at");
@@ -252,7 +252,7 @@ class Content
                             c.created_at as created_at,
                             c.updated_at as updated_at
                             FROM content c WHERE c.title ILIKE '%$title%' ORDER BY c.title ASC
-                            LIMIT 2 OFFSET $page");
+                            LIMIT 10 OFFSET $page");
         }else if($select == 'Newest'){
             $exec = pg_query($conn, "SELECT c.id id,c.title title,c.highlight highlight,c.body body,
                             (SELECT p.path FROM file p WHERE c.id_photo_highlight = p.id) as path_photo,
@@ -261,7 +261,7 @@ class Content
                             c.created_at as created_at,
                             c.updated_at as updated_at
                             FROM content c WHERE c.title ILIKE '%$title%' ORDER BY c.created_at DESC
-                            LIMIT 2 OFFSET $page");
+                            LIMIT 10 OFFSET $page");
         }else{
             $exec = pg_query($conn, "SELECT c.id id,c.title title,c.highlight highlight,c.body body,
                             (SELECT p.path FROM file p WHERE c.id_photo_highlight = p.id) as path_photo,
@@ -270,7 +270,7 @@ class Content
                             c.created_at as created_at,
                             c.updated_at as updated_at
                             FROM content c WHERE c.title ILIKE '%$title%' ORDER BY c.created_at ASC
-                            LIMIT 2 OFFSET $page");
+                            LIMIT 10 OFFSET $page");
         }
 
         $result = array();
diff --git a/server/handler/data/Meal.php b/server/handler/data/Meal.php
index 7763d4f..c77099b 100644
--- a/server/handler/data/Meal.php
+++ b/server/handler/data/Meal.php
@@ -118,18 +118,18 @@ class Meal
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.calorie <= '$right' AND m.calorie >= '$left' ORDER BY m.title ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else if($sort == "Calories: low to high"){
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at FROM meals m WHERE m.calorie <= '$right' AND m.calorie >= '$left' ORDER BY m.calorie ASC 
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else{
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.calorie <= '$right' AND m.calorie >= '$left' ORDER BY m.calorie DESC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }
         $result = array();
 
@@ -214,19 +214,19 @@ class Meal
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE (m.title ILIKE '%$title%' OR m.highlight ILIKE '%$title%') AND m.calorie <= '$right' AND m.calorie >= '$left' ORDER BY m.title ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else if($sort == "Calories: low to high"){
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at 
                                             FROM meals m WHERE (m.title ILIKE '%$title%' OR m.highlight ILIKE '%$title%') AND m.calorie <= '$right' AND m.calorie >= '$left' ORDER BY m.calorie ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else{
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE (m.title ILIKE '%$title%' OR m.highlight ILIKE '%$title%') AND m.calorie <= '$right' AND m.calorie >= '$left' ORDER BY m.calorie DESC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }
         $result = array();
 
@@ -319,19 +319,19 @@ class Meal
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.title ILIKE '%$title%' AND m.calorie <= '$right' AND m.calorie >= '$left' AND m.type = '$type' ORDER BY m.title ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else if($sort == "Calories: low to high"){
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.title ILIKE '%$title%' AND m.calorie <= '$right' AND m.calorie >= '$left' AND m.type = '$type' ORDER BY m.calorie ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else{
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.title ILIKE '%$title%' AND m.calorie <= '$right' AND m.calorie >= '$left' AND m.type = '$type' ORDER BY m.calorie DESC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }
 
         $result = array();
@@ -407,19 +407,19 @@ class Meal
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.calorie <= '$right' AND m.calorie >= '$left' AND m.type = '$type' ORDER BY m.title ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else if($sort == "Calories: low to high"){
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.calorie <= '$right' AND m.calorie >= '$left' AND m.type = '$type' ORDER BY m.calorie ASC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }else{
             $exec = pg_query($conn, "SELECT m.id id, m.title title, m.highlight highlight, m.description description, m.type type, m.calorie calorie,
                                             (SELECT path FROM file f WHERE f.id = m.id_file) as path_photo,
                                             m.created_at created_at, m.updated_at updated_at
                                             FROM meals m WHERE m.calorie <= '$right' AND m.calorie >= '$left' AND m.type = '$type' ORDER BY m.calorie DESC
-                                            LIMIT 2 OFFSET $page");
+                                            LIMIT 10 OFFSET $page");
         }
 
 
-- 
GitLab