From b399eabb8c5aa6b299fbe816402a21e098c7a3e4 Mon Sep 17 00:00:00 2001
From: Antoine Gaudron-Desjardins <antoine.gaudrondesjardins@student-cs.fr>
Date: Wed, 20 Jul 2022 11:19:54 +0200
Subject: [PATCH] add id in returned closure so we can could delete it from the
 admin interface

---
 backend/db/schemas.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/backend/db/schemas.py b/backend/db/schemas.py
index a034159..0777b3a 100644
--- a/backend/db/schemas.py
+++ b/backend/db/schemas.py
@@ -68,6 +68,7 @@ class NewsBase(BaseModel):
 
 class News(NewsBase):
     """Database news base schema"""
+    id: int
     published_at: datetime = Field(..., title="Publication date of the news")
 
     class Config:
@@ -99,13 +100,21 @@ class OpeningHours(OpeningHoursBase):
         orm_mode = True
 
 
-class Closure(BaseModel):
-    """ Closure schema """
+class ClosureBase(BaseModel):
+    """ Closure schema base """
     place: str = Field(..., title="Name of the restaurant")
     beginning_date: datetime = Field(..., title="Beginning date of closure")
     end_date: datetime = Field(..., title="Ending date of closure")
 
 
+class Closure(ClosureBase):
+    """ Closure schema """
+    id: int
+
+    class Config:
+        orm_mode = True
+
+
 class Restaurant(BaseModel):
     """Restaurant schema for reading"""
     name: str
-- 
GitLab