Giter Club home page Giter Club logo

callerid's Introduction

Caller ID

This project implements a RESTful API using Node.js and PostgreSQL, providing various endpoints for user authentication, spam management, and contact search functionalities.

Table of Contents

Routes

Authentication Routes

  • POST /auth/register: Register a new user with a name, phone number, email (optional), and password.
  • POST /auth/login: Authenticate and log in a user with their phone number and password.

Spam Routes

  • GET /spam/:phone: Get all spam entries for a specific phone number.
  • POST /spam/:phone: Mark a contact as spam by phone number.
  • DELETE /spam/:phone: Remove a contact from the spam list by phone number.

Search Routes

  • GET /search/name/:query: Search for a person by name in the global database.
  • GET /search/phone/:phone: Search for a person by phone number in the global database.
  • GET /search/id-source/:id/:source: Search for a person by ID and source in the global database.

Database Schema

The project utilizes a PostgreSQL database with the following schema:

User Table

  • id: Primary key auto-incremented integer.
  • name: Name of the user.
  • phone_number: Unique phone number of the user.
  • email: Email address of the user (optional).
  • password_hash: Hashed password of the user.

Spam Table

  • id: Primary key auto-incremented integer.
  • phone_number: Phone number of the spam entry.
  • marked_by_user_id: Foreign key referencing the ID of the user who marked the spam.

Contacts Table

  • id: Primary key auto-incremented integer.
  • user_id: Foreign key referencing the ID of the user.
  • name: Name of the contact.
  • email: Email address of the contact (optional).
  • phone_number: Phone number of the contact.

Setup Instructions

To set up and run the project:

  1. Clone the repository to your local machine.
  2. Navigate to the project directory.
  3. Run docker-compose up to start the containers defined in the compose.yaml file. This will set up the Node.js server and PostgreSQL database.
  4. Run node server/scripts/migrateData.js to populate the database with sample data.
  5. Once the setup is complete, you can access the API endpoints as described above.

Next Steps

  • Deploy using K8s
  • Refine the database, and the concept of Global Users (Users + Contacts)
  • (optional) Migrate to graph-based Db.
  • Error Handlers And Decorators

callerid's People

Contributors

rttss-sahil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.