Coder Social home page Coder Social logo

techtest's Introduction

API Routes

The web and api routes of this code are both powered by the same code. They are implemented with action classes and can be found in app/Actions. I extended the model given to use a separate product category table because it's the better design and I like to be able to update such things. All api routes are the same as the web routes, but prefixed with api

This documentation assumes the reader is familiar with Laravel 8.

The following routes are available.

products

Method Route Name Action
GET /product product.index list all products
GET /product/create product.create Provide all options needed to create a product (the product category list)
POST /product product.store Create a new product
GET /product/{product}/edit product.edit Shows same as product.create + the product you want to edit
PUT /product/{product} product.update Update Product
DELETE /product/{product} product.destroy Soft Delete the product
GET /product/{product}/restore product.restore Restore the product from soft delete
GET /product/{product}/delete product.delete-permanently Delete the product from the database
POST /product/empty-category product.bulk-delete Soft delete all products in a category
POST /product/update-category product.bulk-update Bulk update all product in a category

Product Category

Method Route Name Action
GET /product-category productCategory.index list all categories
GET /product-category/create productCategory.create Empty for json, but would be used as above to deliver dependencies
POST /product-category productCategory.store Create a new category
GET /product-category/{productCategory}/edit productCategory.edit Shows same as productCategory.create + the category you want to edit
PUT /product-category/{productCategory} productCategory.update Update category
DELETE /product-category/{productCategory} productCategory.destroy Soft Delete the category
GET /product-category/{productCategory}/restore productCategory.restore Restore the category from soft delete
GET /product-category/{productCategory}/delete productCategory.delete-permanently Delete the category from the database

Notes

Both Index routes accept additional query parameters:

  • archived : When this is given the value 1, then the index will be of all soft deleted results.
  • product_category : This will filter the results based on the product category slug.
  • These can be combined

The translation is defaulted to English, to get a alternative translate the parameter locale should be set either as a query parameter, or a post value. This will be detected by a Middleware and used to set the working language. To add a language to a product, you would use the update route and include the locale to indicate which you want to set.

There is seeders included to create test data, and some basic tests implemented.

There default account is [email protected]/password

techtest's People

Contributors

jedjones-uk 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.