Giter Site home page Giter Site logo

wb-l0's Introduction

Order Service

scheme

Order Service is a backend service for managing orders, utilizing PostgreSQL for database storage, in-memory caching, and NATS Streaming for message processing.

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/F-1X/WB-L0.git
    cd WB-L0
  2. Install dependencies:

    go mod tidy

    also you need installed migate tool

Running the Application

  1. Set up PostgreSQL and NATS Streaming:

    With docker-compose starts PostgreSQL and NATS Streaming. And after migrate schema

    make docker-up
    make mig-up
  2. Run an application:

    make run-server

Running Tests

  1. All tests
go-test
  1. integrations
make test.integration  
make run-test  
  1. "load test"
make run-test-load  

Configuration

Set the following environment variables in a .env file or export them directly in your terminal:

DB_USER=user
DB_HOST=localhost
DB_PORT=5432
DB_PASSWORD=example
DB_NAME=orderdb
MIGRATIONS_PATH=backend/internal/database/migrate/migrations
DATABASE_URL=postgres://user:example@localhost:5432/orderdb
NATS_URL=nats://nats:4222
CONFIG_PATH=./backend/internal/config/config.yml
FRONTEND_PATH=./frontend/static
TEST_DB_URI=postgres://test:test@localhost:5432/orderdb

Databse structure of tables

orders

Column Type Constraints
order_uid VARCHAR(50) PRIMARY KEY, UNIQUE
track_number VARCHAR(50) UNIQUE
entry VARCHAR(50)
locale VARCHAR(10)
internal_signature VARCHAR(50)
customer_id VARCHAR(50)
delivery_service VARCHAR(50)
shardkey VARCHAR(10)
sm_id BIGINT
date_created TIMESTAMP
oof_shard VARCHAR(10)

delivery

Column Type Constraints
id SERIAL PRIMARY KEY
order_uid VARCHAR(50) FOREIGN KEY REFERENCES orders(order_uid)
name VARCHAR(100)
phone VARCHAR(20)
zip VARCHAR(20)
city VARCHAR(100)
address VARCHAR(200)
region VARCHAR(100)
email VARCHAR(100)

payment

Column Type Constraints
id SERIAL PRIMARY KEY
transaction VARCHAR(50) FOREIGN KEY REFERENCES orders(order_uid)
request_id VARCHAR(100)
currency VARCHAR(10)
provider VARCHAR(100)
amount INT
payment_dt INT
bank VARCHAR(100)
delivery_cost INT
goods_total INT
custom_fee INT

items

Column Type Constraints
id SERIAL PRIMARY KEY
chrt_id INT
track_number VARCHAR(50) FOREIGN KEY REFERENCES orders(track_number)
price INT
rid VARCHAR(100)
name VARCHAR(200)
sale INT
size VARCHAR(20)
total_price INT
nm_id INT
brand VARCHAR(100)
status INT

wb-l0's People

Contributors

f-1x 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.