Skip to content

gadielMa/stori

Repository files navigation

Stori Challenge

GoDoc

This is a project developed by Gadiel Malagrino. The system processes a file txns.csv which contain a list of debit and credit transactions on an account. The system process the file and send summary information to a user in the form of an email.

Description

No unit tests requested.

In this project I decided on a 3-layer scaffold.

The first layer cmd, contains the initial configuration of the project and a write folder where the POST, PUT, etc. are.

The GET or DELETE, etc., would be in the "read" folder. This is to separate the flows into different golang instances and help the processor.

The second layer is service, where the business logic is, there are also the interfaces to the repositories. This way we always put the interfaces on a layer before using them.

The last layer is repositories, where the uses of external services and interactions with the databases are.

I didn't need to create my own Docker images, since my Dockerfile was very simple.

Although it is bad practice, I decided to write the .env file for reference. And only by modifying the MAIL_TO will you receive the email.

I also wrote down my EMAIL_FROM PASSWORD from my old university email, in case you don't know how to get one...

The email service chosen was GMAIL, so please choose a Gmail account.

The name of the database used is "postgres" since it is a database that is already created within the postgres:latest image.

Language: go1.21.x

Chosen Architecture: Clean Architecture

Framework: go-chi

Relational Database: gorm.io/driver/postgres

ORM: gorm.io/gorm

Mail Service: go-mail

Getting started

Prerequisites

  • Git
  • Docker: You must have docker installed on your system.

Steps

$ git clone https://github.com/gadielMa/stori.git
$ cd stori
$  docker compose up

Wait a minute and...

Use a REST Client like Postman to run the following curl:

curl --location --request POST 'http://localhost:3000/stori/summary'

If you receive a code 200, you will receive an email in your MAIL_TO box.

About

Stori Challenger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published