Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#187419178 as seller should CRUD products #41

Merged
merged 1 commit into from
May 3, 2024

Conversation

niyobertin
Copy link
Collaborator

What does this PR do?

Have CRUD on products and categories endpoints

Description of Task to be completed?

Have the following end points working

Products endpoints
GET /api/v1/products
GET /api/v1/products/:id
POST /api/v1/products
PATCH /api/v1/products/:id
DELETE /api/v1/products/:id

Categories endpoints
GET /api/v1/categories
GET /api/v1/categories/:id
POST /api/v1/categories/
PATCH /api/v1/categories/:id
DELETE /api/v1/categories/:id

How should this be manually tested?

After cloning this repository,cd into it and run the following commands

  1. npm install
  2. npm run migrate
  3. npm run dev
  • using postman or other testing invironment likr thunder client, test every end point above with this header:
    _key:_Content-type value:multipart/form-data

  • To test authentication,add this to the header:Get token from user login endpoint
    _key:_Authorization value:JWT TOKEN
    NB: you must login in as a seller.

  • Using swagger documentation , open your brouser and type localhost:PORT/docs

Any background context you want to provide?
By testing above endpoint you start by creating or inserting categories before creating a products and the you create a prduct.

What are the relevant pivotal tracker stories?

#187419178

allowNull: false,
type: Sequelize.DATE,
},
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrecoverable syntax error. (91% scanned).

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('products', {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.
Missing semicolon.

/* eslint-disable @typescript-eslint/no-unused-vars */
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ':' and instead saw 'up'.
Expected '}' to match '{' from line 3 and instead saw '{'.
Missing semicolon.

allowNull: false,
type: Sequelize.DATE,
},
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrecoverable syntax error. (91% scanned).

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('products', {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.
Missing semicolon.

/* eslint-disable @typescript-eslint/no-unused-vars */
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ':' and instead saw 'up'.
Expected '}' to match '{' from line 3 and instead saw '{'.
Missing semicolon.

@niyobertin niyobertin force-pushed the 187419178-ft-products-queries-CRUD branch 3 times, most recently from e560500 to f81d230 Compare May 3, 2024 10:07
@codecov-commenter
Copy link

codecov-commenter commented May 3, 2024

Codecov Report

Attention: Patch coverage is 79.16667% with 70 lines in your changes are missing coverage. Please review.

Project coverage is 78.30%. Comparing base (aa23d2c) to head (e29cbae).

Files Patch % Lines
src/services/product.service.ts 75.64% 19 Missing ⚠️
src/services/categories.services.ts 68.96% 18 Missing ⚠️
src/controllers/productControllers.ts 74.07% 14 Missing ⚠️
src/controllers/categoriesControllers.ts 71.73% 13 Missing ⚠️
src/middlewares/sellerAuth.ts 69.23% 4 Missing ⚠️
src/utils/uploadImages.ts 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #41      +/-   ##
==========================================
+ Coverage   77.79%   78.30%   +0.51%     
==========================================
  Files          41       56      +15     
  Lines         563      899     +336     
  Branches       61      124      +63     
==========================================
+ Hits          438      704     +266     
- Misses        125      195      +70     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

-ensure that every endpoint related to products is working
-ensure that every end pint related to categories is working
-all endpoints are documented with swagger
-all endpoints are tested with test coverage of 80+

[Delives #187419178]
@niyobertin niyobertin force-pushed the 187419178-ft-products-queries-CRUD branch from f81d230 to e29cbae Compare May 3, 2024 10:13
allowNull: false,
type: Sequelize.DATE,
},
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrecoverable syntax error. (86% scanned).

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('categories', {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.
Missing semicolon.

/* eslint-disable @typescript-eslint/no-unused-vars */
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ':' and instead saw 'up'.
Expected '}' to match '{' from line 3 and instead saw '{'.
Missing semicolon.

Copy link
Collaborator

@Heisjabo Heisjabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a user with buyer role can't get all products?

Copy link
Collaborator

@yvanddniyo yvanddniyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seller can set past date on expired date field.

@Heisjabo Heisjabo self-requested a review May 3, 2024 17:14
@niyobertin niyobertin requested a review from yvanddniyo May 3, 2024 17:14
@teerenzo teerenzo merged commit 4e270ea into dev May 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants