DigiReserve is a versatile and customizable ASP.NET Core-based API designed for managing reservations across different industries. This API is structured for scalability and includes robust features to manage time slots, reservations, user authentication, and more.
DigiReserve provides a RESTful interface to manage reservation data for various industries. Key features include:
- User Management: Authentication and user profile management.
- Reservation Handling: Create, view, update, and cancel reservations.
- Time Slot Management: Define and manage available reservation times.
Prerequisites:
- .NET Core SDK 6.x or higher
- SQL Server or another supported database for data storage
Steps:
-
Clone this repository:
git clone https://github.com/your-repository/DigiReserve.git
-
Navigate to the project directory:
cd DigiReserve -
Restore dependencies:
dotnet restore
-
Update the
appsettings.jsonfile to configure your database connection and other settings (see Configuration for details). -
Run the API:
dotnet run
Modify appsettings.json to customize settings:
- ConnectionStrings: Define your database connection here.
- JWTSettings: Configure JWT authentication settings for secure API access.
Example:
{
"ConnectionStrings": {
"DefaultConnection": "Your SQL Server connection string here"
},
"JWTSettings": {
"Secret": "YourSecretKey",
"Issuer": "DigiReserveAPI",
"Audience": "DigiReserveClient"
}
}Below are the primary API endpoints for DigiReserve.
- POST /api/auth/register: Register a new user.
- POST /api/auth/login: Authenticate a user and retrieve a JWT token.
- GET /api/user/profile: Retrieve the authenticated user's profile information.
- PUT /api/user/profile: Update the authenticated user's profile.
- GET /api/reservations: Retrieve all reservations.
- POST /api/reservations: Create a new reservation.
- PUT /api/reservations/{id}: Update an existing reservation.
- DELETE /api/reservations/{id}: Delete a reservation by ID.
- GET /api/timeslots: Retrieve all available time slots.
- POST /api/timeslots: Create a new time slot.
- PUT /api/timeslots/{id}: Update a time slot.
- DELETE /api/timeslots/{id}: Delete a time slot by ID.
Here are some quick examples of using the API endpoints:
Register a User:
curl -X POST "https://your-api-url/api/auth/register" -H "Content-Type: application/json" -d '{
"username": "newuser",
"password": "password123"
}'Create a Reservation:
curl -X POST "https://your-api-url/api/reservations" -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -d '{
"timeSlotId": 1,
"userId": 123
}'