Adding missing field in S&P models

This commit is contained in:
Joaquin Ossa 2024-12-11 16:35:40 +01:00
parent a564afea3c
commit 34a5b0d86e
6 changed files with 17 additions and 8 deletions

View file

@ -1,4 +1,4 @@
{% set api_name = "CHECKINHEROAPI" %} {% set api_name = "SCREENANDPROTECTAPI" %}
with with
stg_screen_and_protect__verification_requests as ( stg_screen_and_protect__verification_requests as (
@ -13,8 +13,11 @@ select
vr.id_booking, vr.id_booking,
vr.id_user_partner, vr.id_user_partner,
vr.id_accommodation, vr.id_accommodation,
({{ adapter.quote("json_document_user_data") }} ->> 'FlaggedNotProtected')::boolean case
as not_protected, when (au.json_document_user_data ->> 'FlaggedNotProtected') = 'false'
then true
else false
end as is_protected,
vr.protection_type, vr.protection_type,
vr.protection_starting_level, vr.protection_starting_level,
vr.protection_basic_amount, vr.protection_basic_amount,

View file

@ -30,12 +30,10 @@ models:
data_type: text data_type: text
description: Identifier for the accommodation related to the booking. description: Identifier for the accommodation related to the booking.
- name: not_protected - name: is_protected
data_type: boolean data_type: boolean
description: | description: |
Indicates if the booking is protected or not. Indicates if the booking is protected or not.
It is kind of weird for being a negative statement,
so when false it means the booking is protected.
tests: tests:
- not_null - not_null

View file

@ -30,6 +30,13 @@ models:
data_type: text data_type: text
description: Identifier for the accommodation related to the booking. description: Identifier for the accommodation related to the booking.
- name: is_protected
data_type: boolean
description: |
Indicates if the booking is protected or not.
tests:
- not_null
- name: protection_type - name: protection_type
data_type: text data_type: text
description: Specific protection type for the request. description: Specific protection type for the request.

View file

@ -9,6 +9,7 @@ select
id_booking as id_booking, id_booking as id_booking,
id_user_partner as id_user_partner, id_user_partner as id_user_partner,
id_accommodation as id_accommodation, id_accommodation as id_accommodation,
is_protected as is_protected,
protection_type as protection_type, protection_type as protection_type,
protection_starting_level as protection_starting_level, protection_starting_level as protection_starting_level,
protection_basic_amount as protection_basic_amount, protection_basic_amount as protection_basic_amount,

View file

@ -1381,7 +1381,7 @@ models:
- not_null - not_null
- name: json_document_user_data - name: json_document_user_data
data_type: character varying data_type: jsonb
description: | description: |
"The json document that contains the user information" "The json document that contains the user information"

View file

@ -4,7 +4,7 @@ with
select select
{{ adapter.quote("UserId") }} as id_apim_user, {{ adapter.quote("UserId") }} as id_apim_user,
{{ adapter.quote("ApimUserTypeId") }} as id_apim_user_type, {{ adapter.quote("ApimUserTypeId") }} as id_apim_user_type,
{{ adapter.quote("Json") }} as json_document_user_data, {{ adapter.quote("Json") }}::jsonb as json_document_user_data,
{{ adapter.quote("CreatedDate") }} as created_at_utc, {{ adapter.quote("CreatedDate") }} as created_at_utc,
cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc, cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc,
{{ adapter.quote("UpdatedDate") }} as updated_at_utc, {{ adapter.quote("UpdatedDate") }} as updated_at_utc,