generated from purwadhikafullstack/finpro-nextjs-express-prisma
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from purwadhikafullstack/develop
Merge develop to main
- Loading branch information
Showing
204 changed files
with
12,923 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { getDeliveryUserService } from "@/services/delivery/get-deliver-user.service"; | ||
import { getDeliveryAdminsService } from "@/services/delivery/get-delivery-admins.service"; | ||
import { getDeliveryDriverService } from "@/services/delivery/get-delivery-driver.service"; | ||
import { updateDeliveryOrderDriverService } from "@/services/delivery/update-deliver.service"; | ||
import { NextFunction, Request, Response } from 'express'; | ||
|
||
|
||
export class DeliveryController { | ||
|
||
async getDeliveryOrdersDrivers(req: Request, res: Response, next: NextFunction) { | ||
try { | ||
const query = { | ||
page: parseInt(req.query.page as string) || 1, | ||
take: parseInt(req.query.take as string) || 3, | ||
sortOrder: (req.query.sortOrder as string) || 'asc', | ||
sortBy: (req.query.sortBy as string) || 'createdAt', | ||
search: (req.query.search as string) || '', | ||
status: (req.query.status as 'ONGOING' | 'REQUEST' | 'HISTORY'), | ||
}; | ||
|
||
const result = await getDeliveryDriverService(query, res.locals.user.id); | ||
return res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
async getDeliveryOrdersAdmins(req: Request, res: Response, next: NextFunction) { | ||
try { | ||
const query = { | ||
page: parseInt(req.query.page as string) || 1, | ||
take: parseInt(req.query.take as string) || 5, | ||
sortOrder: (req.query.sortOrder as string) || 'asc', | ||
sortBy: (req.query.sortBy as string) || 'createdAt', | ||
search: (req.query.search as string) || '', | ||
status: (req.query.status as 'ONGOING' | 'REQUEST' | 'HISTORY' | 'ALL') || 'ALL', | ||
outletId: (req.query.outletId as string) || '', | ||
}; | ||
|
||
const result = await getDeliveryAdminsService(query, res.locals.user.id); | ||
return res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
async getDeliveryOrdersUser(req: Request, res: Response, next: NextFunction) { | ||
try { | ||
const query = { | ||
page: parseInt(req.query.page as string) || 1, | ||
take: parseInt(req.query.take as string) || 3, | ||
sortOrder: (req.query.sortOrder as string) || 'asc', | ||
sortBy: (req.query.sortBy as string) || 'createdAt', | ||
search: (req.query.search as string) || '', | ||
status: (req.query.status as 'ONGOING' | 'HISTORY' | 'ALL'), | ||
}; | ||
|
||
const result = await getDeliveryUserService(query, res.locals.user.id); | ||
return res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
async updateDeliveryDriver( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
try { | ||
const result = await updateDeliveryOrderDriverService(req.body, res.locals.user.id); | ||
return res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getOrderItemsWorkOrderService } from '@/services/order-item/get-order-items.service'; | ||
import { NextFunction, Request, Response } from 'express'; | ||
|
||
export class OrderItemController { | ||
async getOrderItemsWorkOrder(req: Request, res: Response, next: NextFunction) { | ||
try { | ||
const query = { | ||
page: parseInt(req.query.page as string) || 1, | ||
take: parseInt(req.query.take as string) || 3, | ||
sortOrder: (req.query.sortOrder as string) || 'desc', | ||
sortBy: (req.query.sortBy as string) || 'createdAt', | ||
workOrderId: parseInt(req.query.workOrderId as string) || 0, | ||
}; | ||
const result = await getOrderItemsWorkOrderService(query); | ||
res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { processPaymentService } from '@/services/payment/process-payment.service'; | ||
import { updatePaymentSuccessService } from '@/services/payment/update-payment-succes.service'; | ||
import { NextFunction, Request, Response } from 'express'; | ||
|
||
export class PaymentController { | ||
async processPayment(req: Request, res: Response, next: NextFunction) { | ||
try { | ||
const result = await processPaymentService(req.body, res.locals.user.id); | ||
return res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
async updatePaymentSuccess(req: Request, res: Response, next: NextFunction) { | ||
try { | ||
const result = await updatePaymentSuccessService(req.body); | ||
return res.status(200).send(result); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
} |
Oops, something went wrong.