diff --git a/models/intermediate/core/int_core__check_in_cover_users.sql b/models/intermediate/core/int_core__check_in_cover_users.sql new file mode 100644 index 0000000..e548761 --- /dev/null +++ b/models/intermediate/core/int_core__check_in_cover_users.sql @@ -0,0 +1,31 @@ +with + stg_core__user as (select * from {{ ref("stg_core__user") }}), + stg_core__verification_set as ( + select * from {{ ref("stg_core__verification_set") }} + ), + stg_core__verification_set_to_verification_type as ( + select * from {{ ref("stg_core__verification_set_to_verification_type") }} + ), + hosts_with_check_in_cover as ( + select vs.id_user_host + from stg_core__verification_set vs + left join + stg_core__verification_set_to_verification_type vstvt + on vs.id_verification_set = vstvt.id_verification_set + where vs.is_active is true and vstvt.id_verification_type = 15 + -- vs.isactive is to consider the current verification set used by the host + -- vstvt.id_verification_type = 15 is the value for check_in_cover verification + ) +select + u.id_user, + u.last_name, + u.user_name, + u.first_name, + u.email, + u.phone_number, + u.joined_at_utc, + u.joined_date_utc, + u.billing_town, + u.company_name +from stg_core__user u +inner join hosts_with_check_in_cover hcih on hcih.id_user_host = u.id_user diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index 543aec4..f944a76 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -813,4 +813,55 @@ models: - name: has_been_booked_within_last_12_months data_type: boolean - description: If the deal has had a booking created in the past 12 months. \ No newline at end of file + description: If the deal has had a booking created in the past 12 months. + + - name: int_core__check_in_cover_users + description: + This model contains information about hosts that offer check in cover. + It has basic information on the users like name, phone, email or joined date. + + This model is restricted to active user so it doesn't include historical data + like users that had check-in cover but are currently inactive. + columns: + - name: id_user + data_type: character varying + description: Unique id value for the user + tests: + - not_null + - unique + + - name: last_name + data_type: character varying + description: Last name of the user + + - name: user_name + data_type: character varying + description: User name of the user + + - name: first_name + data_type: character varying + description: First name of the user + + - name: email + data_type: character varying + description: Email of the user + + - name: phone_number + data_type: character varying + description: Phone number of the user + + - name: joined_at_utc + data_type: timestamp without time zone + description: Date and time the user joined + + - name: joined_date_utc + data_type: date + description: Date the user joined + + - name: billing_town + data_type: character varying + description: "" + + - name: company_name + data_type: character varying + description: "" \ No newline at end of file