Skip to content

Commit

Permalink
Add isFeatured to the prduct entity and prodyct doc (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
bertrandshema authored Jul 9, 2024
1 parent 0897559 commit 2285769
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 9 deletions.
159 changes: 156 additions & 3 deletions package-lock.json

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

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "eslint --config .eslintrc.json .",
"format": "prettier --write .",
"test": "cross-env NODE_ENV=test jest --runInBand --no-cache --detectOpenHandles",
"test:ci": "cross-env NODE_ENV=test jest --runInBand --coverage --detectOpenHandles"
"test:ci": "cross-env NODE_ENV=test jest --runInBand --coverage --detectOpenHandles",
"typeorm": "ts-node ./node_modules/typeorm/cli.js"
},
"repository": {
"type": "git",
Expand All @@ -24,6 +25,7 @@
},
"homepage": "https://github.com/atlp-rwanda/dynamites-ecomm-be#readme",
"dependencies": {
"@nestjs/typeorm": "^10.0.2",
"@types/passport-google-oauth20": "^2.0.14",
"axios": "^1.6.8",
"bcrypt": "^5.1.1",
Expand Down Expand Up @@ -52,6 +54,7 @@
"passport-facebook": "^3.0.0",
"passport-google-oauth": "^2.0.0",
"pg": "^8.11.5",
"reflect-metadata": "^0.2.2",
"stripe": "^15.8.0",
"supertest": "^7.0.0",
"swagger-jsdoc": "^6.2.8",
Expand Down Expand Up @@ -93,8 +96,8 @@
"@types/mailgun-js": "^0.22.18",
"@types/mocha": "^10.0.7",
"@types/morgan": "^1.9.9",
"@types/node": "^20.14.9",
"@types/multer": "^1.4.11",
"@types/node": "^20.14.9",
"@types/node-cron": "^3.0.11",
"@types/node-fetch": "^2.6.11",
"@types/nodemailer": "^6.4.15",
Expand Down
9 changes: 6 additions & 3 deletions src/database/models/productEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ export default class Product {

@Column({ default: true })
isAvailable: boolean;

@Column('float',{ default:0})

@Column({ default: false })
isFeatured: boolean;

@Column('float', { default: 0 })
averageRating: number;

@OneToMany(() => Review, review => review.product)
@OneToMany(() => Review, (review) => review.product)
reviews: Review[];

@ManyToOne(() => UserModel, { onDelete: 'CASCADE' })
Expand Down
5 changes: 4 additions & 1 deletion src/docs/productDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
* enum: ['Simple', 'Grouped', 'Variable']
* isAvailable:
* type: boolean
* isFeatured:
* type: boolean
* default: false
* responses:
* '201':
* description: Product successfully created
Expand Down Expand Up @@ -277,7 +280,7 @@
* type: object
* properties:
* availability:
* type: boolean
* type: boolean
* description: A boolean indicating the availability of the product
* '403':
* description: Forbidden - Product not owned by vendor
Expand Down

0 comments on commit 2285769

Please sign in to comment.