Ë
    _|ïiŸ  ã                   ór  — d dl Z d dlmZ d dlmZmZmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlmZ  edd	g¬
«      Z e	ej"                  «       e	ej$                  «      gZej)                  dee   ¬«       ee«      fdefd„«       Zej)                  dee   ¬«       ee«      fde j,                  defd„«       Zy)é    N)ÚList)Ú	APIRouterÚDependsÚHTTPException)ÚSessionÚ
joinedload)Úget_db)ÚGraftCombination)ÚGraftCombinationResponsez/api/graftsÚgrafts)ÚprefixÚtagsÚ )Úresponse_modelÚdbc                 óÀ   —  | j                  t        «      j                  t        Ž j	                  t        j
                  j                  «       «      j                  «       S )N)Úqueryr
   ÚoptionsÚ_with_plantsÚorder_byÚcompatibility_scoreÚdescÚall)r   s    úG/var/www/acinvestment.org/public_html/aci/backend/app/routers/grafts.pyÚlist_graftsr      sE   € ð	ˆ�‰Ô!Ó"ß	‰”,ð	 ç	‰Ô"×6Ñ6×;Ñ;Ó=Ó	>ß	‰‹ð	ó    z/compatible/{plant_id}Úplant_idc                 óJ  —  |j                  t        «      j                  t        Ž j	                  t        j
                  | k(  t        j                  | k(  z  «      j                  t        j                  j                  «       «      j                  «       }|st        dd¬«      ‚|S )zZReturn all graft combinations that involve the given plant (as either rootstock or scion).i”  z)No compatible grafts found for this plant)Ústatus_codeÚdetail)r   r
   r   r   ÚfilterÚrootstock_idÚscion_idr   r   r   r   r   )r   r   Úresultss      r   Úcompatible_graftsr%      sŠ   € ð	ˆ�‰Ô!Ó"ß	‰”,ð	 ç	‰Ü×*Ñ*¨hÑ6Ü×(Ñ(¨HÑ4ñ6ó

÷ 
‰Ô"×6Ñ6×;Ñ;Ó=Ó	>ß	‰‹ð ñ Ü¨Ð4_Ô`Ð`Ø€Nr   )ÚuuidÚtypingr   Úfastapir   r   r   Úsqlalchemy.ormr   r   Úapp.databaser	   Úapp.models.graft_combinationr
   Úapp.schemas.graft_combinationr   ÚrouterÚ	rootstockÚscionr   Úgetr   ÚUUIDr%   © r   r   ú<module>r3      sÉ   ðÛ Ý ç 5Ñ 5ß .å Ý 9Ý Bá	˜-¨x¨jÔ	9€ñ Ð×)Ñ)Ó*ÙÐ×%Ñ%Ó&ð€ð ‡�ˆB˜tÐ$<Ñ=€Ó>Ù% f›oñ �Gò ó ?ðð ‡�Ð$°TÐ:RÑ5S€ÓTÙ9@À»ñ  §	¡	ð ¨wò ó Uñr   