11import json
22from datetime import datetime
3- from typing import Literal
3+ from typing import Annotated , Literal
44from uuid import UUID , uuid4
55
66from fastapi import APIRouter , Depends , HTTPException , Path , Request , Response
@@ -147,8 +147,8 @@ def get_bulk_contacts_by_timestamp_or_4xx(
147147)
148148def read_ctms_by_any_id (
149149 request : Request ,
150- db : Session = Depends (get_db ),
151- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
150+ db : Annotated [ Session , Depends (get_db )] ,
151+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
152152 ids = Depends (all_ids ),
153153):
154154 if not any (ids .values ()):
@@ -170,9 +170,9 @@ def read_ctms_by_any_id(
170170)
171171def read_ctms_by_email_id (
172172 request : Request ,
173- email_id : UUID = Path (..., title = "The Email ID" ),
174- db : Session = Depends (get_db ),
175- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
173+ email_id : Annotated [ UUID , Path (..., title = "The Email ID" )] ,
174+ db : Annotated [ Session , Depends (get_db )] ,
175+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
176176):
177177 resp = get_ctms_response_or_404 (db , email_id )
178178 return resp
@@ -194,9 +194,9 @@ def create_ctms_contact(
194194 contact : ContactInSchema ,
195195 request : Request ,
196196 response : Response ,
197- db : Session = Depends (get_db ),
198- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
199- content_json : dict | None = Depends (get_json ),
197+ db : Annotated [ Session , Depends (get_db )] ,
198+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
199+ content_json : Annotated [ dict | None , Depends (get_json )] ,
200200):
201201 contact .email .email_id = contact .email .email_id or uuid4 ()
202202 email_id = contact .email .email_id
@@ -235,10 +235,10 @@ def create_or_update_ctms_contact(
235235 contact : ContactPutSchema ,
236236 request : Request ,
237237 response : Response ,
238- email_id : UUID = Path (..., title = "The Email ID" ),
239- db : Session = Depends (get_db ),
240- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
241- content_json : dict | None = Depends (get_json ),
238+ email_id : Annotated [ UUID , Path (..., title = "The Email ID" )] ,
239+ db : Annotated [ Session , Depends (get_db )] ,
240+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
241+ content_json : Annotated [ dict | None , Depends (get_json )] ,
242242):
243243 if contact .email .email_id :
244244 if contact .email .email_id != email_id :
@@ -279,10 +279,10 @@ def partial_update_ctms_contact(
279279 contact : ContactPatchSchema ,
280280 request : Request ,
281281 response : Response ,
282- email_id : UUID = Path (..., title = "The Email ID" ),
283- db : Session = Depends (get_db ),
284- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
285- content_json : dict | None = Depends (get_json ),
282+ email_id : Annotated [ UUID , Path (..., title = "The Email ID" )] ,
283+ db : Annotated [ Session , Depends (get_db )] ,
284+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
285+ content_json : Annotated [ dict | None , Depends (get_json )] ,
286286):
287287 if contact .email and contact .email .email_id and contact .email .email_id != email_id :
288288 raise HTTPException (
@@ -318,8 +318,8 @@ def partial_update_ctms_contact(
318318)
319319def delete_contact_by_primary_email (
320320 primary_email : str ,
321- db : Session = Depends (get_db ),
322- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
321+ db : Annotated [ Session , Depends (get_db )] ,
322+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
323323):
324324 ids = all_ids (primary_email = primary_email .lower ())
325325 contacts = get_contacts_by_any_id (db , ** ids )
@@ -349,8 +349,8 @@ def read_ctms_in_bulk_by_timestamps_and_limit(
349349 limit : int | Literal ["" ] | None = None ,
350350 after : str | None = None ,
351351 mofo_relevant : bool | Literal ["" ] | None = None ,
352- db : Session = Depends (get_db ),
353- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
352+ db : Session = Depends (get_db ), # noqa: FAST002, parameter without default
353+ api_client : ApiClientSchema = Depends (get_enabled_api_client ), # noqa: FAST002, parameter without default
354354):
355355 try :
356356 bulk_request = BulkRequestSchema (
@@ -377,8 +377,8 @@ def read_ctms_in_bulk_by_timestamps_and_limit(
377377 tags = ["Private" ],
378378)
379379def read_identities (
380- db : Session = Depends (get_db ),
381- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
380+ db : Annotated [ Session , Depends (get_db )] ,
381+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
382382 ids = Depends (all_ids ),
383383):
384384 if not any (ids .values ()):
@@ -399,9 +399,9 @@ def read_identities(
399399 tags = ["Private" ],
400400)
401401def read_identity (
402- email_id : UUID = Path (..., title = "The email ID" ),
403- db : Session = Depends (get_db ),
404- api_client : ApiClientSchema = Depends (get_enabled_api_client ),
402+ email_id : Annotated [ UUID , Path (..., title = "The Email ID" )] ,
403+ db : Annotated [ Session , Depends (get_db )] ,
404+ api_client : Annotated [ ApiClientSchema , Depends (get_enabled_api_client )] ,
405405):
406406 contact = get_contact_or_404 (db , email_id )
407407 return contact .as_identity_response ()
0 commit comments