Get notifications when a Nexus appointment becomes available.
NexusAppointmentFinder is an Azure Functions project designed to notify users when Nexus appointments become available. This project aims to automate the process of checking for available appointments and sending notifications to users.
- Automated Appointment Checking: Periodically checks for available Nexus appointments.
- Notifications: Sends notifications when new appointments are found.
- Azure Functions: Utilizes serverless functions for scalability and efficiency.
- Integration Tests: Ensures the reliability and correctness of the functionality.
- Hardcoded to a single Nexus Location: Currently only looking for appointments in Blaine, WA.
- No UI for user management and prefrences: User alerts and settings must be entered in the database manually.
- Redis Cache incomplete for caching: Code is in place for Redis but it has not been fully tested.
- .NET Core SDK
- Azure Functions Core Tools
- An Azure account
-
Clone the repository:
git clone https://github.com/eric22f/NexusAppointmentFinder.git cd NexusAppointmentFinder
-
Install dependencies:
dotnet restore
-
Configure settings: Update the
local.settings.json
file with your Azure and notification service credentials. -
Run the Azure Functions locally:
func start
Flyway is used to manage and deploy the database schema changes.
-
Install Flyway:
- Download and install Flyway.
-
Configure Flyway:
-
Navigate to the
Database
directory in your project:cd Database
-
Create a
flyway.conf
file in theDatabase
folder with the following content:flyway.url=jdbc:sqlserver://<YourServer>;databaseName=<YourDatabase> flyway.user=<YourUsername> flyway.password=<YourPassword> flyway.locations=filesystem:./migrations
Replace
<YourServer>
,<YourDatabase>
,<YourUsername>
, and<YourPassword>
with your actual database connection details. -
-
Create the Baseline:
-
If you are setting up Flyway for the first time on an existing database, run the following command to baseline the current schema:
flyway baseline
-
-
Run Migrations:
-
To apply all available migrations and update your database schema, run:
flyway migrate
-
-
Check Migration Status:
-
To see the status of all migrations, use:
flyway info
-
-
Undo Last Migration (if needed):
-
If you need to undo the last applied migration, run:
flyway undo
-
-
Create Migration Scripts:
- Add new SQL migration scripts to the
migrations
directory. Use the naming conventionV<version>__<description>.sql
(e.g.,V2__Add_New_Column.sql
).
- Add new SQL migration scripts to the
-
Apply New Migrations:
- After adding new migration scripts, run the
flyway migrate
command again to apply them to the database.
- After adding new migration scripts, run the
-
Login to Azure:
az login
-
Create a resource group and function app:
az group create --name <ResourceGroupName> --location <Location> az functionapp create --resource-group <ResourceGroupName> --consumption-plan-location <Location> --runtime dotnet --functions-version 3 --name <AppName> --storage-account <StorageAccountName>
-
Create SQL Server database in Azure:
-
Log in to Azure Portal:
- Go to Azure Portal and sign in.
-
Create a SQL Server:
- Search for "SQL Server" and select "Create".
- Enter server name, admin username, and password.
-
Create a SQL Database:
- Search for "SQL Database" and click "Create".
- Select your resource group and server.
- Enter a database name and configure settings.
-
Review and Create:
- Review the details and click "Create".
-
Configure Firewall:
- Go to your SQL Server and configure the firewall settings to allow access.
- Deploy the functions:
func azure functionapp publish <AppName>
- The function will run periodically based on the specified timer trigger settings.
- Notifications will be sent through text or email.
Contributions are welcome! Please fork the repository and submit pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
For detailed code and further updates, visit the GitHub repository.