Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/UitsHabib/shop-on
Browse files Browse the repository at this point in the history
  • Loading branch information
kawsar-95 committed Feb 26, 2022
2 parents d544ba8 + 2047d6a commit dc37275
Show file tree
Hide file tree
Showing 222 changed files with 320 additions and 3,885 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/depd-npm-1.1.2-b0c8414da7-6b406620d2.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/etag-npm-1.8.1-54a3b989d9-571aeb3dbe.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ip-npm-1.1.5-af36318aa6-30133981f0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/jwa-npm-1.4.1-4f19d6572c-ff30ea7c2d.zip
Binary file not shown.
Binary file removed .yarn/cache/jws-npm-3.2.2-c1ae59c7af-f0213fe5b7.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/long-npm-4.0.0-ecd96a31ed-16afbe8f74.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/mime-npm-1.6.0-60ae95038a-fef25e3926.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ms-npm-2.0.0-9e1101a471-0e6a22b8b7.zip
Binary file not shown.
Binary file removed .yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip
Binary file not shown.
Binary file removed .yarn/cache/ms-npm-2.1.3-81ff3cfac1-aa92de6080.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/nopt-npm-5.0.0-304b40fbfe-d35fdec187.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/once-npm-1.4.0-ccf03ef07a-cd0a885013.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/tr46-npm-0.0.3-de53018915-726321c5ea.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/uuid-npm-8.3.2-eca0baba53-5575a8a75c.zip
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/vary-npm-1.1.2-b49f70ae63-ae0123222c.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/wkx-npm-0.5.0-fca5152cd8-47b27387de.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/install-state.gz
Binary file not shown.
1,936 changes: 0 additions & 1,936 deletions package-lock.json

This file was deleted.

3 changes: 2 additions & 1 deletion seeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ async function init() {
require(path.join(process.cwd(), 'src/modules/order/order-product.model'));
require(path.join(process.cwd(), 'src/modules/order/order.model'));
require(path.join(process.cwd(), 'src/modules/cart/cart.model'));
require(path.join(process.cwd(), 'src/modules/review/review.model'));
require(path.join(process.cwd(), 'src/modules/review/product-review.model'));
require(path.join(process.cwd(), 'src/modules/review/shop-review.model'));

await sequelize.sync();

Expand Down
3 changes: 3 additions & 0 deletions src/modules/category/category.model.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require("path");
const sequelize = require(path.join(process.cwd(), 'src/config/lib/sequelize'));
const Product = require(path.join(process.cwd(), 'src/modules/product/product.model'));
const { DataTypes } = require('sequelize');
const SubCategory = require('./sub-category.model');

Expand All @@ -24,4 +25,6 @@ const Category = sequelize.define('categories', {
Category.hasMany(SubCategory, { as: 'subCategories', foreignKey: 'category_id' });
SubCategory.belongsTo(Category, { as: 'category', foreignKey: 'category_id' });

Product.belongsTo(Category, { as: 'category', foreignKey: 'category_id' });

module.exports = Category;
1 change: 1 addition & 0 deletions src/modules/core/authorization/authorization.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Services = {
MANAGE_ROLE: "manage-roles",
MANAGE_SHOP: "manage-shop",
MANAGE_CLIENT: "manage-client",
MANAGE_REVIEW: "manage-review"
};

module.exports = { Services };
8 changes: 4 additions & 4 deletions src/modules/platform/user/user.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ User.prototype.validPassword = function (password) {
User.belongsTo(User, { as: 'createdByUser', foreignKey: 'created_by' });
User.belongsTo(User, { as: 'updatedByUser', foreignKey: 'created_by' });

Profile.hasMany(User, { as: 'users', foreignKey: 'profile_id' });
User.belongsTo(Profile, { as: 'profile', foreignKey: 'profile_id' });
Profile.hasMany(User, { as: 'users', foreignKey: 'profile_id', constraints: false });
User.belongsTo(Profile, { as: 'profile', foreignKey: 'profile_id', constraints: false });

Profile.belongsTo(User, { as: "createdByUser", foreignKey: "created_by" });
Profile.belongsTo(User, { as: "updatedByUser", foreignKey: "updated_by" });

Role.hasMany(User, { as: 'users', foreignKey: 'role_id' });
User.belongsTo(Role, { as: 'role', foreignKey: 'role_id' });
Role.hasMany(User, { as: 'users', foreignKey: 'role_id', constraints: false });
User.belongsTo(Role, { as: 'role', foreignKey: 'role_id', constraints: false });

Role.belongsTo(User, { as: "createdByUser", foreignKey: "created_by" });
Role.belongsTo(User, { as: "updatedByUser", foreignKey: "updated_by" });
Expand Down
28 changes: 0 additions & 28 deletions src/modules/product/category.model.js

This file was deleted.

8 changes: 2 additions & 6 deletions src/modules/product/product.controller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
const path = require("path");
const Shop = require("../shop/shop.model");
const Product = require("./product.model");
const Category = require("./category.model");

const { getPagination, getPagingData } = require("./services/product.service");

const Product = require(path.join(process.cwd(), "src/modules/product/product.model"));
const Shop = require(path.join(process.cwd(), "src/modules/shop/shop.model"));

async function getProducts(req, res) {
try {
Expand Down
31 changes: 0 additions & 31 deletions src/modules/product/services/product.service.js

This file was deleted.

39 changes: 39 additions & 0 deletions src/modules/review/product-review.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const path = require("path");
const sequelize = require(path.join(process.cwd(), "src/config/lib/sequelize"));
const Product = require(path.join(process.cwd(), "src/modules/product/product.model"));
const { DataTypes } = require("sequelize");

const ProductReview = sequelize.define("product_reviews", {
id: {
allowNull: false,
primaryKey: true,
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4
},
customer_id: {
allowNull: false,
type: DataTypes.UUID
},
product_id: {
allowNull: false,
type: DataTypes.UUID
},
rating: {
allowNull: false,
type: DataTypes.INTEGER
},
comment: {
allowNull: false,
type: DataTypes.STRING(500)
}
},
{
tableName: 'product_reviews',
timestamps: true,
createdAt: 'created_at',
updatedAt: 'updated_at'
});

ProductReview.belongsTo(Product, { as: 'product', foreignKey: 'product_id' });

module.exports = ProductReview;
Loading

0 comments on commit dc37275

Please sign in to comment.