Skip to content

Commit

Permalink
Merge branch 'dev' into ci/linting-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Axeloooo committed Feb 4, 2024
2 parents 8d4cd53 + 84cfb75 commit bf26383
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
# Keep environment variables out of version control
.env
dist
20 changes: 10 additions & 10 deletions backend/src/repositories/product.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ProductRepository implements ProductProvider {
): Promise<PrismaProduct> => {
try {
const product: PrismaProduct | null = await prisma.product.findUnique({
where: { id: getProduct.params.id },
where: { id: getProduct.id },
});
if (product === null) {
throw new ProductNotFoundError();
Expand Down Expand Up @@ -74,14 +74,14 @@ class ProductRepository implements ProductProvider {
try {
const newProduct: PrismaProduct = await prisma.product.create({
data: {
title: createProduct.body.title,
size: createProduct.body.size,
color: createProduct.body.color,
description: createProduct.body.description,
gender: createProduct.body.gender,
category: createProduct.body.category,
price: createProduct.body.price,
imageUrl: createProduct.body.imageUrl,
title: createProduct.title,
size: createProduct.size,
color: createProduct.color,
description: createProduct.description,
gender: createProduct.gender,
category: createProduct.category,
price: createProduct.price,
imageUrl: createProduct.imageUrl,
},
});
return newProduct;
Expand All @@ -107,7 +107,7 @@ class ProductRepository implements ProductProvider {
): Promise<PrismaProduct> => {
try {
const product: PrismaProduct | null = await prisma.product.delete({
where: { id: getProduct.params.id },
where: { id: getProduct.id },
});
if (product === null) {
throw new ProductNotFoundError();
Expand Down
2 changes: 1 addition & 1 deletion backend/src/repositories/scanner.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ScannerRepository implements ScannerProvider {
try {
const worker: Tesseract.Worker = await createWorker("eng");
const ret: Tesseract.RecognizeResult = await worker.recognize(
scannerRequest.body.imageUrl
scannerRequest.imageUrl
);
await worker.terminate();
return ret.data.text;
Expand Down
4 changes: 2 additions & 2 deletions backend/src/routes/scanner.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ScannerService from "../services/scanner.service.js";
import ScannerRepository from "../repositories/scanner.repository.js";
import schemaValidation from "../middlewares/schemaValidation.middleware.js";
import { Router } from "express";
import { scannerSchema } from "../schemas/scanner.schema.js";
import { ScannerSchema } from "../schemas/scanner.schema.js";

const scannerRouter = Router();
const scannerController = new ScannerController(
Expand All @@ -12,7 +12,7 @@ const scannerController = new ScannerController(

scannerRouter.post(
"/",
schemaValidation(scannerSchema),
schemaValidation(ScannerSchema),
scannerController.postMaterials
);

Expand Down
6 changes: 3 additions & 3 deletions backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export type Tag = {
percentage: string;
};

export type CreateProduct = z.infer<typeof CreateProductSchema>;
export type CreateProduct = z.infer<typeof CreateProductSchema>["body"];

export type GetProduct = z.infer<typeof GetProductSchema>;
export type GetProduct = z.infer<typeof GetProductSchema>["params"];

export type ScannerRequest = z.infer<typeof ScannerSchema>;
export type ScannerRequest = z.infer<typeof ScannerSchema>["body"];

0 comments on commit bf26383

Please sign in to comment.