diff --git a/migrations/db/wbd.sql b/migrations/db/wbd.sql
index d79cfb7492626af7109634484921a79117e1ef52..c912a00042180f5107249d0eb473ed062deb6d6b 100644
--- a/migrations/db/wbd.sql
+++ b/migrations/db/wbd.sql
@@ -27,8 +27,8 @@ CREATE TABLE `favorite` (
   `film_id` int(11) NOT NULL,
   PRIMARY KEY (`user_id`,`film_id`),
   KEY `film_id` (`film_id`),
-  CONSTRAINT `favorite_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`),
-  CONSTRAINT `favorite_ibfk_2` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`)
+  CONSTRAINT `favorite_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE,
+  CONSTRAINT `favorite_ibfk_2` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
@@ -59,6 +59,7 @@ CREATE TABLE `film` (
   `description` text DEFAULT NULL,
   `cast` varchar(255) NOT NULL,
   `genre` varchar(255) NOT NULL,
+  `last_updated` datetime NOT NULL,
   PRIMARY KEY (`film_id`)
 ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
@@ -69,7 +70,7 @@ CREATE TABLE `film` (
 
 LOCK TABLES `film` WRITE;
 /*!40000 ALTER TABLE `film` DISABLE KEYS */;
-INSERT INTO `film` VALUES (1,'files/img/film1.jpg','files/trailer/film1.mp4','The Shawshank Redemption',1994,'Frank Darabont','Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.','Tim Robbins, Morgan Freeman','Drama'),(2,'files/img/film2.jpg','files/trailer/film2.mp4','The Godfather',1972,'Francis Ford Coppola','An organized crime dynasty\'s aging patriarch transfers control of his clandestine empire to his reluctant son.','Marlon Brando, Al Pacino','Crime'),(3,'files/img/film3.jpg','files/trailer/film3.mp4','Pulp Fiction',1994,'Quentin Tarantino','The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits intertwine in four tales of violence and redemption.','John Travolta, Uma Thurman','Crime'),(4,'files/img/film4.jpg','files/trailer/film4.mp4','The Dark Knight',2008,'Christopher Nolan','When the menace known as the Joker emerges from his mysterious past, he wreaks havoc and chaos on the people of Gotham. The Dark Knight must accept one of the greatest psychological and physical tests of his ability to fight injustice.','Christian Bale, Heath Ledger','Action'),(5,'files/img/film5.jpg','files/trailer/film5.mp4','Forrest Gump',1994,'Robert Zemeckis','The presidencies of Kennedy and Johnson, the events of Vietnam, Watergate, and other historical events unfold through the perspective of an Alabama man with an IQ of 75, whose only desire is to be reunited with his childhood sweetheart.','Tom Hanks, Robin Wright','Drama'),(6,'files/img/film6.jpg','files/trailer/film6.mp4','The Matrix',1999,'Lana Wachowski, Lilly Wachowski','A computer programmer discovers that reality as he knows it is a simulation created by machines to subjugate humanity.','Keanu Reeves, Laurence Fishburne','Action'),(7,'files/img/film7.jpg','files/trailer/film7.mp4','Schindler\'s List',1993,'Steven Spielberg','In German-occupied Poland during World War II, industrialist Oskar Schindler gradually becomes concerned for his Jewish workforce after witnessing their persecution by the Nazis.','Liam Neeson, Ralph Fiennes','Biography'),(8,'files/img/film8.jpg','files/trailer/film8.mp4','Fight Club',1999,'David Fincher','An insomniac office worker and a devil-may-care soapmaker form an underground fight club that evolves into something much, much more.','Brad Pitt, Edward Norton','Drama'),(9,'files/img/film9.jpg','files/trailer/film9.mp4','Inception',2010,'Christopher Nolan','A thief who steals corporate secrets through the use of dream-sharing technology is given the inverse task of planting an idea into the mind of a C.E.O.','Leonardo DiCaprio, Joseph Gordon-Levitt','Action'),(10,'files/img/film10.jpg','files/trailer/film10.mp4','The Lord of the Rings: The Return of the King',2003,'Peter Jackson','Gandalf and Aragorn lead the World of Men against Sauron\'s army to draw his gaze from Frodo and Sam as they approach Mount Doom with the One Ring.','Elijah Wood, Ian McKellen','Adventure');
+INSERT INTO `film` VALUES (1,'files/img/film1.jpg','files/trailer/film1.mp4','The Shawshank Redemption',1994,'Frank Darabont','Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.','Tim Robbins, Morgan Freeman','Drama','2023-11-13 19:32:23'),(2,'files/img/film2.jpg','files/trailer/film2.mp4','The Godfather',1972,'Francis Ford Coppola','An organized crime dynasty\'s aging patriarch transfers control of his clandestine empire to his reluctant son.','Marlon Brando, Al Pacino','Crime','2023-11-13 19:32:23'),(3,'files/img/film3.jpg','files/trailer/film3.mp4','Pulp Fiction',1994,'Quentin Tarantino','The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits intertwine in four tales of violence and redemption.','John Travolta, Uma Thurman','Crime','2023-11-13 19:32:23'),(4,'files/img/film4.jpg','files/trailer/film4.mp4','The Dark Knight',2008,'Christopher Nolan','When the menace known as the Joker emerges from his mysterious past, he wreaks havoc and chaos on the people of Gotham. The Dark Knight must accept one of the greatest psychological and physical tests of his ability to fight injustice.','Christian Bale, Heath Ledger','Action','2023-11-13 19:32:23'),(5,'files/img/film5.jpg','files/trailer/film5.mp4','Forrest Gump',1994,'Robert Zemeckis','The presidencies of Kennedy and Johnson, the events of Vietnam, Watergate, and other historical events unfold through the perspective of an Alabama man with an IQ of 75, whose only desire is to be reunited with his childhood sweetheart.','Tom Hanks, Robin Wright','Drama','2023-11-13 19:32:23'),(6,'files/img/film6.jpg','files/trailer/film6.mp4','The Matrix',1999,'Lana Wachowski, Lilly Wachowski','A computer programmer discovers that reality as he knows it is a simulation created by machines to subjugate humanity.','Keanu Reeves, Laurence Fishburne','Action','2023-11-13 19:32:23'),(7,'files/img/film7.jpg','files/trailer/film7.mp4','Schindler\'s List',1993,'Steven Spielberg','In German-occupied Poland during World War II, industrialist Oskar Schindler gradually becomes concerned for his Jewish workforce after witnessing their persecution by the Nazis.','Liam Neeson, Ralph Fiennes','Biography','2023-11-13 19:32:23'),(8,'files/img/film8.jpg','files/trailer/film8.mp4','Fight Club',1999,'David Fincher','An insomniac office worker and a devil-may-care soapmaker form an underground fight club that evolves into something much, much more.','Brad Pitt, Edward Norton','Drama','2023-11-13 19:32:23'),(9,'files/img/film9.jpg','files/trailer/film9.mp4','Inception',2010,'Christopher Nolan','A thief who steals corporate secrets through the use of dream-sharing technology is given the inverse task of planting an idea into the mind of a C.E.O.','Leonardo DiCaprio, Joseph Gordon-Levitt','Action','2023-11-13 19:32:23'),(10,'files/img/film10.jpg','files/trailer/film10.mp4','The Lord of the Rings: The Return of the King',2003,'Peter Jackson','Gandalf and Aragorn lead the World of Men against Sauron\'s army to draw his gaze from Frodo and Sam as they approach Mount Doom with the One Ring.','Elijah Wood, Ian McKellen','Adventure','2023-11-13 19:32:23');
 /*!40000 ALTER TABLE `film` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -88,8 +89,8 @@ CREATE TABLE `review` (
   `published_time` timestamp NOT NULL DEFAULT current_timestamp(),
   PRIMARY KEY (`user_id`,`film_id`),
   KEY `film_id` (`film_id`),
-  CONSTRAINT `review_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`),
-  CONSTRAINT `review_ibfk_2` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`)
+  CONSTRAINT `review_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE,
+  CONSTRAINT `review_ibfk_2` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
@@ -139,4 +140,4 @@ UNLOCK TABLES;
 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
--- Dump completed on 2023-09-30  4:45:06
+-- Dump completed on 2023-11-13 19:44:16
diff --git a/src/App.php b/src/App.php
index 8360a69451cd7430f637382fc24f55f7dd45c3d4..57bdf8489bbbf11ec1f190ae6a53f94f5ac1807c 100644
--- a/src/App.php
+++ b/src/App.php
@@ -40,6 +40,8 @@ class App
     $this->router->addRoute('/register', RegisterController::class);
     $this->router->addRoute('/films', FilmController::class);
     $this->router->addRoute('/film-details', FilmController::class);
+    $this->router->addRoute('/film-polling', FilmController::class);
+    $this->router->addRoute('/film-image', FilmController::class);
     $this->router->addRoute('/search', FilmController::class);
     $this->router->addRoute('/add-film', CreateFilmController::class);
     $this->router->addRoute('/update-film', UpdateFilmController::class);
diff --git a/src/base/BaseRepository.php b/src/base/BaseRepository.php
index a8bc49d24c607d38a70e68063aa1208d2d96ae2b..49154a72a3a69c00f2ca7b4f96aeb58db6213077 100644
--- a/src/base/BaseRepository.php
+++ b/src/base/BaseRepository.php
@@ -98,6 +98,7 @@ abstract class BaseRepository
     $pageNo = null,
     $pageSize = null,
     $sort = "asc",
+    $isInitialSync = "no"
   ) {
     $sql = "SELECT * FROM $this->tableName";
 
@@ -124,6 +125,21 @@ abstract class BaseRepository
       $sql .= " WHERE " . implode(" AND ", $conditions);
     }
 
+    if ($isInitialSync == "no") {
+      $pollingDurationMinutes = intval(getenv('POLLING_DURATION_MINUTES'));
+      $pollingSql = "";
+      if (count($where) == 0) {
+        $pollingSql .= " WHERE ";
+      }
+      if ($pollingDurationMinutes !== false && is_numeric($pollingDurationMinutes) && $pollingDurationMinutes) {
+          $pollingSql .= "last_updated >= DATE_SUB(NOW(), INTERVAL $pollingDurationMinutes MINUTE)";
+      } else {
+          $pollingSql .= "last_updated >= DATE_SUB(NOW(), INTERVAL 30 MINUTE)";
+      }
+      $sql .= $pollingSql;
+    }
+
+
     if ($order) {
       $sql .= " ORDER BY $order";
     }
diff --git a/src/controllers/FilmController.php b/src/controllers/FilmController.php
index 29aca7f26ea5e88f0dad195f6ed2b7a5477c3dde..470f30ad6ac2b417e8d3f1dff622a0de27cf5a86 100644
--- a/src/controllers/FilmController.php
+++ b/src/controllers/FilmController.php
@@ -9,6 +9,7 @@ use app\services\FavoriteService;
 use app\services\FilmService;
 use app\services\ReviewService;
 use app\services\UserService;
+use Exception;
 
 class FilmController extends BaseController
 {
@@ -27,21 +28,35 @@ class FilmController extends BaseController
     protected function get($urlParams)
     {
         $uri = Request::getURL();
-        $page = (isset($_GET['page']) and (int) $_GET['page'] >= 1) ? $_GET['page'] : 1;
-        $word = $_GET['q'] ?? "";
-        $genre = $_GET['genre'] ?? 'all';
-        $released_year = $_GET['year'] ?? 'all';
-        $isDesc = $_GET['sort'] ?? "asc";
-        $order = $_GET['order'] ?? 'title';
-        $data = $this->service->searchAndFilter($word, $order, $isDesc, $genre, $released_year, $page);
-        $row_count = $this->service->countRowBySearchAndFilter($word, $genre, $released_year);
+        
+        if ($uri == "/films" || $uri == '/search') {
+            $page = (isset($_GET['page']) and (int) $_GET['page'] >= 1) ? $_GET['page'] : 1;
+            $word = $_GET['q'] ?? "";
+            $genre = $_GET['genre'] ?? 'all';
+            $released_year = $_GET['year'] ?? 'all';
+            $isDesc = $_GET['sort'] ?? "asc";
+            $order = $_GET['order'] ?? 'title';
+            $data = $this->service->searchAndFilter($word, $order, $isDesc, $genre, $released_year, $page);
+            $row_count = $this->service->countRowBySearchAndFilter($word, $genre, $released_year);
 
-        if ($uri == "/films") {
-            $data['genres'] = $this->service->getAllCategoryValues('genre');
-            $data['released_years'] = $this->service->getAllCategoryValues('released_year');
-            $data['total_page'] = ceil($row_count / 10);
+            if ($uri == '/films') {
+                $data['genres'] = $this->service->getAllCategoryValues('genre');
+                $data['released_years'] = $this->service->getAllCategoryValues('released_year');
+                $data['total_page'] = ceil($row_count / 10);
+                parent::render($data, 'films', "layouts/base");
+            }
+            else {
+                $films = [];
+    
+                foreach ($data['films'] as $film) {
+                    $films[] = $film->toResponse();
+                }
+                $data['films'] = $films;
+                $data['total_page'] = ceil($row_count / 10);
+    
+                response::send_json_response($data);
+            }
 
-            parent::render($data, 'films', "layouts/base");
         } elseif ($uri == '/film-details') {
             $data['film'] = $this->service->getById($_GET['film_id']);
             if (isset($_SESSION['user_id'])) {
@@ -51,16 +66,36 @@ class FilmController extends BaseController
             }
 
             parent::render($data, 'film-details', "layouts/base");
-        } else {
+        } else if ($uri == '/film-polling') {
+            $isInitialSync = $_GET['initial'] ?? 'no';
+            $data = $this->service->polling($isInitialSync);
             $films = [];
-
-            foreach ($data['films'] as $film) {
-                $films[] = $film->toResponse();
+            foreach ($data as $film) {
+                $films[] = array(
+                    'film_id' => $film->film_id,
+                    'image_path' => $film->image_path,
+                    'title' => $film->title);
+            }
+            response::send_json_response($films);
+        } else if ($uri == '/film-image') {
+            try {
+                $filmID = $_GET['id'];
+                $imagePath = $_SERVER['DOCUMENT_ROOT'] . '/' . $this->service->getImagePath($filmID);
+                header('Content-Description: File Transfer');
+                header('Content-Type: application/octet-stream');
+                header('Content-Disposition: inline; filename="' . basename($imagePath) . '"');
+                header('Expires: 0');
+                header('Cache-Control: must-revalidate');
+                header('Pragma: public');
+                header('Content-Length: ' . filesize($imagePath));
+                readfile($imagePath);
+                exit;
+            }
+            catch (Exception $e) {
+                $msg = $e->getMessage();
+                $data["error_code"] = $msg;
+                response::send_json_response($data, 400);
             }
-            $data['films'] = $films;
-            $data['total_page'] = ceil($row_count / 10);
-
-            response::send_json_response($data);
         }
     }
 
diff --git a/src/controllers/UpdateFilmController.php b/src/controllers/UpdateFilmController.php
index 3359157f121309be481259c6875f405e0d47a9f1..e39aa8817598144052c36009219b1cd9114d3f9f 100644
--- a/src/controllers/UpdateFilmController.php
+++ b/src/controllers/UpdateFilmController.php
@@ -165,6 +165,9 @@ class UpdateFilmController extends BaseController
         }
 
         // Call service
+        $currentDateTime = new \DateTime('now', new \DateTimeZone('UTC'));
+        $formattedDateTime = $currentDateTime->format("Y-m-d H:i:s"); 
+        $data["last_updated"] = $formattedDateTime;
         $filmModel = new FilmModel();
         $filmModel->constructFromArray($data);
         $response = $this->service->update($filmModel);
diff --git a/src/models/FilmModel.php b/src/models/FilmModel.php
index 0aec4f318428e7151bca3ea8c2d53c47fbb4ea3a..37aaad5652614ad3d077372fa292082523605a91 100644
--- a/src/models/FilmModel.php
+++ b/src/models/FilmModel.php
@@ -15,6 +15,7 @@ class FilmModel extends BaseModel
   public $description;
   public $cast;
   public $genre;
+  public $last_updated;
 
   public function __construct()
   {
@@ -33,6 +34,7 @@ class FilmModel extends BaseModel
     $this->description = $array['description'];
     $this->cast = $array['cast'];
     $this->genre = $array['genre'];
+    $this->last_updated = $array['last_updated'];
     return $this;
   }
 
@@ -48,6 +50,7 @@ class FilmModel extends BaseModel
         'description' => $this->description,
         'cast' => $this->cast,
         'genre' => $this->genre,
+        'last_updated' => $this->last_updated
     );
   }
 }
diff --git a/src/repositories/FilmRepository.php b/src/repositories/FilmRepository.php
index ff7f2742399e882f0140bfb6e9dc723311c0d1e0..2b8fb7f0a023d85895523c1b13c96cb93362539d 100644
--- a/src/repositories/FilmRepository.php
+++ b/src/repositories/FilmRepository.php
@@ -36,7 +36,8 @@ class FilmRepository extends BaseRepository
     $genre = 'all',
     $released_year = 'all',
     $pageNo = 1,
-    $limit = 10
+    $limit = 10,
+    $isInitialSync = "no"
   ) {
     $where = [];
 
@@ -47,10 +48,13 @@ class FilmRepository extends BaseRepository
       $where['released_year'] = [$released_year, PDO::PARAM_INT];
     }
     if (isset($word) and !empty($word)) {
-      $where['title'] = [$genre, PDO::PARAM_STR, 'LIKE', ['director']];
+      $where['title'] = [$word, PDO::PARAM_STR, 'LIKE', ['director']];
     }
 
-    return $this->findAll($where, $order, $pageNo, $limit, $isDesc);
+    $data = $this->findAll($where, $order, $pageNo, $limit, $isDesc, $isInitialSync);
+    error_log(count($data));
+
+    return $this->findAll($where, $order, $pageNo, $limit, $isDesc, $isInitialSync);
   }
 
   public function countRowBySearchAndFilter($word, $genre = 'all', $released_year = 'all')
@@ -64,7 +68,7 @@ class FilmRepository extends BaseRepository
       $where['released_year'] = [$released_year, PDO::PARAM_INT];
     }
     if (isset($word) and !empty($word)) {
-      $where['title'] = [$genre, PDO::PARAM_STR, 'LIKE', ['director']];
+      $where['title'] = [$word, PDO::PARAM_STR, 'LIKE', ['director']];
     }
 
     return $this->countRow($where);
diff --git a/src/services/FilmService.php b/src/services/FilmService.php
index eb143a71d03508ec93bfc03d6b6e2bb2e49b6847..65459d4d8dcd67e9cc8fbaabeeb9d392576d515f 100644
--- a/src/services/FilmService.php
+++ b/src/services/FilmService.php
@@ -3,6 +3,7 @@
 namespace app\services;
 
 use app\base\BaseService;
+use app\exceptions\BadRequestException;
 use app\models\FilmModel;
 use app\repositories\FilmRepository;
 use PDO;
@@ -29,6 +30,8 @@ class FilmService extends BaseService
 
   public function add($image_path, $trailer_path, $title, $released_year, $director, $description, $cast, $genre)
   {
+    $currentDateTime = new \DateTime('now', new \DateTimeZone('UTC'));
+    $formattedDateTime = $currentDateTime->format("Y-m-d H:i:s"); 
     $film = new FilmModel();
     $film
       ->set('image_path', $image_path)
@@ -39,7 +42,8 @@ class FilmService extends BaseService
       ->set('trailer_path', $trailer_path)
       ->set('description', $description)
       ->set('cast', $cast)
-      ->set('genre', $genre);
+      ->set('genre', $genre)
+      ->set('last_updated', $formattedDateTime);
 
     $id = $this->repository->insert($film, array(
       'image_path' => PDO::PARAM_STR,
@@ -50,6 +54,7 @@ class FilmService extends BaseService
       'description' => PDO::PARAM_STR,
       'cast' => PDO::PARAM_STR,
       'genre' => PDO::PARAM_STR,
+      'last_updated'=> PDO::PARAM_STR,
     ));
 
     $response = $this->repository->getById($id);
@@ -70,6 +75,20 @@ class FilmService extends BaseService
     return null;
   }
 
+  public function getImagePath($film_id)
+  {
+    if (!$film_id) {
+      throw new BadRequestException("INVALID_ID");
+    }
+    $film = $this->repository->getById($film_id);
+
+    if ($film) {
+      return "public/" . $film["image_path"]; 
+    }
+
+    throw new BadRequestException("IMAGE_NOT_FOUND");
+  }
+
   public function update($film)
   {
     $arrParams = [];
@@ -81,6 +100,7 @@ class FilmService extends BaseService
     $arrParams['description'] = PDO::PARAM_STR;
     $arrParams['cast'] = PDO::PARAM_STR;
     $arrParams['genre'] = PDO::PARAM_STR;
+    $arrParams['last_updated'] = PDO::PARAM_STR;
 
     return $this->repository->update($film, $arrParams);
   }
@@ -105,6 +125,17 @@ class FilmService extends BaseService
     return $data;
   }
 
+  public function polling($isInitialSync)
+  {
+    $response = $this->repository->getAllBySearchAndFilter(null, null, null, null, null, null, null, $isInitialSync);
+    $films = [];
+    foreach ($response as $resp) {
+      $film = new FilmModel();
+      $films[] = $film->constructFromArray($resp);
+    }
+    return $films;
+  }
+
   public function getAllCategoryValues($category)
   {
     return $this->repository->getAllCategoryValues($category);