0.1.9 • Published 1 year ago

@itleadopencommerce/api-plugin-navigation v0.1.9

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
1 year ago

api-plugin-navigation

Summary

The plugin provide logic to manage navigation tree of the marketplce and shops.

We have 2 main entity:

  • NavigationTree, that holds all tree (shops and the marketplace and history of the marketplace trees)
  • NavigationItem, it represents categories data

Any NavigationTree - is a graph. There are NavigationItem id, children in field items and another extra info at verticies. Shop navigation tree don`t have drafts. It builded automaticly on its products

Methods

Query

addNavigationChanges()

This method incluses permission validations. Check policies.json

The method manages changes for the navigation tree. and supports 2 main methods

  • create new changes
  • deleting existing changes

There are 3 types of new changes: "create", "update", "delete".

There are data validators for the all types of changes. After data validation method starts to build draft tree to check can it apply the new change.

If yes -> update draft fields in the main tree If no -> return ReactionError