From daa12c08c1f393bca821107053b407be15936e5e Mon Sep 17 00:00:00 2001 From: smokhtari-passculture Date: Fri, 20 Sep 2024 16:54:40 +0200 Subject: [PATCH] (PC-31759)[API] feat: add params to log offer list view in adage --- api/src/pcapi/routes/adage_iframe/logs.py | 1 + api/src/pcapi/routes/adage_iframe/serialization/logs.py | 1 + api/tests/routes/adage_iframe/post_logs_test.py | 3 ++- pro/src/apiClient/adage/models/OfferListSwitch.ts | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/pcapi/routes/adage_iframe/logs.py b/api/src/pcapi/routes/adage_iframe/logs.py index eb02e564355..72527a6aa7e 100644 --- a/api/src/pcapi/routes/adage_iframe/logs.py +++ b/api/src/pcapi/routes/adage_iframe/logs.py @@ -48,6 +48,7 @@ def log_offer_list_view_switch( "source": body.source, "from": body.iframeFrom, "queryId": body.queryId, + "isMobile": body.isMobile, }, uai=authenticated_information.uai, user_role=AdageFrontRoles.REDACTOR if institution else AdageFrontRoles.READONLY, diff --git a/api/src/pcapi/routes/adage_iframe/serialization/logs.py b/api/src/pcapi/routes/adage_iframe/serialization/logs.py index 23050d0d42a..890f646f3ce 100644 --- a/api/src/pcapi/routes/adage_iframe/serialization/logs.py +++ b/api/src/pcapi/routes/adage_iframe/serialization/logs.py @@ -21,6 +21,7 @@ class AdagePlaylistType(enum.Enum): class OfferListSwitch(AdageBaseModel): source: str + isMobile: bool | None class CatalogViewBody(AdageBaseModel): diff --git a/api/tests/routes/adage_iframe/post_logs_test.py b/api/tests/routes/adage_iframe/post_logs_test.py index d932961e604..4928bcfd81d 100644 --- a/api/tests/routes/adage_iframe/post_logs_test.py +++ b/api/tests/routes/adage_iframe/post_logs_test.py @@ -42,7 +42,7 @@ def test_log_offer_list_view_switch(self, test_client, caplog): with caplog.at_level(logging.INFO): response = test_client.post( url_for("adage_iframe.log_offer_list_view_switch"), - json={"source": "offer_switch", "iframeFrom": "playlist", "queryId": "1234"}, + json={"source": "offer_switch", "iframeFrom": "playlist", "queryId": "1234", "isMobile": True}, ) assert response.status_code == 204 @@ -51,6 +51,7 @@ def test_log_offer_list_view_switch(self, test_client, caplog): "analyticsSource": "adage", "source": "offer_switch", "queryId": "1234", + "isMobile": True, "from": "playlist", "uai": UAI, "user_role": AdageFrontRoles.READONLY, diff --git a/pro/src/apiClient/adage/models/OfferListSwitch.ts b/pro/src/apiClient/adage/models/OfferListSwitch.ts index 6084064d325..74cbd5bb2b9 100644 --- a/pro/src/apiClient/adage/models/OfferListSwitch.ts +++ b/pro/src/apiClient/adage/models/OfferListSwitch.ts @@ -5,6 +5,7 @@ export type OfferListSwitch = { iframeFrom: string; isFromNoResult?: boolean | null; + isMobile?: boolean | null; queryId?: string | null; source: string; };