Skip to content

First backend API project using Node, Typescript, Express and more

Notifications You must be signed in to change notification settings

yoanastamenova/Tattoo_Studio--back

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— Tattoo Studio Database Project πŸ”—

Welcome to my first backend project using various backend technologies and libraries!


Table of contents πŸ“
  1. About the project
  2. Deploy
  3. Stack
  4. ER Diagram from SQL
  5. Clone
  6. Endpoints
  7. Future functionalities
  8. Contribution
  9. Web refferences
  10. Development
  11. Appreciation
  12. Contact

About the project πŸ“

This project is about learning to use Express JS together with some other libraries such as bcrypt and jsonwebtoken on the way. The main idea was creating a Database which logs in users/admins and Super Admins to a Tattoo Studio Web Page. To be fully functional users can create appointments, change them, choose what kind of service they want and so on. The same goes for admins(the tattoo artists) and we have one super admin which is the owner of the database and can manage everything if needed.

More functionalities coming veeeery soon! :)

Deploy πŸš€

Click here! πŸš€πŸš€πŸš€

Stack

Used technologies for the project:

ER Diagram from SQL πŸ“Š

  • We have 4 entities in our Database created here. The strong among them is Roles (it can exist by itself), then we have Users which has many to one relation with roles. After this, we have Services which has One to many relation with our last entitiy (Appointments). Speaking of it - Appointments is the weekest of all entities, because it depends strongly on Users (because of the user_id) and Services(because of the service_id). More or less our database can be easily understood just by looking at the DDL schema posted here.

Local installation option βš™οΈ

  1. Clone the repository from the url
  2. $ npm install (to get all the node packages)
  3. Connect the cloned repo with our Database (if you dont have docker make a mysql container and run it on the wanted port such as: docker run -d --name mysqlc -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v mysql_data:/var/lib/mysql mysql)
  4. Change variables in .env with the PORT given from Docker
  5. $ npm run migrations
  6. $ npm run db:seed
  7. $ npm run db:refresh to execute everything from the beginning
  8. $ npm run dev to run our server

Endpoints βš’

Authentication πŸ”“
  • REGISTER

        POST http://localhost:4000/api/register
    

    body:

        {
            "email": "[email protected]",
            "password": "123456789"
        }

  • LOGIN

        POST http://localhost:4000/api/login
    

    body:

        {
            "email": "[email protected]",
            "password": "123456789"
        }
Users πŸ—‚
  • GET ALL USERS (only admin)

        GET http://localhost:4000/api/users
    

    auth:

        your token

  • GET USER PROFILE

        GET http://localhost:4000/api/users/profile
    

    auth:

        your token

  • UPDATE USER PROFILE BY ID

        PUT http://localhost:4000/api/profile/update
    

    body:

        {
        "email": "[email protected]"
        }

    auth:

        your token

  • GET USER BY EMAIL (only admin)

        GET http://localhost:4000/api/users/:email
    

    body:

        {
            "email": "[email protected]"
        }

    auth:

        your token

  • DELETE USER BY ID (only admin)

        DELETE http://localhost:4000/api/users/:id
    

    body:

        {
            "id": 3     (the id of the user we want to delete)
        }

    auth:

        your token

  • CHANGE USER ROLE BY ID (only admin)

        PUT http://localhost:4000/api/users/:id/role
    

    auth:

        your token

    body:

        {
            "id" : 1 (this is the id of the user we will update)
            "role_id": 3     (the new role_id for our user goes here)
        }
Appointments ☎️
  • CREATE APPOINTMENT

        POST http://localhost:4000/api/appointments/create
    

    body:

        {
        "appointment_date": "2024/01/01",
        "service_id": 2
        }

    auth:

        your token

  • UPDATE USER APPOINTMENT BY ID

        PUT http://localhost:4000/api/appointments/change
    

    body:

        {
        "id": 3           (the id of the appointment to update)
        "appointment_date": "2024/07/20"        (the new date)
        }

    auth:

        your token

  • GET USER APPIONTMENTS

        GET http://localhost:4000/api/appointments/scheduled
    

    auth:

        your token

  • DELETE APPOINTMENT BY ID

        DELETE http://localhost:4000/api/appointments/delete
    

    auth:

        your token

    body:

       {
        "id": 3 (of the appointment you want to delete)
       }

  • GET APPOINTMENT BY ID

        GET http://localhost:4000/api/appointments/:id
    

    auth:

        your token

    body:

        {
        "id": 3           (the id of the appointment)
        }
Services πŸͺͺ
  • GET ALL SERVICES

        GET http://localhost:4000/api/services
    

    auth:

        your token

  • CREATE SERVICE (only for admin)

        POST http://localhost:4000/api/services
    

    body:

        {
        "service_name": "name",
        "description": "what is the service about"
        }

    auth:

        your token

  • UPDATE SERVICE BY ID (only admin)

        PUT http://localhost:4000/api/services/:id
    

    body:

        {
        "id": 3 (the id of the service to be updated)
        "service_name": "new name"     (new info)
        }

    auth:

        your token

  • DELETE SERVICE BY ID (only admin)

        DELETE http://localhost:4000/api/services/:id
    

    auth:

        your token

    body:

       {
           "id" : 3
       }
Roles πŸͺͺ
  • CREATE ROLE (only admin)

    POST http://localhost:4000/api/roles/create
    

    body:

        {
        "name": "newRole"
        }

    auth:

        your token



Future functionalities


βœ… Add artists and relate them with appointments (still in progress)
⬜ Add user biometrics
⬜ Email and password validations
⬜ ...

Contribute to the project πŸ“¦

Feel free to suggest an improvment or functionality to my project.

There are two ways of doing this:

  1. Opening an issue
  2. Creating a fork of the repository
    • Creating a new branch
      $ git checkout -b feature/yourUsername -feat
      
    • Make a commit with your changes
      $ git commit -m 'feat: this X thing'
      
    • Make a push to the branch
      $ git push origin feature/yourUsername -feat
      
    • Opening a Pull Request

Web refferences πŸ“§

To achieve my project I used data from the following sites:

  • google.com
  • nobleart.com
  • ink.com
  • ...

Development πŸ“Œ

const developer = "yoanastamenova";

console.log("Developed by: " + developer);

Appreciation πŸ“

Forever gratefull to GeeksHubs Academy for the oportunety to learn and grow on my career path. ❀️

Contact πŸ“€

About

First backend API project using Node, Typescript, Express and more

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published