Sign inSign up

straightchlorine/event-reservation-api

By straightchlorine

•Updated 11 months ago

Group project with - backend & frontend (by @kubson2002) for an event reservation service.

Image
API management
0

223

straightchlorine/event-reservation-api repository overview

⁠Ticket Reservation API

This project is a university exercise designed to simulate a ticket reservation system for sports events. It does not include payment processing or other real-world functionalities.


⁠Features

  • RESTful API for managing:
    • Users
    • Events
    • Locations
    • Reservations
  • Authentication for routes with sensitive data.
  • NocoDB for visual database exploration.
  • Swagger Documentation for testing and exploring endpoints.

⁠Prerequisites


⁠Setup

  1. Clone the repository:

    git clone [email protected]:straightchlorine/event-reservation-api.git && cd event-reservation-api
    
  2. Configure environment variables:

    Use the provided .env file and modify it as needed.

  3. Build and run the application:

    docker-compose build && docker-compose up
    

⁠Services

Utilising provided .env:

⁠API Endpoints

⁠Events
  • GET /events - Retrieve all events.
  • PUT /events - Create a new event (admin).
  • DELETE /events/{id} - Delete an event (admin).
  • GET /events/{id} - Retrieve an event by ID.
  • PUT /events/{id} - Update an event (admin).
⁠Locations
  • GET /locations - Retrieve all locations.
  • PUT /locations - Create a new location (admin).
  • DELETE /locations/{id} - Delete a location (admin).
  • GET /locations/{id} - Retrieve a location by ID.
  • PUT /locations/{id} - Update a location (admin).
⁠Authentication
  • POST /login - Log in to the API.
  • POST /logout - Log out from the API.
⁠Reservations
  • GET /reservations - List all reservations (admin).
  • DELETE /reservations/{id} - Delete a reservation by ID (admin).
  • GET /reservations/{id} - Retrieve a reservation by ID (admin/resource owner).
  • POST /reservations/{id}/cancel - Cancel a reservation (admin/resource owner).
  • GET /reservations/{id}/tickets - List tickets for a reservation (admin/resource owner).
  • PUT /reservations - Create a reservation (at least registered).
  • GET /reservations/user - List reservations for the current user.
  • GET /reservations/user/{id} - List reservations for a user by ID (admin/resource owner).
  • GET /reservations/user/{id}/tickets - List tickets for a user by ID (admin/resource owner).
  • GET /reservations/user/tickets - List tickets for the current user.
⁠Users
  • GET /users - List all users (admin).
  • PUT /users - Create a new user.
  • DELETE /users/{id} - Delete a user by ID (admin/resource owner).
  • GET /users/{id} - Retrieve a user by ID (admin).
  • PUT /users/{id} - Update a user by ID.

⁠Environment Variables

Variable NameDescriptionDefault Value
DB_HOSTPostgreSQL database hostdatabase
DB_PORTPostgreSQL database port5432
DB_USERDatabase usernamepostgres
DB_PASSWORDDatabase passwordpassword
DB_NAMEName of the PostgreSQL databaseevent_api
NC_DB_USERNocoDB database usernamenocodb
NC_DB_PASSWORDNocoDB database passwordpassword
NC_DB_NAMENocoDB database namenocodb_metadata
NC_DB_PORTNocoDB database port8081
NC_AUTH_JWTJWT secret for NocoDB authenticationnocodb-jwt-secret
API_PORTAPI server port8080
API_JWT_SECRETJWT secret for API authenticationapi-secret
API_ROOT_NAMEAdmin username for API setuproot
API_ROOT_PASSWORDAdmin password for API setuproot
API_TOKEN_VALID_HOURSToken validity duration (in hours)24
SWAGGER_PORTPort for serving Swagger documentation80

⁠Notes

  • Authentication: Many routes require authentication with role-based permissions (e.g., admin, owner).
  • Dynamic IDs: Routes using {id} operate on a specific resource identified by its ID.

Tag summary

Content type

Image

Digest

sha256:ef35df104…

Size

365.2 MB

Last updated

11 months ago

docker pull straightchlorine/event-reservation-api