Files
Hotel-Booking/Backend/seed_policy_pages.py
Iliyan Angelov 4ab7546de0 updates
2025-11-21 10:55:05 +02:00

518 lines
22 KiB
Python
Executable File

#!/usr/bin/env python3
import sys
import os
from pathlib import Path
import json
sys.path.insert(0, str(Path(__file__).parent))
from sqlalchemy.orm import Session
from src.config.database import SessionLocal
from src.models.page_content import PageContent, PageType
from datetime import datetime
def get_db():
db = SessionLocal()
try:
return db
finally:
pass
def seed_privacy_policy(db: Session):
print("=" * 80)
print("SEEDING PRIVACY POLICY PAGE CONTENT")
print("=" * 80)
privacy_content = """
<h2>Introduction</h2>
<p>At our hotel, we are committed to protecting your privacy and ensuring the security of your personal information. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you visit our website or use our services.</p>
<h2>Information We Collect</h2>
<p>We collect information that you provide directly to us, including:</p>
<ul>
<li>Personal identification information (name, email address, phone number)</li>
<li>Payment information (credit card details, billing address)</li>
<li>Booking and reservation details</li>
<li>Preferences and special requests</li>
</ul>
<h2>How We Use Your Information</h2>
<p>We use the information we collect to:</p>
<ul>
<li>Process and manage your bookings and reservations</li>
<li>Communicate with you about your bookings and our services</li>
<li>Improve our services and customer experience</li>
<li>Send you promotional materials (with your consent)</li>
<li>Comply with legal obligations</li>
</ul>
<h2>Data Security</h2>
<p>We implement appropriate technical and organizational measures to protect your personal information against unauthorized access, alteration, disclosure, or destruction.</p>
<h2>Your Rights</h2>
<p>You have the right to:</p>
<ul>
<li>Access your personal information</li>
<li>Correct inaccurate information</li>
<li>Request deletion of your information</li>
<li>Object to processing of your information</li>
<li>Data portability</li>
</ul>
<h2>Contact Us</h2>
<p>If you have any questions about this Privacy Policy, please contact us at privacy@hotel.com.</p>
<p><strong>Last updated:</strong> """ + datetime.now().strftime("%B %d, %Y") + """</p>
"""
privacy_data = {
"title": "Privacy Policy",
"subtitle": "Your privacy is important to us",
"description": "Learn how we collect, use, and protect your personal information.",
"content": privacy_content,
"meta_title": "Privacy Policy - Luxury Hotel | Data Protection & Privacy",
"meta_description": "Read our privacy policy to understand how we collect, use, and protect your personal information when you use our hotel booking services."
}
existing = db.query(PageContent).filter(PageContent.page_type == PageType.PRIVACY).first()
if existing:
for key, value in privacy_data.items():
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
print("✓ Updated existing privacy policy page content")
else:
new_content = PageContent(
page_type=PageType.PRIVACY,
**privacy_data
)
db.add(new_content)
print("✓ Created new privacy policy page content")
db.commit()
print("\n✅ Privacy policy page content seeded successfully!")
print("=" * 80)
def seed_terms_conditions(db: Session):
print("=" * 80)
print("SEEDING TERMS & CONDITIONS PAGE CONTENT")
print("=" * 80)
terms_content = """
<h2>Agreement to Terms</h2>
<p>By accessing and using our hotel's website and services, you accept and agree to be bound by the terms and provision of this agreement.</p>
<h2>Booking Terms</h2>
<p>When making a reservation with us, you agree to:</p>
<ul>
<li>Provide accurate and complete information</li>
<li>Be responsible for all charges incurred during your stay</li>
<li>Comply with hotel policies and regulations</li>
<li>Respect other guests and hotel property</li>
</ul>
<h2>Payment Terms</h2>
<p>Payment terms include:</p>
<ul>
<li>A 20% deposit is required to secure your booking</li>
<li>The remaining balance is due on arrival at the hotel</li>
<li>All prices are subject to applicable taxes and fees</li>
<li>Payment methods accepted: credit cards, debit cards, and cash</li>
</ul>
<h2>Cancellation Policy</h2>
<p>Our cancellation policy is as follows:</p>
<ul>
<li>Cancellations made 48 hours or more before check-in: Full refund of deposit</li>
<li>Cancellations made less than 48 hours before check-in: Deposit is non-refundable</li>
<li>No-shows: Full booking amount is charged</li>
</ul>
<h2>Check-in and Check-out</h2>
<p>Standard check-in time is 3:00 PM and check-out time is 11:00 AM. Early check-in and late check-out may be available upon request and subject to availability.</p>
<h2>Guest Responsibilities</h2>
<p>Guests are responsible for:</p>
<ul>
<li>Any damage to hotel property</li>
<li>Compliance with all hotel rules and regulations</li>
<li>Respecting quiet hours and other guests</li>
<li>Proper use of hotel facilities</li>
</ul>
<h2>Limitation of Liability</h2>
<p>The hotel shall not be liable for any loss, damage, or injury to persons or property during your stay, except where such loss, damage, or injury is caused by our negligence.</p>
<h2>Modifications to Terms</h2>
<p>We reserve the right to modify these terms at any time. Changes will be effective immediately upon posting on our website.</p>
<h2>Contact Information</h2>
<p>For questions about these terms, please contact us at legal@hotel.com.</p>
<p><strong>Last updated:</strong> """ + datetime.now().strftime("%B %d, %Y") + """</p>
"""
terms_data = {
"title": "Terms & Conditions",
"subtitle": "Please read these terms carefully",
"description": "Terms and conditions governing your use of our hotel booking services.",
"content": terms_content,
"meta_title": "Terms & Conditions - Luxury Hotel | Booking Terms & Policies",
"meta_description": "Read our terms and conditions to understand the rules and policies governing your bookings and stay at our luxury hotel."
}
existing = db.query(PageContent).filter(PageContent.page_type == PageType.TERMS).first()
if existing:
for key, value in terms_data.items():
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
print("✓ Updated existing terms & conditions page content")
else:
new_content = PageContent(
page_type=PageType.TERMS,
**terms_data
)
db.add(new_content)
print("✓ Created new terms & conditions page content")
db.commit()
print("\n✅ Terms & conditions page content seeded successfully!")
print("=" * 80)
def seed_refunds_policy(db: Session):
print("=" * 80)
print("SEEDING REFUNDS POLICY PAGE CONTENT")
print("=" * 80)
refunds_content = """
<h2>Refund Policy Overview</h2>
<p>At our hotel, we understand that plans can change. This policy outlines our refund procedures and timelines for various scenarios.</p>
<h2>Booking Cancellations</h2>
<p>Refunds for cancelled bookings are processed as follows:</p>
<ul>
<li><strong>More than 48 hours before check-in:</strong> Full refund of the 20% deposit</li>
<li><strong>48 hours or less before check-in:</strong> Deposit is non-refundable</li>
<li><strong>No-show:</strong> No refund will be issued</li>
</ul>
<h2>Early Check-out</h2>
<p>If you check out earlier than your reserved departure date:</p>
<ul>
<li>You will be charged for the nights you stayed</li>
<li>The remaining 80% balance for unused nights will be refunded</li>
<li>Refunds are processed within 5-7 business days</li>
</ul>
<h2>Service Issues</h2>
<p>If you experience service issues during your stay:</p>
<ul>
<li>Please report the issue immediately to our front desk</li>
<li>We will make every effort to resolve the issue promptly</li>
<li>If the issue cannot be resolved, partial or full refunds may be considered on a case-by-case basis</li>
</ul>
<h2>Refund Processing Time</h2>
<p>Refunds are typically processed within:</p>
<ul>
<li><strong>Credit/Debit Cards:</strong> 5-7 business days</li>
<li><strong>Bank Transfers:</strong> 7-10 business days</li>
<li><strong>Cash Payments:</strong> Refunds will be processed via bank transfer</li>
</ul>
<h2>Refund Method</h2>
<p>Refunds will be issued to the original payment method used for the booking. If the original payment method is no longer available, please contact us to arrange an alternative refund method.</p>
<h2>Non-Refundable Bookings</h2>
<p>Some special offers or promotional rates may be non-refundable. This will be clearly stated at the time of booking.</p>
<h2>Force Majeure</h2>
<p>In cases of force majeure (natural disasters, pandemics, government restrictions, etc.), we will work with you to reschedule your booking or provide appropriate refunds based on the circumstances.</p>
<h2>Dispute Resolution</h2>
<p>If you have concerns about a refund decision, please contact our customer service team. We are committed to resolving all disputes fairly and promptly.</p>
<h2>Contact Us</h2>
<p>For refund inquiries, please contact us at refunds@hotel.com or call our customer service line.</p>
<p><strong>Last updated:</strong> """ + datetime.now().strftime("%B %d, %Y") + """</p>
"""
refunds_data = {
"title": "Refunds Policy",
"subtitle": "Our commitment to fair refunds",
"description": "Learn about our refund policies and procedures for bookings and cancellations.",
"content": refunds_content,
"meta_title": "Refunds Policy - Luxury Hotel | Cancellation & Refund Terms",
"meta_description": "Understand our refund policy, including cancellation terms, processing times, and how to request refunds for your hotel bookings."
}
existing = db.query(PageContent).filter(PageContent.page_type == PageType.REFUNDS).first()
if existing:
for key, value in refunds_data.items():
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
print("✓ Updated existing refunds policy page content")
else:
new_content = PageContent(
page_type=PageType.REFUNDS,
**refunds_data
)
db.add(new_content)
print("✓ Created new refunds policy page content")
db.commit()
print("\n✅ Refunds policy page content seeded successfully!")
print("=" * 80)
def seed_cancellation_policy(db: Session):
print("=" * 80)
print("SEEDING CANCELLATION POLICY PAGE CONTENT")
print("=" * 80)
cancellation_content = """
<h2>Cancellation Policy Overview</h2>
<p>We understand that plans can change. This policy outlines our cancellation procedures and fees.</p>
<h2>Standard Cancellation Terms</h2>
<p>For standard bookings, the following cancellation terms apply:</p>
<ul>
<li><strong>More than 48 hours before check-in:</strong> Full refund of the 20% deposit</li>
<li><strong>48 hours or less before check-in:</strong> Deposit is non-refundable</li>
<li><strong>No-show:</strong> No refund will be issued</li>
</ul>
<h2>Special Rate Bookings</h2>
<p>Some special rates or promotional offers may have different cancellation terms. Please review your booking confirmation for specific details.</p>
<h2>How to Cancel</h2>
<p>To cancel your booking:</p>
<ul>
<li>Log into your account and visit "My Bookings"</li>
<li>Select the booking you wish to cancel</li>
<li>Click "Cancel Booking" and confirm</li>
<li>Or contact us directly via phone or email</li>
</ul>
<h2>Refund Processing</h2>
<p>Refunds will be processed to the original payment method within 5-10 business days after cancellation confirmation.</p>
<p><strong>Last updated:</strong> """ + datetime.now().strftime("%B %d, %Y") + """</p>
"""
cancellation_data = {
"title": "Cancellation Policy",
"subtitle": "Flexible cancellation options for your peace of mind",
"description": "Learn about our cancellation policy, fees, and refund procedures.",
"content": cancellation_content,
"meta_title": "Cancellation Policy - Luxury Hotel | Booking Cancellation Terms",
"meta_description": "Review our cancellation policy to understand cancellation fees, refund procedures, and terms for modifying or canceling your hotel booking."
}
existing = db.query(PageContent).filter(PageContent.page_type == PageType.CANCELLATION).first()
if existing:
for key, value in cancellation_data.items():
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
print("✓ Updated existing cancellation policy page content")
else:
new_content = PageContent(
page_type=PageType.CANCELLATION,
**cancellation_data
)
db.add(new_content)
print("✓ Created new cancellation policy page content")
db.commit()
print("\n✅ Cancellation policy page content seeded successfully!")
print("=" * 80)
def seed_accessibility_policy(db: Session):
print("=" * 80)
print("SEEDING ACCESSIBILITY PAGE CONTENT")
print("=" * 80)
accessibility_content = """
<h2>Our Commitment to Accessibility</h2>
<p>We are committed to ensuring that our hotel and website are accessible to all guests, regardless of ability. We strive to provide an inclusive experience for everyone.</p>
<h2>Hotel Accessibility Features</h2>
<p>Our hotel offers the following accessibility features:</p>
<ul>
<li>Wheelchair-accessible rooms with roll-in showers</li>
<li>Accessible parking spaces</li>
<li>Elevator access to all floors</li>
<li>Ramp access to main entrances</li>
<li>Accessible public restrooms</li>
<li>Visual and auditory emergency alarms</li>
<li>Service animal friendly</li>
</ul>
<h2>Website Accessibility</h2>
<p>We are continuously working to improve the accessibility of our website. Our website includes:</p>
<ul>
<li>Keyboard navigation support</li>
<li>Screen reader compatibility</li>
<li>Alt text for images</li>
<li>High contrast options</li>
<li>Resizable text</li>
</ul>
<h2>Requesting Accommodations</h2>
<p>If you require specific accommodations during your stay, please contact us at least 48 hours before your arrival. We will do our best to accommodate your needs.</p>
<h2>Feedback</h2>
<p>We welcome feedback on how we can improve accessibility. Please contact us with your suggestions or concerns.</p>
<p><strong>Last updated:</strong> """ + datetime.now().strftime("%B %d, %Y") + """</p>
"""
accessibility_data = {
"title": "Accessibility",
"subtitle": "Committed to providing an inclusive experience for all guests",
"description": "Learn about our accessibility features and accommodations.",
"content": accessibility_content,
"meta_title": "Accessibility - Luxury Hotel | Accessible Accommodations",
"meta_description": "Discover our commitment to accessibility, including accessible rooms, facilities, and website features for guests with disabilities."
}
existing = db.query(PageContent).filter(PageContent.page_type == PageType.ACCESSIBILITY).first()
if existing:
for key, value in accessibility_data.items():
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
print("✓ Updated existing accessibility page content")
else:
new_content = PageContent(
page_type=PageType.ACCESSIBILITY,
**accessibility_data
)
db.add(new_content)
print("✓ Created new accessibility page content")
db.commit()
print("\n✅ Accessibility page content seeded successfully!")
print("=" * 80)
def seed_faq_page(db: Session):
print("=" * 80)
print("SEEDING FAQ PAGE CONTENT")
print("=" * 80)
faq_content = """
<h2>Frequently Asked Questions</h2>
<p>Find answers to common questions about our hotel, bookings, and services.</p>
<h2>Booking & Reservations</h2>
<h3>How do I make a reservation?</h3>
<p>You can make a reservation online through our website, by phone, or by email. Simply select your dates, choose your room, and complete the booking process.</p>
<h3>What is the deposit requirement?</h3>
<p>A 20% deposit is required to secure your booking. The remaining balance is due upon arrival at the hotel.</p>
<h3>Can I modify my booking?</h3>
<p>Yes, you can modify your booking by logging into your account and visiting "My Bookings", or by contacting us directly. Changes are subject to availability and may incur fees.</p>
<h2>Check-in & Check-out</h2>
<h3>What are your check-in and check-out times?</h3>
<p>Check-in is from 3:00 PM, and check-out is by 11:00 AM. Early check-in and late check-out may be available upon request, subject to availability.</p>
<h3>Do you offer early check-in or late check-out?</h3>
<p>Early check-in and late check-out are available upon request, subject to availability. Additional fees may apply.</p>
<h2>Payment & Cancellation</h2>
<h3>What payment methods do you accept?</h3>
<p>We accept major credit cards, debit cards, and bank transfers. Payment can be made online or at the hotel.</p>
<h3>What is your cancellation policy?</h3>
<p>For cancellations made more than 48 hours before check-in, the deposit is fully refundable. Cancellations made 48 hours or less before check-in are non-refundable. Please see our Cancellation Policy page for full details.</p>
<h2>Hotel Services & Amenities</h2>
<h3>What amenities are included?</h3>
<p>Our hotel offers complimentary Wi-Fi, parking, fitness center access, and more. Please check the room details for specific amenities.</p>
<h3>Do you have parking available?</h3>
<p>Yes, we offer complimentary parking for all guests. Valet parking is also available for an additional fee.</p>
<h3>Is Wi-Fi available?</h3>
<p>Yes, complimentary high-speed Wi-Fi is available throughout the hotel.</p>
<h2>Special Requests</h2>
<h3>Can I request a specific room?</h3>
<p>Yes, you can make special requests when booking. We will do our best to accommodate your preferences, subject to availability.</p>
<h3>Do you accommodate dietary restrictions?</h3>
<p>Yes, please inform us of any dietary restrictions or allergies when making your reservation, and we will do our best to accommodate your needs.</p>
<h2>Contact & Support</h2>
<h3>How can I contact the hotel?</h3>
<p>You can contact us by phone, email, or through our website's contact form. Our team is available 24/7 to assist you.</p>
<p><strong>Last updated:</strong> """ + datetime.now().strftime("%B %d, %Y") + """</p>
"""
faq_data = {
"title": "Frequently Asked Questions",
"subtitle": "Find answers to common questions",
"description": "Get answers to frequently asked questions about bookings, services, and policies.",
"content": faq_content,
"meta_title": "FAQ - Luxury Hotel | Frequently Asked Questions",
"meta_description": "Find answers to common questions about hotel bookings, check-in, payment, cancellation, amenities, and more."
}
existing = db.query(PageContent).filter(PageContent.page_type == PageType.FAQ).first()
if existing:
for key, value in faq_data.items():
setattr(existing, key, value)
existing.updated_at = datetime.utcnow()
print("✓ Updated existing FAQ page content")
else:
new_content = PageContent(
page_type=PageType.FAQ,
**faq_data
)
db.add(new_content)
print("✓ Created new FAQ page content")
db.commit()
print("\n✅ FAQ page content seeded successfully!")
print("=" * 80)
def main():
db = get_db()
try:
print("\n")
seed_privacy_policy(db)
print("\n")
seed_terms_conditions(db)
print("\n")
seed_refunds_policy(db)
print("\n")
seed_cancellation_policy(db)
print("\n")
seed_accessibility_policy(db)
print("\n")
seed_faq_page(db)
print("\n")
print("=" * 80)
print("✅ ALL POLICY PAGES SEEDED SUCCESSFULLY!")
print("=" * 80)
print("\n")
except Exception as e:
print(f"\n❌ Error: {e}")
import traceback
traceback.print_exc()
db.rollback()
finally:
db.close()
if __name__ == "__main__":
main()