o
    g
                     @   s*   d dl m Z  d dlmZ G dd dZdS )    )datetime)FinancialInformationPagec                   @   sT   e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	dS )FinancialInformationPageServicec                    s@   t di |t |jd}||j | |I dH }|S )z
        Insert a new record into the financial_information_pages table using MySQLDB's execute_insert.

        :param db: An instance of MySQLDB
        :param kwargs: Dictionary of column values for the new record
        )
created_at
created_byN )r   r   nowuser_idupdate_modifyexecute_insert)dbcurrent_userkwargs
new_recordrecordr   r   @/var/www/html/XCapMarket/services/financial_info/page_service.pyinsert_new_record   s   
z1FinancialInformationPageService.insert_new_recordc                    s   |  tI dH S )zM
        Get all records from the financial_information_pages table.
        N)execute_queryr   )r   r   r   r   get_all_records   s   z/FinancialInformationPageService.get_all_recordsc                    s"   t j|kg}| jt |dI dH S )zP
        Get a record from the financial_information_pages table by id.
        filtersN)r   idr   r   page_idr   r   r   r   get_record_by_id   s   z0FinancialInformationPageService.get_record_by_idc                    s$   t j|kg}| jt ||dI dH S )zS
        Delete a record from the financial_information_pages table by id.
        )	record_idr   N)r   r   delete_recordr   r   r   r   delete_record_by_id&   s
   z3FinancialInformationPageService.delete_record_by_idc                    s*   t j|kt jdkg}| jt |dI dH S )z[
        Get all records from the financial_information_pages table for a project.
        Tr   N)r   
project_id	is_activer   )r   r   r   r   r   r   get_all_records_for_project0   s
   z;FinancialInformationPageService.get_all_records_for_projectc                    s:   t  |d< |j|d< tj|kg}| jt||dI dH S )z
        Update a record in the financial_information_pages table by id.

        :param db: An instance of MySQLDB
        :param page_id: The ID of the record to update
        :param kwargs: Dictionary of column values to update
        modified_atmodified_by)r   valuesN)r   r   r	   r   r   update_record)r   r   r   r   r   r   r   r   update_record_by_id;   s   

z3FinancialInformationPageService.update_record_by_idN)
__name__
__module____qualname__staticmethodr   r   r   r   r    r%   r   r   r   r   r      s    



	

r   N)r   models.financial_informationr   r   r   r   r   r   <module>   s    