Skip to content

Commit

Permalink
The Seller and User - list products (#58)
Browse files Browse the repository at this point in the history
* Ft login v google 187584916 (#47)

* login via google

* Ft-login via google

* login via google

* ft login via google

* ft  login with  google

* Logout feature (#26) (#46)

* Logout feature (#26)

* [#187584914]added logout feature

* [starts #187584914] added logout feature

* [finishes#187584914] logout feature

* [delivers##187584914] updated readme & swagger.json

* [delivers##187584914] updated readme & swagger.json

* [deliveres #187584914] logout features completed

* [deliveres #187584914] logout features completed

* [delivers #187584914] finished logout feature

* fixing bugs

* rebased

---------

Co-authored-by: Solange Duhimbaze Ihirwe <[email protected]>

* [Finishes #187584924] Seller Create/Add a product (#48)

* [Delivers #187584924] Seller Create/Add a product

* updated ReaderMe file

* Rebased on develop

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Fixed login fetaure (#59)

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* Solve eerrors

* Ft delete items seller #187584926 (#52)

* rebase

* rebase

* [delivers #187584926] seller delete item

* [Delivers #187584924] Seller Create/Add a product

* [start #187584926] seller delete item

---------

Co-authored-by: Solangeihirwe <[email protected]>
Co-authored-by: AimePazzo <[email protected]>

* [Delivers #187584928] Delivers test 92.53%

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* Solve eerrors

* [Delivers #187584928] Delivers test 92.53%

* [Delivers #187584928] Delivers test 92.53%

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Add .gitguardian file

* [Delivers #187584928] Add .gitguardian file

* [starts #187584911] Seller statistics per timeframe (#54)

* [starts #187584911] Seller statistics per timeframe

* [finishes #187584911] Seller statistics per timeframe

* Seller-statistics updated

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* Solve eerrors

* [Delivers #187584928] Delivers test 92.53%

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [Delivers #187584928] Delivers test 92.53%

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Add .gitguardian file

* [Delivers #187584928] Add .gitguardian file

* AA

* pre commit tests

* Initial

* [Delivers #187584928] Version 1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* Solve eerrors

* [Delivers #187584928] Delivers test 92.53%

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [Delivers #187584928] Delivers test 92.53%

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Add .gitguardian file

* [Delivers #187584928] Add .gitguardian file

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* Solve eerrors

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [delivers #187584928] Delivers the Seller and User list products

* [delivers #187584928] Delivers the Seller and User list products

* [Delivers #ft-seller-and-buyer-list-items-187584928] Tests version 1

* Deliver testing v1

* [Delivers #187584928] Delivers test 92.53%

* [Delivers #187584928] Handle gitguardian issues.

* [Delivers #187584928] Handle gitguardian issues.

* AA

* pre commit tests

* Initial

* [Delivers #187584928] Version 1

* Swagger

* Rebase

* Reviews

* M

* end

* end

* end

* end

---------

Co-authored-by: AimePazzo <[email protected]>
Co-authored-by: Niyonshuti Jean De Dieu <[email protected]>
Co-authored-by: MANISHIMWESalton <[email protected]>
Co-authored-by: Solange Duhimbaze Ihirwe <[email protected]>
Co-authored-by: Mr. David <[email protected]>
Co-authored-by: Solangeihirwe <[email protected]>
Co-authored-by: SaddockAime <[email protected]>
  • Loading branch information
8 people committed Jul 11, 2024
1 parent ba7ca99 commit 232dd80
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions src/databases/migrations/20240612090847-product-review.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { QueryInterface, DataTypes } from "sequelize"

export = {
up: async (queryInterface: QueryInterface) => {
await queryInterface.createTable("productReviews", {
id: {
type: DataTypes.UUID,
allowNull: false,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
productId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: "products",
key: "id"
},
onUpdate: "CASCADE",
onDelete: "CASCADE"
},
userId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: "users",
key: "id"
},
onUpdate: "CASCADE",
onDelete: "CASCADE"
},
feedback: {
type: DataTypes.STRING,
allowNull: true
},
rating: {
type: DataTypes.INTEGER,
allowNull: true
},
status: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue : true
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
}
});
},

down: async (queryInterface: QueryInterface) => {
await queryInterface.dropTable("productReviews");
}
};
33 changes: 33 additions & 0 deletions src/databases/seeders/20240612101850-product-reviews.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { QueryInterface } from "sequelize";
import { productOneId, productTwoId, userTwoId, userOneId, productReviewOneId, productReviewTwoId } from "../../types/uuid";

module.exports = {
async up(queryInterface: QueryInterface) {
await queryInterface.bulkInsert("productReviews", [
{
id: productReviewOneId,
productId: productOneId,
userId: userOneId,
feedback: "Excellent Product and Service!",
rating: 4,
status: true,
createdAt: new Date(),
updatedAt: new Date()
},
{
id: productReviewTwoId,
productId: productTwoId,
userId: userTwoId,
feedback: "very well",
rating: 3,
status: true,
createdAt: new Date(),
updatedAt: new Date()
}
], {});
},

async down(queryInterface: QueryInterface) {
await queryInterface.bulkDelete("productReviews", null, {});
}
};
13 changes: 13 additions & 0 deletions src/modules/product/validation/productValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ const statusSchema = Joi.object({
"any.only": "status must be either 'available' or 'unavailable'",
}),
});
// const ratingSchema = Joi.object({
// rating: Joi.number().when('status', {
// is: 'available',
// then: Joi.min(1).max(5).required().messages({
// "number.base": "rating must be a number",
// "number.integer": "rating must be an integer",
// "number.min": "rating must be between 1 and 5",
// "number.max": "rating must be between 1 and 5",
// "any.required": "rating is required",
// }),
// otherwise: Joi.optional().allow(null),
// }),
// })

const productReviewSchema = Joi.object({
rating: Joi.number().min(1).max(5).required(),
Expand Down
2 changes: 1 addition & 1 deletion src/types/uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ export const productReviewTwoId = uuidv4();

export const notificationThreeId = uuidv4();
export const wishListProductsOneId = uuidv4();
export const wishListProductsTwoId = uuidv4();
export const wishListProductsTwoId = uuidv4();

0 comments on commit 232dd80

Please sign in to comment.