Coder Social home page Coder Social logo

swiftcommerce / productmanager Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 2.0 675 KB

A micro-service that manages products, categories and attributes. Servers as a backend for classical store frontends.

Home Page: https://www.skelpo.com

License: MIT License

Swift 99.18% Dockerfile 0.82%
swift serverside-swift vapor vapor-swift product-management products product microservice

productmanager's People

Contributors

calebkleveter avatar proggeramlug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

productmanager's Issues

Add Revert Command to Service

Add RevertCommand to CommandConfig and register it to the application's services. This allows you to run vapor run revert to revert the database.

Offsets

This is neither urgent nor needed right now but it will be needed soon:

Every list return (categories + products) needs to be returned in a format that we can put it on different pages. Say we have 1000 categories and 1000 products:

  1. We need a return with a max number of results ("per page") Like "25 per page". So every call should return max 25 results.
  2. We need a number of results in total (1000 products)
  3. We need an offset that we can set so that we get for example products 100-125.

Ideally this will look like:
products?max=25&offset=100
categories?max=25&offset=100

Should not be very hard to implement. It really just comes down to the sql function "LIMIT x, y".
Important though: The total number of results needs to be returned as well.

Attributes need to be translatable

This is neither urgent nor needed right now, but attributes should be translatable.

Use case is that an attribute may be a description that needs to be available in multiple languages.

Categories are not always main categories

We need to have a flag that indicates whether a category is a main category or not. Some categories will only be sub categories and never main.

I suggest a flag called "mainCateegory" that is either true or false.

The tree should start with the main categories.

Products need prices

Prices need to be assignable to products. Note: Multiple prices need to be assignable to the same product.

For example:

  • Piano = 50 USD, 45 EUR, 40 GBR (so 3 prices for the same product)

Order in category tree

Categories need to have a "sort" flag (integer) that will dictate the order in which they are showing. lowest = top, highest = bottom.

Attribute structure needs to change

The way it should work is:

Attribute-Table contains all attributes that are available at all. Pretty much just the same.

Attribute-Product-Tabe contains the associations between the attribute and the product. So it would be:

  1. Attribute id
  2. product id
  3. value

CORS Headers

We need to add CORS headers so that web browser clients can load content.
"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://product-manager-development.vapor.cloud/categories. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).".

In Vapor 2 there was a middleware module that did the trick, do we have that in vapor 3 as well?

CategoryTree: Prohibit endless recursion

When two entries are invested (left = right & right = left) it can lead to endless recursion.

To prevent this we should:

  • Prevent the user from entering such a condition in the first place
  • More importantly though: Have the category-tree parser detect this and stop by itself

Filter

We need to implement a few filters for products:

  • By category (we have that already but we may want to change the URL structure for it)
  • By price (min & max price)
  • By attribute
  • By status

Ideally I would like to have a call like:

/products?minPrice=10&maxPrice=50&attribute[name]=Test+Product&status=1

or something like that

Add CreatedAt, UpdatedAt & DeletedAt

Not urgent!

We need to add UpdatedAt and DeletedAt as all as CreatedAt for:

  • Products
  • Categories
  • Attributes
  • ProductAttributes
  • ProductCategories

Sortable

This is neither urgent nor needed right now but will be relevant soon:

Every attribute and field of a product or category needs to be sortable. So for example:

  • Sort products by lowest price
  • sort products by name ascending
  • sort products by category name

ElasticSearch

This one is not needed for quite a while but I don't want to loose sight of it:

We should use ElasticSearch as a Cache as well as a search engine for products. So every product would be put into elastic search as an exported json-string.

Through elastic search we can run effective searches and also cache outputs.

Creating attributes should be decoupled from products

The attribute controller/routes should have their own identity.

So we should have routes like
attributes/create
attributes/update
attributes (list)

etc. that deal with the attributes independently of products

likewise when creating an attribute for a product it should link to the ID of attribute.
so
POST products/1/attributes should take arguments such as (attributeId,language, value)

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.