This project was made as part of a course Full Stack Developer for GeeksHubs Academy.
GeeksHub gave the following fictive assignment: The product department has tasked us with developing the backend corresponding to the appointment management system for a tattoo studio.
Appointment management for a tattoo studio: Users will be able to register in the application, log in and access their personal area. Within their area, they will be able to view a list of scheduled appointments for tattoo and piercing services, as well as create new appointments for various services offered by the studio.
You can find the related frontend project here: TattooStudio_Frontend
Deploy via Zeabur: ghtattooshop.zeabur.app
(This is a free version of Zeabur and can get suspended at any moment.)
This diagram shows the structure of the database tables.
- Clone the repository
$ git clone https://github.com/MandySpaan/GH_P4_TattooStudio_Backend
- Install dependencies
$ npm install --y
- Start Express on the server
$ npm run dev
- Run migrations
$ npm run run-migrations
You can find the related frontend project here: TattooStudio_Frontend
- Clone the repository
$ git clone https://github.com/MandySpaan/GH_P6_TattooStudio_Frontend
- Install dependencies
$ npm install --y
- Start Express on the server
$ npm run dev
Authentication
-
AUTH
-
REGISTER
POST http://localhost:4000/api/auth/register
body:
{ "email": "yourmail@mail.com", "password": "123456789" }
-
LOGIN
POST http://localhost:4000/api/auth/login
body:
{ "email": "yourmail@mail.com", "password": "123456789" }
-
Users
-
USERS
- GET ALL USERS (ONLY FOR ADMINS) GET http://localhost:4000/api/users auth: ``` your token ``` - SHOW USER PROFILE GET http://localhost:4000/api/users/profile auth: ``` your token ``` - CHANGE PROFILE INFO PUT http://localhost:4000/api/users/profile/change auth: ``` your token ``` body: ``` js { info you want to change goes here } ``` - PROFILE FILTERED BY EMAIL GET http://localhost:4000/api/users/:email auth: ``` your token ``` body: ``` js { "email": "the users email you want to find goes here" } ``` - DELETE USER BY ID GET http://localhost:4000/api/users/:id auth: ``` your token ``` body: ``` js { "id": "the ID of the user you want to delete goes here" } ```
Appointments
-
APPOINTMENTS
- CREATE APPOINTMENT POST http://localhost:4000/api/appointments/create auth: ``` your token ``` body: ``` js { "appointment_date": "2024/01/01", "service_id": 2 } ``` - CHANGE APPOINTMENT PUT http://localhost:4000/api/appointments/change auth: ``` your token ``` body: ``` js { "id": your appointment id, "infotochange": value } ``` - FIND APPOINTMENT BY ID GET http://localhost:4000/api/appointments/:id auth: ``` your token ``` body: ``` js { "id": 1 } ``` - SHOW USER APPOINTMENTS GET http://localhost:4000/api/appointments/scheduled auth: ``` your token ``` - DELETE APPOINTMENT DELETE http://localhost:4000/api/appointments/delete auth: ``` your token ``` body: ``` js { "id": 1 } ```
Services
-
SERVICES
-
CREATE SERVICE (only for admins) POST http://localhost:4000/api/services
auth: ``` your token ``` body: ``` js { "service_name": "Name", "description": "blablabla.com" } ```
-
SEE ALL SERVICES
GET http://localhost:4000/api/services
auth:
your token
-
UPDATE SERVICE (only for admins)
PUT http://localhost:4000/api/services/:id
auth:
your token
body:
{ "id": 2, "description": "blablabla.com" }
-
DELETE SERVICE BY ID
GET http://localhost:4000/api/services/:id
auth:
your token
body:
{ "id": 1 }
-
-
Roles
-
ROLES
-
SEE ALL ROLES (only for admins!)
GET http://localhost:4000/api/roles auth: ``` your token ```
-
CREATE ROLE (only for admins) POST http://localhost:4000/api/roles/create
auth: ``` your token ``` body: ``` js { "id": 1, "name": "hokage" } ```
-
UPDATE ROLE (only for admins)
PUT http://localhost:4000/api/roles/update/:id
auth:
your token
body:
{ "id": 2, "infotoupdate": "blablabla" }
-
DELETE ROLE
DELETE http://localhost:4000/api/roles/delete
auth:
your token
body:
{ "name": superAdmin }
-
-
Throughout the project you can find several "ToDo"-comments here and there. These are either thoughts I had myself for extra functionalities or extra options (but not requirements) to add as suggested by the original assignment.