Giter Club home page Giter Club logo

category-app's Introduction

Category Management App

This is a simple node.js Category Management App, you can

  • add category
  • delete category
  • rename category
  • reorder category at its level

How to run

  1. Make sure you have nodejs installed.
  2. Prepare a command file, see example.txt for example
  3. Run node index.js to start program

Commands explain

ADD command

You can add a Child Category by using

ADD '{Parent Category}' '{Child Category}'

Please make sure the Parent Category must exist; and the category name needs to be less than 63 unicode characters, cannot start with a number, must start with a capital and cannot end with a non-alphanumeric character.

DELETE command

You can delete a Child Category by using

DELETE '{Parent Category}' '{Child Category}'

Please make sure the Parent Category and Child Category must exist; and the Child Category needs to have no child category

RENAME command

You can rename a Child Category by using

RENAME '{Parent Category}' '{Child Category}' AS '{NewName Child Category}'

Please make sure the Parent Category and Child Category must exist; and the new category name also need to follow the same naming standard as ADD command; and AS command must present in front of the new category name

MOVE command

You can reorder a Child Category by using

MOVE '{Parent Category}' '{Child Category}' UP '{count}'
MOVE '{Parent Category}' '{Child Category}' DOWN '{count}'

it will update the order of Child Category at its level Please make sure the Parent Category and Child Category must exist; and UP or DOWN command must present in front of count

Further work needs to be done

Due to time reason, there're several optimizations could not be made at the current version, the code could be improved by doing:

  • Extract common (validation) logic in processing arguments
  • Extract common logic in category service
  • category.view needs to be refactored to enable accepting the max depth of categories for formatting the data

category-app's People

Contributors

chris-wang 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.