Skip to content

Commit

Permalink
Updating postProduct and createProduct to include product url
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjung1998 committed Jan 28, 2024
1 parent 6b20337 commit 0828b27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion backend/src/abstracts/product.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ abstract class ProductProvider {
gender: string,
category: string,
price: number,
imageUrl: string
imageUrl: string,
url: string
): Promise<PrismaProduct | Error>;

abstract deleteProduct(id: string): Promise<PrismaProduct | Error>;
Expand Down
3 changes: 2 additions & 1 deletion backend/src/controllers/product.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class ProductController {
req.body.gender,
req.body.category,
req.body.price,
req.body.imageUrl
req.body.imageUrl,
req.body.url
);
return res.status(201).json(newProduct);
} catch (e) {
Expand Down
9 changes: 6 additions & 3 deletions backend/src/services/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class ProductService implements ProductProvider {
gender: string,
category: string,
price: number,
imageUrl: string
imageUrl: string,
url: string
): Promise<PrismaProduct | Error> => {
if (
!title ||
Expand All @@ -31,7 +32,8 @@ class ProductService implements ProductProvider {
!gender ||
!category ||
!price ||
!imageUrl
!imageUrl ||
!url
) {
throw new HttpBadRequestError();
}
Expand All @@ -43,7 +45,8 @@ class ProductService implements ProductProvider {
gender,
category,
price,
imageUrl
imageUrl,
url
);
};

Expand Down

0 comments on commit 0828b27

Please sign in to comment.