A .NET Web API for managing primates in a zoo environment, including animal records, feeding schedules, and health records.
- 🦍 Animal Management (CRUD operations)
- 🍌 Feeding Schedule Management
- 🏥 Health Records Management
- 🔐 Azure AD B2C Authentication
- 👥 Role-Based Access Control (RBAC)
- 📚 API Versioning
- 📝 Swagger Documentation
- .NET SDK 8.0 or later
- Visual Studio 2022 or VS Code (optional)
- SQL Server (for production) or SQLite (included for development)
- Clone the repository:
git clone https://github.com/Nightlurker/MonkeyManager.API.git
cd MonkeyManager.API-
Update the configuration in
appsettings.jsonandappsettings.Development.json:- For development, SQLite is used by default
- For production, configure the SQL Server connection string
- Configure Azure AD B2C settings
-
Apply database migrations:
dotnet ef database update- Run the application:
dotnet runThe API will be available at:
- HTTPS: https://localhost:7012
- HTTP: http://localhost:5227
- Swagger UI: https://localhost:7012/swagger
The API uses Azure AD B2C for authentication. Users must be assigned one of the following roles:
- Admin: Full access to all endpoints
- Zookeeper: Access to animal and feeding schedule management
- Veterinarian: Access to animal and health record management
- Guest: Read-only access to animal information
- GET
/api/v1/animals- List all animals (supports pagination) - GET
/api/v1/animals/{id}- Get a specific animal - POST
/api/v1/animals- Create a new animal - PUT
/api/v1/animals/{id}- Update an animal - DELETE
/api/v1/animals/{id}- Archive an animal (soft delete)
- GET
/api/v1/feedingschedules- List all feeding schedules - GET
/api/v1/feedingschedules/{id}- Get a specific schedule - POST
/api/v1/feedingschedules- Create a new schedule - PUT
/api/v1/feedingschedules/{id}- Update a schedule - DELETE
/api/v1/feedingschedules/{id}- Delete a schedule
- GET
/api/v1/healthrecords- List all health records - GET
/api/v1/healthrecords/{id}- Get a specific record - POST
/api/v1/healthrecords- Create a new record - PUT
/api/v1/healthrecords/{id}- Update a record - DELETE
/api/v1/healthrecords/{id}- Delete a record
The solution uses:
- Entity Framework Core for data access
- SQLite for development database
- SQL Server for production database
- Global error handling middleware
- Role-based authorization
- Azure AD B2C integration
- Animals: Basic information about primates
- FeedingSchedules: Feeding times and food items
- HealthRecords: Medical history and examinations
In development mode, the database is automatically seeded with test data:
- 6 animals (5 active, 1 archived)
- 5 feeding schedules
- 12 health records
- Update the SQL Server connection string in
appsettings.json - Configure Azure AD B2C settings
- Apply migrations to production database:
dotnet ef database update --connection "your-production-connection-string"- Deploy using your preferred hosting method (Azure App Service recommended)
The API includes global error handling that returns consistent error responses:
- Validation errors (400 Bad Request)
- Not found errors (404 Not Found)
- Authorization errors (401 Unauthorized)
- Permission errors (403 Forbidden)
- Server errors (500 Internal Server Error)
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a pull request
This project is licensed under the MIT License - see the LICENSE file for details.