1st commit
This commit is contained in:
parent
dd57c28768
commit
d189aaa797
2 changed files with 76 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
||||||
|
{% set cost_per_night = 2 %}
|
||||||
|
-- 2GBP/booked night if booking is approved, to be charged on checkout
|
||||||
|
with
|
||||||
|
int_edeposit__verifications as (
|
||||||
|
select * from {{ ref("int_edeposit__verifications") }}
|
||||||
|
)
|
||||||
|
select
|
||||||
|
v.id_verification,
|
||||||
|
v.id_booking,
|
||||||
|
v.is_cancelled,
|
||||||
|
v.number_nights * {{ cost_per_night }} as total_revenue,
|
||||||
|
v.created_date_utc,
|
||||||
|
v.checkout_date_utc
|
||||||
|
from int_edeposit__verifications v
|
||||||
|
where
|
||||||
|
v.verification_source = 'Guesty'
|
||||||
|
and v.verification_status = 'Approved'
|
||||||
|
and v.id_booking is not null
|
||||||
|
and v.number_nights > 0
|
||||||
|
|
@ -303,5 +303,62 @@ models:
|
||||||
- name: created_date_utc
|
- name: created_date_utc
|
||||||
data_type: date
|
data_type: date
|
||||||
description: "Date of creation of the verification in the system"
|
description: "Date of creation of the verification in the system"
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: int_edeposit__guesty_verifications
|
||||||
|
description:
|
||||||
|
"This table shows all verification for Guesty.
|
||||||
|
The charged fee is 2GBP per booked night if booking is approved,
|
||||||
|
to be charged on checkout."
|
||||||
|
columns:
|
||||||
|
- name: id_verification
|
||||||
|
data_type: text
|
||||||
|
description: "unique Superhog generated id for this verification"
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_booking
|
||||||
|
data_type: text
|
||||||
|
description:
|
||||||
|
"unique Superhog generated id for a booking.
|
||||||
|
note that this could be duplicated and both will be charged,
|
||||||
|
it's up to the user to not generate or cancel duplicate verifications"
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: is_cancelled
|
||||||
|
data_type: boolean
|
||||||
|
description: "indicates if the booking has been cancelled or not."
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- true
|
||||||
|
- false
|
||||||
|
|
||||||
|
- name: total_revenue
|
||||||
|
data_type: integer
|
||||||
|
description:
|
||||||
|
"total fee charged on checkout"
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
strictly: false
|
||||||
|
-- should be true but right now we have bookings with 0 nights
|
||||||
|
|
||||||
|
- name: created_date_utc
|
||||||
|
data_type: date
|
||||||
|
description:
|
||||||
|
"Date of creation of the verification in the system"
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: checkout_date_utc
|
||||||
|
data_type: date
|
||||||
|
description:
|
||||||
|
"Date of checkout for the booking"
|
||||||
tests:
|
tests:
|
||||||
- not_null
|
- not_null
|
||||||
Loading…
Add table
Add a link
Reference in a new issue