Giter Club home page Giter Club logo

test's Introduction

Guide

The project is divided into 2 parts, one is the top level APIs and the other is services.

Each service is created according to DDD rules and is independent of each other. Each of the services represents a bounded context, where everything is contained inside and only referencial information is shared.

There are 3 services in this project,

  • Sales
  • Inventory
  • Catalog

Sales

Contains information about the sales and how much the time was sold for, since this part of the context according to the problem description, does not deals with the SKUs and etc. only just pricing information and a referencial tag to the inventory log so there is only one model in this service. i.e. Sale

Inventory

Contains information about the inventory in the form of logs, I am using logs because I don't want to manage a state or sort of an integer where I am keeping track of the inventory, instead I am keeping each record of what happened to the inventory.

Later we can use that information to compute the total inventory that we have right now.

Catalog

This is a very simple service, it just contains information about the SKUs. this is a description of what we SELL

Communication between the services

The communication between the services is done using the an anti corruption layer, which is a design pattern that uses interfaces to abstract information source for a external bounded context. This is basically DIP principle that helps in testing the code, without using any code from the external context

APIs

Since the time was short for me to complete this, and this was communicated by the email I sent early given no response, I had to submit and incomplete project.

Installation

create a virtual environment using the following command

    python -m venv venv

install the dependancies using the following command

    pip install -r requirements.txt

Database

You also need a postgres database to run this project. That has not been dockerized yet. So you will need something like Postgres.app or Postgres installed on your machine.

After that run the tests

Questions

If there are libraries essential for the project configuration, list them and explain the reason.

Right now there is only one which is pg-migrator, which is a nodejs module that helps in running migrations on the database

If there are libraries that you think might be necessary for project configuration, list them and explain the reason.

I can't think of anything

The timezone of the data and the user's timezone may be different from your located timezone. What should be considered when handling Datetime using Python and Database? (Explanation or code example)

Everything should be stored in datetime/Timestamp with time zone format, thus we are storing the timezone along with the timestamp and thus remove and ambiguity for errors

I have made a utility function that I am making use of in the code, which is giving my the now() time in UTC timezone, which is the standard for all the timezones. now() is the most used function in the datetime library and it is best to make a wrapper function that ensures timezone will always be utc

def now_in_utc() -> datetime:
    """Current time in UTC time zone"""

    return datetime.now(timezone.utc)

test's People

Watchers

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