Giter Club home page Giter Club logo

c2fyymfjyw5l's Introduction

c2FyYmFjYW5l

Launch the service

Docker is required.

Create the docker images:
sh create-docker-images.sh or docker-compose build

Build and run the docker containers:
sh run.sh or docker-compose up
This command run the unit tests for each microservice and then launch it.

CSV Extractor

This microservice is an API that use :

  • Java Spring
  • Junit 5 for the tests

POST - /uploadCSV

This route allows to extract a contact list from a CSV.

Take as parameter in the 'form-data' body an item named 'file' that contains a file with the contact list :

  • A file must be selected
  • This file must be a CSV type
  • The CSV delimiters handled are ";" and ","
  • The CSV file must at least contains a valid 'email' or 'phone number'
  • Field names are not necessary

Other details :

  • If a email address is found his value is stored in 'email'
  • If a phone number is found his value is stored in 'phoneNumber'
  • If an element in email row is found but his content is not an email this data is cleared
  • If an element in 'nĀ° de mobile' row is found but his content is not an french phone number this data is cleared
  • Content that doesn't have a field name is affected to 'col{rowIndex}' field name

The extracted data will be formatted in JSON and send to the route 'POST /v1/contacts' of the Manage Contacts microservice.
If you want to get the formatted JSON in the HTTP response (no connection with 'POST /v1/contacts') you just need to add in the request header Content-Test: 'true'.

Manage Contacts

This microservice is an API that use :

  • Golang
  • Unit testing with the Golang standard library
  • MongoDB (3.4.6) for the database containing the collections Contacts and FieldNames

POST - /v1/contacts

This route allows to store the contact list in the body in the mongodb database.

JSON Body :
[
  {
    "phoneNumber"   string,
    "email"         string,
    "xFieldName"    string,
    ...
  }
  ...
]

Details :

  • Email are cleared if invalid
  • PhoneNumber must be french number to be valid else cleared
  • PhoneNumber are formatted for insertion with +33 Not inserted if :
  • Email or PhoneNumber exists already in the database
  • Email & PhoneNumber are empty (or invalid for email)
  • New contact doesn't contains an email or phoneNumber If failed to insert contacts the list of those contact is returned in the response JSON

Return HTTP Code 201 Status Created for success

Database - MongoDB

The name of the database in MongoDB is sarbacanes_contacts.

Collections

Contacts

{
  "_id"           string,
  "email"         string,
  "phoneNumber"   string,
  "createdat"     time,
  "updatedat"     time,
  "informations"  [
    {
      "fieldName_id": string,
      "value":        string
    }
    ...
  ]
}

FieldNames

{
  "_id":          string,
  "captionName":  string
}

c2fyymfjyw5l's People

Contributors

vomnes avatar

Watchers

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