{"id":31559641,"url":"https://github.com/garcane/fcc-salon-appointment-db","last_synced_at":"2026-04-15T12:39:47.179Z","repository":{"id":308434106,"uuid":"851688304","full_name":"garcane/fcc-salon-appointment-db","owner":"garcane","description":"This project is part of the FreeCodeCamp Relational Database certification. The objective was to build a database that stores information about services, customers, and appointments in a salon and create a Bash script that interacts with this database to manage and schedule appointments.","archived":false,"fork":false,"pushed_at":"2025-03-26T11:29:03.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-05T23:31:09.367Z","etag":null,"topics":["bash","bash-script","bash-scripting","postgres","postgresql","postgresql-database","sql"],"latest_commit_sha":null,"homepage":"","language":"SQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garcane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-03T14:45:24.000Z","updated_at":"2025-03-26T11:29:06.000Z","dependencies_parsed_at":"2025-08-05T23:31:13.392Z","dependency_job_id":"61116c52-3089-466d-b3c9-25bc0cfe6acb","html_url":"https://github.com/garcane/fcc-salon-appointment-db","commit_stats":null,"previous_names":["garcane/fcc-salon-appointment-db"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/garcane/fcc-salon-appointment-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcane%2Ffcc-salon-appointment-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcane%2Ffcc-salon-appointment-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcane%2Ffcc-salon-appointment-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcane%2Ffcc-salon-appointment-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garcane","download_url":"https://codeload.github.com/garcane/fcc-salon-appointment-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garcane%2Ffcc-salon-appointment-db/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399690,"owners_count":25980332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","bash-scripting","postgres","postgresql","postgresql-database","sql"],"created_at":"2025-10-05T01:55:08.888Z","updated_at":"2025-10-05T01:55:14.619Z","avatar_url":"https://github.com/garcane.png","language":"SQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Salon Appointment Scheduler\n\nThis project is part of the FreeCodeCamp Relational Database certification. The objective was to build a database that stores information about services, customers, and appointments in a salon and create a Bash script that interacts with this database to manage and schedule appointments.\n\n## Project Structure\n\n- **Database**: The database is managed using PostgreSQL.\n- **Script**: A Bash script (`salon.sh`) was created to interact with the database.\n\n### Files\n\n- `salon.sql`: Contains SQL commands to create the database, including the necessary tables and relationships to store the services, customers, and appointments.\n- `salon.sh`: A Bash script to manage and schedule appointments by interacting with the database based on user input.\n\n## Database Schema\n![diagram-export-03-09-2024-18_29_49](https://github.com/user-attachments/assets/1e163831-ec31-4cfe-b8fd-7fa87a72328b)\n\n\nThe database consists of the following tables:\n\n### `services` Table\n\n| Column Name    | Data Type | Constraints      |\n| -------------- | --------- | ---------------- |\n| `service_id`   | SERIAL    | PRIMARY KEY      |\n| `name`         | VARCHAR   | UNIQUE, NOT NULL |\n\n### `customers` Table\n\n| Column Name    | Data Type | Constraints      |\n| -------------- | --------- | ---------------- |\n| `customer_id`  | SERIAL    | PRIMARY KEY      |\n| `phone`        | VARCHAR   | UNIQUE, NOT NULL |\n| `name`         | VARCHAR   | NOT NULL         |\n\n### `appointments` Table\n\n| Column Name    | Data Type | Constraints                           |\n| -------------- | --------- | ------------------------------------- |\n| `appointment_id`| SERIAL   | PRIMARY KEY                           |\n| `customer_id`  | INTEGER   | REFERENCES `customers(customer_id)`   |\n| `service_id`   | INTEGER   | REFERENCES `services(service_id)`      |\n| `time`         | TIMESTAMP | NOT NULL                              |\n\n## Usage\n\n### Prerequisites\n\n- **PostgreSQL**: Ensure PostgreSQL is installed and running on your machine. Connect to the database using:\n\n  ```bash\n  psql --username=freecodecamp --dbname=salon\n  ```\n\n- **Database Setup**: The database should be created and populated using the provided `salon.sql` file.\n\n### Running the Script\n\nThe `salon.sh` script can be run from the command line:\n\n```bash\n./salon.sh\n```\n\n- **Service Selection**: The script will display a list of available services for the user to choose from.\n- **Customer Details**: The user will be prompted to enter their phone number. If the phone number is not found in the database, the user will be asked to provide their name.\n- **Appointment Scheduling**: The user will then be asked to provide a preferred time for the appointment.\n- **Confirmation**: The script will confirm the appointment details with the user.\n\n### Example Usage\n\n```bash\n~~~~~ MY SALON ~~~~~\n\nWelcome to My Salon, how can I help you?\n\n1) Haircut\n2) Manicure\n3) Pedicure\n\n# Select a service\n1\n\n# Enter phone number\n555-1234\n\n# If new customer\nWhat's your name?\nJohn Doe\n\n# Enter preferred time\n2:00 PM\n\n# Confirmation\nI have put you down for a Haircut at 2:00 PM, John Doe.\n```\n\n### Error Handling\n\n- If an invalid service number is entered, the script will prompt: `That is not a valid number.`\n- If no available services are found, the script will prompt: `I could not find that service. What would you like today?`\n\n## Project Completion\n\n### Fixing the Database\n\nThe database was set up and refined to meet the project requirements:\n\n1. The `services` table stores available salon services.\n2. The `customers` table stores customer information, including unique phone numbers.\n3. The `appointments` table stores scheduled appointments, linking services and customers.\n\n### Bash Script\n\nThe `salon.sh` script was developed to manage and schedule salon appointments by interacting with the PostgreSQL database. \n\n## Installation\n\n1. Clone this repository.\n2. Set up the database:\n   - Log in to PostgreSQL:\n     ```bash\n     psql --username=freecodecamp --dbname=postgres\n     ```\n   - Run the SQL commands in `salon.sql` to create and populate the database:\n     ```sql\n     \\i salon.sql\n     ```\n3. Make sure the `salon.sh` script has execution permissions:\n   ```bash\n   chmod +x salon.sh\n   ```\n\n4. Run the script as described above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarcane%2Ffcc-salon-appointment-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarcane%2Ffcc-salon-appointment-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarcane%2Ffcc-salon-appointment-db/lists"}