66)
77from controller .inbox_mail import manager as inbox_mail_manager
88from submodules .model .global_objects import inbox_mail as inbox_mail_go
9- from submodules .model .business_objects import user
109from fastapi import APIRouter , HTTPException , Request
1110from fast_api .routes .client_response import (
1211 get_silent_success ,
@@ -131,7 +130,6 @@ def delete_inbox_mail_by_id(request: Request, mail_id: str):
131130
132131@router .get ("/new" )
133132def has_new_inbox_mails (request : Request ):
134-
135133 user_is_admin = auth_manager .check_is_admin (request )
136134 user = auth_manager .get_user_by_info (request .state .info )
137135
@@ -145,3 +143,33 @@ def has_new_inbox_mails(request: Request):
145143 "totalNewInboxMails" : total_new_inbox_mails ,
146144 }
147145 )
146+
147+
148+ @router .put ("/thread/{thread_id}/unread/project" )
149+ def update_inbox_mail_threads_unread_by_project (request : Request , thread_id : str ):
150+ user_is_admin = auth_manager .check_is_admin (request )
151+ if not user_is_admin :
152+ raise HTTPException (status_code = 403 , detail = "Not authorized" )
153+ inbox_mail_thread = inbox_mail_go .get_inbox_mail_thread_by_id (thread_id = thread_id )
154+ if not inbox_mail_thread :
155+ raise HTTPException (status_code = 404 , detail = "Thread not found" )
156+
157+ inbox_mail_go .update_system_support_threads_read_by_threads_project (
158+ thread_id = thread_id
159+ )
160+ return get_silent_success ()
161+
162+
163+ @router .put ("/thread/{thread_id}/unread/content" )
164+ def update_inbox_mail_threads_unread_by_content (request : Request , thread_id : str ):
165+ user_is_admin = auth_manager .check_is_admin (request )
166+ if not user_is_admin :
167+ raise HTTPException (status_code = 403 , detail = "Not authorized" )
168+ inbox_mail_thread = inbox_mail_go .get_inbox_mail_thread_by_id (thread_id = thread_id )
169+ if not inbox_mail_thread :
170+ raise HTTPException (status_code = 404 , detail = "Thread not found" )
171+
172+ inbox_mail_go .update_system_support_threads_read_by_threads_content (
173+ thread_id = thread_id
174+ )
175+ return get_silent_success ()
0 commit comments