From a75a4e97635636be74fd4dda810052c2e85da615 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Wed, 31 Jul 2024 17:35:14 +0200 Subject: [PATCH] Added host_booking_fees model to report --- .../core/core__host_booking_fees.sql | 16 ++++ models/reporting/core/schema.yaml | 87 ++++++++++++++++++- 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 models/reporting/core/core__host_booking_fees.sql diff --git a/models/reporting/core/core__host_booking_fees.sql b/models/reporting/core/core__host_booking_fees.sql new file mode 100644 index 0000000..5961b10 --- /dev/null +++ b/models/reporting/core/core__host_booking_fees.sql @@ -0,0 +1,16 @@ +with + int_core__host_booking_fees as ( + select * from {{ ref("int_core__host_booking_fees") }} + ) +select + id_booking as id_booking, + id_user_guest as id_user_guest, + id_user_host as id_user_host, + id_accommodation as id_accommodation, + booking_state as booking_state, + is_duplicate_booking as is_duplicate_booking, + booking_fee_local as booking_fee_local, + account_currency_iso4217 as account_currency_iso4217, + booking_fee_charge_at_utc as booking_fee_charge_at_utc, + booking_fee_charge_date_utc as booking_fee_charge_date_utc +from int_core__host_booking_fees diff --git a/models/reporting/core/schema.yaml b/models/reporting/core/schema.yaml index cd74ee1..f7ec4e4 100644 --- a/models/reporting/core/schema.yaml +++ b/models/reporting/core/schema.yaml @@ -974,4 +974,89 @@ models: data_type: bigint description: "Count of how many Check-in covers have been - purchased for this accommodation" \ No newline at end of file + purchased for this accommodation" + + - name: core__host_booking_fees + description: + Bookings that have been processed by the Superhog backend. + Each record matches one booking and has information on host + booking fees, when they were charged and the currency used by + the host. + + columns: + - name: id_booking + data_type: bigint + description: "The unique, Superhog generated id for this booking." + tests: + - unique + - not_null + + - name: id_user_guest + data_type: character varying + description: The UUID of the Superhog user playing the guest role in the booking. + + - name: id_user_host + data_type: character varying + description: The UUID of the Superhog user playing the host role in the booking. + tests: + - not_null + + - name: id_accommodation + data_type: bigint + description: The ID of the booked listing. + + - name: booking_state + data_type: character varying + description: + "State in which the booking is, could be either of the following: + - Approved + - NotApproved + - Cancelled + - Rejected + - NoFlags + - Flagged + - IncompleteInformation" + tests: + - accepted_values: + values: + - 'Approved' + - 'NotApproved' + - 'Cancelled' + - 'Rejected' + - 'NoFlags' + - 'Flagged' + - 'IncompleteInformation' + + - name: is_duplicate_booking + data_type: boolean + description: | + A flag that identifies whether the booking is a duplicate. + A booking is considered a duplicate if there's an older booking with the same user, + accomodation and check-in date. If there are two or more bookings with the same user, + accomodation and check-in date, the oldest one will have False as a value in this field, + and the other ones will have True as a value in this Failed." + Put simply, if you don't want to receive duplicates, filter this field to False. + + - name: booking_fee_local + data_type: numeric + description: "The fee to apply to the booking, in host currency." + + - name: account_currency_iso4217 + data_type: character varying + description: "Currency used by host/pm/platform users." + + - name: booking_fee_charge_at_utc + data_type: timestamp without time zone + description: | + The point in time in which the booking should be invoiced. + + This could be the check-in date of the booking or the date in which the guest verification + started, depending on the billing settings of the host. + + - name: booking_fee_charge_date_utc + data_type: date + description: | + The date in which the booking should be invoiced. + + This could be the check-in date of the booking or the date in which the guest verification + started, depending on the billing settings of the host. \ No newline at end of file