shopifyx-marketplace

module
v0.0.0-...-1f73362 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT

README

citadel-corp/shopifyx-marketplace

I'm Commander Shepard, and This Is My Favorite 'Marketplace Service' on the Citadel

🔍 Tested with this k6 script.

📝 Documentation - TBA.

🎵 Songs to test by - playlist.

Getting Started

These instructions will give you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on deploying the project on a live system.

Prerequisites

Requirements for the software and other tools to run and test

Note that we use AWS S3 service to upload image, setup your own S3 bucket if you want to test uploading image.

Migrate the database

After setting up your database locally, run this to migrate our database structure

$ migrate -source file://path/to/migrations -database postgres://localhost:5432/database up 2
Running the service

A step by step series of that tell you how to get a development environment running

Create file named .env and fill it with, example:

HTTP_PORT = 8001
BASE_URL = http://localhost:8000
DB_HOST = localhost
DB_PORT = 5432
DB_USERNAME = root
DB_PASSWORD = pass12345
DB_NAME = shopifyx
BCRYPT_SALT = 12
MIGRATIONS_URI = file:///path/to/migrations/shopifyx-marketplace/internal/common/db/migrations
JWT_SECRET = ${JWT_SECRET}
S3_ID = ${S3_ID}
S3_REGION = ${S3_REGION}
S3_SECRET_KEY = ${S3_SECRET_KEY}
S3_BUCKET_NAME = ${S3_BUCKET_NAME}
JWT_TTL = 7200

Run the service

go run cmd/main.go

Now you can run the service.

Endpoints

  • User
    • Register - POST /v1/user/register
    • Login - POST /v1/user/login
  • Product
    • Create - POST /v1/product
    • List - GET /v1/product
    • Update - PATCH /v1/product/{productId}
    • Get - GET /v1/product/{productId}
    • Delete - DELETE /v1/product/{productId}
    • Buy - POST /v1/product/{productId}/buy
    • Update Stock - POST /v1/product/{productId}/stock
  • Bank Account
    • Create - POST /v1/bank/account
    • List - GET /v1/bank/account
    • Update - PATCH /v1/bank/account
    • Update - PATCH /v1/bank/account/{uid}
    • Delete - DELETE /v1/bank/account/{uid}
  • Image
    • Upload - POST /v1/image

Running the tests

First, run our service.

After installing k6, clone this test script outside of this project directory, and then run:

$ k6 run script.js

To run with certain number of iterations and virtual users:

$ k6 run -i NUMBER_OF_ITERATIONS --vus NUMBER_OF_VIRTUAL_USERS script.js

Authors

The Citadel Corp team:

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • The Ramadhan ProjectSprint organizer and members

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL