o
    ã<3h€  ã                   @   sT   d dl Z d dlmZ d dlmZ d dlmZ d dlZe e¡Z	G dd„ dej
ƒZdS )é    N)Úmodels)Útransaction)ÚValidationErrorc                       s   e Zd ZejdejddZe ¡ Ze ¡ Z	ej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZej
ddZejddZejddZG dd	„ d	ƒZ‡ fd
d„Zdd„ Z‡  Z S )ÚBalanceTF)Úprimary_keyÚdefaultÚeditableg        )r   )Úauto_now_add)Úauto_nowc                   @   s,   e Zd ZdZejdgdejdgdgZdS )zBalance.MetaÚbalancesÚuser_id)ÚfieldsÚstamp_idN)Ú__name__Ú
__module__Ú__qualname__Údb_tabler   ÚIndexÚindexes© r   r   ú4C:\Users\Denis\Desktop\TimeStamps\balances\models.pyÚMeta#   s
    þr   c              
      s„   z"t  ¡  tƒ j|i |¤Ž W d   ƒ W d S 1 sw   Y  W d S  tyA } zt dt|ƒ› ¡ tdt|ƒ› ƒ‚d }~ww )NzError saving balance record: zFailed to save balance record: )	r   ÚatomicÚsuperÚsaveÚ	ExceptionÚloggerÚerrorÚstrr   )ÚselfÚargsÚkwargsÚe©Ú	__class__r   r   r   *   s   
&ÿ€þzBalance.savec                 C   s   d| j › d| j› S )NzBalance for User z	 - Stamp )r   r   )r   r   r   r   Ú__str__2   s   zBalance.__str__)!r   r   r   r   Ú	UUIDFieldÚuuidÚuuid4Úidr   r   Ú
FloatFieldZ	work_timeZ	flex_timeZ	over_timeZwork_time_bankZadditional_workZ
paid_leaveZholidayZ
sick_leaveZparental_leaveZtravel_timeZtraining_leaveZunpaid_leaveZworking_time_reducationZremote_work_timeZstandby_dutyÚDateTimeFieldÚ
created_atÚ
updated_atr   r   r%   Ú__classcell__r   r   r#   r   r   	   s0    r   )r'   Ú	django.dbr   r   Údjango.core.exceptionsr   ÚloggingÚ	getLoggerr   r   ÚModelr   r   r   r   r   Ú<module>   s    
