Merged PR 3646: Adding informative fields in booking tables for New Pricing

# Description

Adds informative fields to New Pricing booking-related tables. These are added into booking_to_service which is a view, and propagated and materialised as table in the `booking_service_detail` and `booking_summary`.

The new fields are:
- Date versions for relevant booking timestamps (Created, Updated, Check-in, Check-out)
- Booking Number of nights
- Ids for the Accommodation and UserProductBundle
- Program Name (aka Product Bundle Name). I dislike the fact that it's named "Product" because you can have Protection Plans in the Program as well... so I opted for a more conventional business-oriented naming, which is Program.

Added a bunch of tests + documentation.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #20809
This commit is contained in:
Oriol Roqué Paniagua 2024-11-25 15:03:38 +00:00
parent 059c92b345
commit 28114d645e
4 changed files with 170 additions and 2 deletions

View file

@ -3223,6 +3223,23 @@ models:
The identifier of the verification request. It acts as Foreign Key to
Verification Request table. It can be null.
- name: id_accommodation
data_type: bigint
description:
The identifier of the accommodation or listing. It acts as Foreign Key
to the Accommodation table. It cannot be null.
tests:
- not_null
- name: id_user_product_bundle
data_type: bigint
description:
The identifier of the Product Bundle, or program, that a User has applied
to the Booking. It acts as Foreign Key to the User Product Bundle table.
It cannot be null.
tests:
- not_null
- name: id_verification
data_type: bigint
description: |
@ -3259,6 +3276,14 @@ models:
Unique identifier of the user that acts as a Guest.
Can be null if Superhog does not interact with the Guest.
- name: program_name
data_type: string
description: |
The name of the program, or product bundle, applied to the booking.
Cannot be null.
tests:
- not_null
- name: service_name
data_type: string
description: |
@ -3309,6 +3334,13 @@ models:
tests:
- not_null
- name: booking_created_date_utc
data_type: date
description: |
Date of when the Booking record was created in the Backend.
tests:
- not_null
- name: booking_updated_at_utc
data_type: timestamp
description: |
@ -3316,6 +3348,13 @@ models:
tests:
- not_null
- name: booking_updated_date_utc
data_type: date
description: |
Date of when the Booking record was last updated in the Backend.
tests:
- not_null
- name: booking_check_in_at_utc
data_type: timestamp
description: |
@ -3323,6 +3362,13 @@ models:
tests:
- not_null
- name: booking_check_in_date_utc
data_type: timestamp
description: |
Date of the Check-in of the Booking.
tests:
- not_null
- name: booking_check_out_at_utc
data_type: timestamp
description: |
@ -3330,6 +3376,18 @@ models:
tests:
- not_null
- name: booking_check_out_date_utc
data_type: date
description: |
Date of the Check-out of the Booking.
tests:
- not_null
- name: booking_number_of_nights
data_type: integer
description: |
Number of nights between Check-in date and Check-out date.
- name: host_currency_code
data_type: string
description: |
@ -3511,6 +3569,14 @@ models:
tests:
- not_null
- name: program_name
data_type: string
description: |
The name of the program, or product bundle, applied to the booking.
Cannot be null.
tests:
- not_null
- name: service_name
data_type: string
description: |
@ -3691,6 +3757,23 @@ models:
The identifier of the verification request. It acts as Foreign Key to
Verification Request table. It can be null.
- name: id_accommodation
data_type: bigint
description:
The identifier of the accommodation or listing. It acts as Foreign Key
to the Accommodation table. It cannot be null.
tests:
- not_null
- name: id_user_product_bundle
data_type: bigint
description:
The identifier of the Product Bundle, or program, that a User has applied
to the Booking. It acts as Foreign Key to the User Product Bundle table.
It cannot be null.
tests:
- not_null
- name: id_deal
data_type: string
description: |
@ -3716,6 +3799,14 @@ models:
tests:
- not_null
- name: program_name
data_type: string
description: |
The name of the program, or product bundle, applied to the booking.
Cannot be null.
tests:
- not_null
- name: booking_created_at_utc
data_type: timestamp
description: |
@ -3724,6 +3815,14 @@ models:
tests:
- not_null
- name: booking_created_date_utc
data_type: date
description: |
Date of when the Booking record was created in the Backend.
Cannot be null.
tests:
- not_null
- name: booking_updated_at_utc
data_type: timestamp
description: |
@ -3732,6 +3831,14 @@ models:
tests:
- not_null
- name: booking_updated_date_utc
data_type: date
description: |
Date of when the Booking record was last updated in the Backend.
Cannot be null.
tests:
- not_null
- name: booking_check_in_at_utc
data_type: timestamp
description: |
@ -3740,14 +3847,34 @@ models:
tests:
- not_null
- name: booking_check_out_at_utc
- name: booking_check_in_date_utc
data_type: timestamp
description: |
Timestamp of the Check-out of the Booking.
Date of the Check-in of the Booking.
Cannot be null.
tests:
- not_null
- name: booking_check_out_at_utc
data_type: timestamp
description: |
Timestamp of the Check-out of the Booking.
Cannot be null.
tests:
- not_null
- name: booking_check_out_date_utc
data_type: date
description: |
Date of the Check-out of the Booking.
tests:
- not_null
- name: booking_number_of_nights
data_type: integer
description: |
Number of nights between Check-in date and Check-out date.
- name: host_currency_code
data_type: string
description: |