Skip to content

quicoju/hch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

488 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hch - Hotel Check-in Helper

About

This library (WIP) provides the logic for creating software to automate the task of managing reservations in a hotel business.

Dependencies

This software requires a Unix based OS to build and run, currently it’s being developed and tested under Gentoo GNU/Linux and OpenBSD.

Required

Optional

  • The Catch2 test framework (for running unit tests)
  • The sqlite3 cli (running integration tests for the “sqlite” backend)
  • pybind11 for building the Python bindings

Build

The project contains 2 different “Makefiles”, one for BSDMake Makefile and one for GNUMake GNUmakefile.

This software supports two different back-ends for storing information:

  • memory: for volatile data, everything is flushed after the process terminates
  • sqlite: handles data persistence using sqlite

The “memory” backend is the default, since it’s very convenient for development. To change the backend, set the “BACKEND” variable to any of the supported backend names.

To build the in-memory backend (default):

make hch
make BACKEND=memory hch   # set the backend explicitly

To build with the sqlite backend support:

make BACKEND=sqlite hch

To clean the compiled code and test data, use the clean target.

make clean

Note: Take into account that changing the “BACKEND” requires you to clean and rebuild the whole project.

Python bindings

This library provides symbol bindings for creating clients using the Python language. To build the bindings use the bindings target.

make bindings

Check out the bindings test file to see an example on how to use the bindings.

Test

In order to run the tests, use the make’s test target.

make clean test                  # in-memory backend
make BACKEND=sqlite clean test

To run the tests for the Python bindings use the test_py target.

make test_py                      # in-memory
make BACKEND=sqlite clean test_py

Run

Building hch will create an hch executable in the top directory of the project.

If the executable was built with the “memory” backend, then it’ll load a “mock” hotel by default. To get an idea of this mock see the HotelData.hh file.

On the other hand, if the executable was built with the “sqlite” backend, then the database needs to be built before running hch, the database can be generated using the database target:

make database

But if you want to create a “mock” hotel, in your database call the mockhotel target instead:

make mockhotel

Now it should be possible to execute the hch:

  1. As a single command
    ./hch list-rate --room=102
     ---
     date: 2025-11-20
     days: 1
     total: 78.99
     details:
         Balcony: 15
         Base: 58.99
         Capacity: 0
         Wifi: 5
        
  2. As a REPL
    $ ./hch --repl
    
    hch> set-room 101
    
    hch[room 101]> record-guest --email=john.bedney@mail.com
    ---
    Guest: john.bedney@mail.com
    
    hch[room 101]> reserve --guest=john.bedney@mail.com --during=2026-02-05+3d
    ---
    Reservation: W-0001
    
    hch[room 101]> unset-room
    hch> help
    ---
    Available commands:
    - cancel-reservation
    - checkin
    - checkout
    - exit
    - help
    - list-amenities
    - list-rate
    - list-reservations
    - quit
    - record-guest
    - reserve
    - set-room
    - show-reservation
    - unset-room
        

Enable logging

Setting the HCH_LOG_LEVEL environment variable to any of the following values, will enable the application logging:

  • debug
  • info
  • warning
  • error

By default all the logging information is sent to stdout, but it can otherwise be sent to a given file by setting HCH_LOG_FILE environment variable.

About

Hotel Check-in Helper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors