Coder Social home page Coder Social logo

card_tracker's Introduction

Card Status Fetch App using Gin (Golang Framework and MongoDB (Atlas))

  • This small project is developed using Gin (Golang Framework) and MongoDB Atlas as NoSQL database.

Some advantages of using Golang framework.

  • The primary reason is I am working in node.js and Golang for a while , and I have experience of migrating spring boot , node.js backend project to Golang framework and acheive better experience in terms of speed , build size and build process.

  • Golang is compiled into machine code, which means that it runs much faster than interpreted languages like Node.js

Approach :

  • The Goal of the project is to provide status of the card based on the combined data present in the CSV file.

  • The connection is established with MongoDB atlas database.

  • Application will start with loading all the data from csv into the database (MongoDB atlas).

  • It will parse the csv files and creating the collection of card in the mongoDB.

  • Then endpoint exposed to query the status of the card based on user_id or card_id.

  • One additional thing could be done is to schedule the Cron Job to get the data from the data folder and load into database so that it will fetch the latest status of the card.

  • The End point get_card_status will fetch following four types of status with timestamps

    • DELIVERED : card delivered with timestamp
    • PICKED_UP : card picked up with timestamp
    • EXCEPTION : card exception with timestamp and comment
    • RETURNED : card returned due to exception
  • Following the sample response of the endpoint hit with card_id = "ZYW8890"

{
    "card status": [
        {
            "card_id": "ZYW8890",
            "user_id": "0534534534",
            "status": "EXCEPTION",
            "comment": "User not available",
            "timestamp": "2023-12-22T04:18:41.492Z"
        },
        {
            "card_id": "ZYW8890",
            "user_id": "534534534",
            "status": "PICKED_UP",
            "comment": "",
            "timestamp": "2023-12-22T04:18:42.412Z"
        },
        {
            "card_id": "ZYW8890",
            "user_id": "971534534534",
            "status": "RETURNED",
            "comment": "",
            "timestamp": "2023-12-22T04:18:43.346Z"
        }
    ]
}

🧿 Project Goal

⚒ Problem Statement

Create an internal API that would return the status of a user’s card. We need a service that would combine the data from our partner companies and return the current status of a card when queried for by a team mate.

Click to expand

✓ Details:

Internally, let’s say we identify a user with their phone number, and for this particular task, let us ignore the country code, and set it to be a 9 digit number. A user’s card has a unique identifier as well, and for this task, we can assume that all entities involved uses the same ID to refer to the card.

Here’s a top level flow of what happens to a card

  • Card is generated by us
  • Card is picked up by courier partner
  • Card is delivered
  • If the Card could not be delivered, re-delivery is attempted maximum of two times
  • If all attempts of delivery fail, it is returned to us

💡 Local Setup Guide

  1. Clone the project

git clone https://github.com/gauravshinde1816/card_tracker.git

  1. Start backend

    • cd card_tracker/
    • Install Dependancies
    • go mod tidy
    • Start server
    • go run main.go
  2. Use to http://localhost:8080/get_card_status to get the status of card using user_id and card_id.

💡 Docker Setup Guide

  1. Run docker-compose up -d
  2. Use to http://localhost:8080/get_card_status to get the status of card using user_id and card_id.

card_tracker's People

Contributors

gauravshinde1816 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.