Skip to content

Appointment Scheduling System API. Features user authentication, date validation, and swagger documentation.

Notifications You must be signed in to change notification settings

pedrogardim/ink-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tattoo Studio API πŸ–‹οΈ

Welcome to the Tattoo Studio API documentation. This robust API manages user authentication, appointment scheduling, and tattoo artist portfolios. It's the 4th project of the GeeksHub Academy Fullstack Bootcamp, showcasing real-world backend development skills with TypeScript and Express.

Table of Contents πŸ—‚οΈ

Stack πŸ› οΈ

TypeScriptNode.jsExpress.jsMySQLDockerJWTSwaggerPostmanJWT

Features 🌟

  • User Authentication: Secure signup and login processes. πŸ”’
  • Appointment Creation: Users can book appointments, with date and user profile validation. πŸ“…
  • Tattoo Artist Portfolios: Tattooists can upload examples of their work. 🎨
  • Admin CRUD Endpoints: Full control over users, appointments, and tattoo works for administrators. πŸ‘©β€πŸ’ΌπŸ‘¨β€πŸ’Ό
  • Swagger Documentation: Fully documented API endpoints. πŸ“š
  • Docker Compose: Easy setup and deployment with Docker. 🐳
  • Google-Style JSON Responses: Consistently formatted responses. πŸ“
  • MySQL Database with TypeORM and Migrations: Robust database management. πŸ—„οΈ
  • Mock Data Generation: Realistic data generation with Faker.js. πŸ€–
  • JWT Authentication: Secure API endpoints with JSON Web Tokens. πŸ”‘
  • Error Handling: Custom error middleware for handling common API errors. πŸ“

Live Deployment πŸ“‘

Try out the API at:

https://tattoo-booking-api-production.up.railway.app/api

Installation πŸš€

Get a copy of the project up and running on your local machine for development and testing purposes.

git clone https://github.com/pedrogardim/tattoo-booking-api.git
cd tattoo-booking-api

Running with Docker βš“οΈ

docker-compose up --build

(You'll need Docker and Docker Compose installed on your machine.)

Running directly with Node

npm install             # Install dependecies
npm run migrations:run  # Run migrations
npm run seed            # Populate DB with mock
npm run dev             # Run server

You'll need add a .env based on the provided .env.example file with the database credentials, and have a MySQL server running.

API Documentation πŸ“˜

Access the Swagger documentation at:

Database Design πŸ“–

ERD

Relationships

  • Users to Appointments: Double one-to-many relationship where:
    • One user (as a client) can have many appointments.
    • One user (as a tattooist) can be associated with many appointments.
  • Users to Tattoo Works: One-to-many relationship where one tattooist can have many works

Indices and Constraints

  • Users table:
    • Unique constraint on email to ensure each user has a unique email address.
  • Appointments and Tattoo Works tables:
    • Foreign key constraint on client_id and tattooist_id referring to id in the Users table.

API Endpoints πŸ”Œ

Check the swagger documentation for a complete documentation of the API endpoints.

(Click to expand)

Documentation
  • GET /api-docs - Swagger documentation.
User Endpoints
Authentication πŸ”’
  • POST /api/auth/register - Register a new user.
  • POST /api/auth/login - Login an existing user.
Users πŸ‘€
  • GET /api/users/me - Retrieve authenticated user's profile.
  • PUT /api/users/me - Update authenticated user's profile.
  • DELETE /api/users/me - Delete authenticated user.
  • GET /api/users/getTattooists - List all tattooists.
User Appointments πŸ“…
  • GET /api/appointments/my - Retrieve user's appointments.
  • POST /api/appointments/my - Request a new appointment.
  • GET /api/appointments/my/{id} - Retrieve details of a specific appointment.
  • PUT /api/appointments/my/{id} - Update a specific appointment.
  • DELETE /api/appointments/my/{id} - Delete a specific appointment.
TattooWorks - Public 🌍
  • GET /api/tattooWorks - List all tattoo works.
  • GET /api/tattooWorks/{id} - Retrieve a specific tattoo work by ID.
TattooWorks - Tattooist 🎨
  • GET /api/tattooWorks/my - Retrieve a tattooist's works.
  • POST /api/tattooWorks/my - Create a new work for the authenticated tattooist.
  • PUT /api/tattooWorks/my/{id} - Update a specific tattoo work by ID.
  • DELETE /api/tattooWorks/my/{id} - Delete a specific tattoo work by ID.
Admin endpoints
Admin CRUD Endpoints - Users πŸ‘©β€πŸ’ΌπŸ‘¨β€πŸ’Ό
  • GET /api/users - List all users.
  • POST /api/users - Create a new user.
  • GET /api/users/{id} - Retrieve a user by ID.
  • PUT /api/users/{id} - Update a user by ID.
  • DELETE /api/users/{id} - Delete a user by ID.
  • PUT /api/users/setAsTattooist/{id} - Set a user as a tattooist.
Admin CRUD Endpoints - Appointments πŸ“…
  • GET /api/appointments - List all appointments.
  • POST /api/appointments - Create a new appointment.
  • GET /api/appointments/{id} - Retrieve a specific appointment by ID.
  • PUT /api/appointments/{id} - Update a specific appointment by ID.
  • DELETE /api/appointments/{id} - Delete a specific appointment by ID.
Admin CRUD Endpoints - TattooWorks 🎨
  • POST /api/tattooWorks - Create a new tattoo work.
  • PUT /api/tattooWorks/{id} - Update a tattoo work by ID.
  • DELETE /api/tattooWorks/{id} - Delete a tattoo work by ID.

Author βœ’οΈ

Roadmap πŸ›£οΈ

  • Add notifications - So users know when their appointments are modified, created or deleted.
  • Add a React frontend - So users can interact with the API from a web browser.

Acknowledgements πŸŽ“

  • A big shoutout to the Geekshubs Academy for the opportunity to learn and grow as a developer.

About

Appointment Scheduling System API. Features user authentication, date validation, and swagger documentation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published