Ë
    ”<ÑhÛ  ã                   óÐ   — d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ  e«       Z e«       Zej'                  d«      d	d
 ee«      fdededefd„«       Zy)é    )Ú	APIRouterÚDependsÚHTTPExceptionÚstatus)ÚSession)ÚJSONResponse)Újsonable_encoder)Ú
HTTPBearer)Úget_db)ÚSectionz/sections-listÚidÚascÚsort_byÚ
sort_orderÚdbc              ƒ   óT  K  — t        t        | «      st        t        j                  d| › ¬«      ‚|j                  t        «      }|j                  «       dk(  r.|j                  t        t        | «      j                  «       «      }n-|j                  t        t        | «      j                  «       «      }|j                  «       }|j                  «       }|st        t        j                  d¬«      ‚t        t        |«      |t        j                   ddœt        j                   ¬«      S ­w)z&
    Retrieve a list of sections.
    zInvalid sort field: )Ústatus_codeÚdetailÚdesczNo sections foundzSections retrieved successfully)ÚsectionsÚcountr   Úmessage)Úcontentr   )Úhasattrr   r   r   ÚHTTP_400_BAD_REQUESTÚqueryÚlowerÚorder_byÚgetattrr   r   r   ÚallÚHTTP_404_NOT_FOUNDr   r	   ÚHTTP_200_OK)r   r   r   r   Úsection_countÚsection_lists         ú</var/www/html/syllabuild_admin/backend/api/routes/section.pyÚget_sectionsr&      s÷   è ø€ ô ”7˜GÔ$ÜÜ×3Ñ3Ø)¨'¨Ð3ô
ð 	
ð H‰H”WÓ€EØ×ÑÓ˜VÒ#Ø—‘œw¤w°Ó8×=Ñ=Ó?Ó@‰à—‘œw¤w°Ó8×<Ñ<Ó>Ó?ˆà—K‘K“M€MØ—9‘9“;€LáÜÜ×1Ñ1Ø&ô
ð 	
ô
 ä(¨Ó6Ø"Ü!×-Ñ-Ø8ñ	
ô ×&Ñ&ôð ùs   ‚D&D(N)Úfastapir   r   r   r   Úsqlalchemy.ormr   Úfastapi.responsesr   Úfastapi.encodersr	   Úfastapi.securityr
   Ú
db.sessionr   Údb.models.sectionr   ÚrouterÚsecurityÚgetÚstrr&   © ó    r%   ú<module>r4      sn   ðß =Ó =Ý "Ý *Ý -Ý 'Ý Ý %á	‹€Ù‹<€à‡ÐÓàØÙ˜&“/ñ(Øð(àð(ð 	ò(ó ñ(r3   