From 458cea36449aeb037bc34b462ad135d426eed204 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Ren=C3=A9=20ROUET?= <rouet@in2p3.fr>
Date: Mon, 12 Jun 2023 15:12:46 +0200
Subject: [PATCH] [API] add priority in book read [API] add priority in chapter
 create and update [API] add priority in page create and update

---
 app/Api/ApiEntityListFormatter.php                | 1 +
 app/Entities/Controllers/ChapterApiController.php | 2 ++
 app/Entities/Controllers/PageApiController.php    | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/app/Api/ApiEntityListFormatter.php b/app/Api/ApiEntityListFormatter.php
index c170ecf0c..7d00834e5 100644
--- a/app/Api/ApiEntityListFormatter.php
+++ b/app/Api/ApiEntityListFormatter.php
@@ -22,6 +22,7 @@ class ApiEntityListFormatter
     protected $fields = [
         'id', 'name', 'slug', 'book_id', 'chapter_id',
         'draft', 'template', 'created_at', 'updated_at',
+        'priority'
     ];
 
     public function __construct(array $list)
diff --git a/app/Entities/Controllers/ChapterApiController.php b/app/Entities/Controllers/ChapterApiController.php
index 403c58de3..7f01e445a 100644
--- a/app/Entities/Controllers/ChapterApiController.php
+++ b/app/Entities/Controllers/ChapterApiController.php
@@ -19,12 +19,14 @@ class ChapterApiController extends ApiController
             'name'        => ['required', 'string', 'max:255'],
             'description' => ['string', 'max:1000'],
             'tags'        => ['array'],
+            'priority'    => ['integer'],
         ],
         'update' => [
             'book_id'     => ['integer'],
             'name'        => ['string', 'min:1', 'max:255'],
             'description' => ['string', 'max:1000'],
             'tags'        => ['array'],
+            'priority'    => ['integer'],
         ],
     ];
 
diff --git a/app/Entities/Controllers/PageApiController.php b/app/Entities/Controllers/PageApiController.php
index 28dd36f97..c83126df9 100644
--- a/app/Entities/Controllers/PageApiController.php
+++ b/app/Entities/Controllers/PageApiController.php
@@ -23,6 +23,7 @@ class PageApiController extends ApiController
             'html'       => ['required_without:markdown', 'string'],
             'markdown'   => ['required_without:html', 'string'],
             'tags'       => ['array'],
+            'priority'   => ['integer'],
         ],
         'update' => [
             'book_id'    => ['integer'],
@@ -31,6 +32,7 @@ class PageApiController extends ApiController
             'html'       => ['string'],
             'markdown'   => ['string'],
             'tags'       => ['array'],
+            'priority'   => ['integer'],
         ],
     ];