Skip to content

Commit

Permalink
Add jsdoc to supplierController.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Sep 23, 2023
1 parent 5879e2a commit d7264b5
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions api/src/controllers/supplierController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ import Car from '../models/Car'
import * as Helper from '../common/Helper'
import * as bookcarsTypes from 'bookcars-types'

/**
* Validate Supplier by fullname.
*
* @export
* @async
* @param {Request} req
* @param {Response} res
* @returns {unknown}
*/
export async function validate(req: Request, res: Response) {
const body: bookcarsTypes.ValidateSupplierPayload = req.body
const { fullName } = body
Expand All @@ -31,6 +40,15 @@ export async function validate(req: Request, res: Response) {
}
}

/**
* Update Supplier.
*
* @export
* @async
* @param {Request} req
* @param {Response} res
* @returns {unknown}
*/
export async function update(req: Request, res: Response) {
const body: bookcarsTypes.UpdateSupplierPayload = req.body
const { _id } = body
Expand Down Expand Up @@ -58,6 +76,15 @@ export async function update(req: Request, res: Response) {
}
}

/**
* Delete Supplier by ID.
*
* @export
* @async
* @param {Request} req
* @param {Response} res
* @returns {unknown}
*/
export async function deleteSupplier(req: Request, res: Response) {
const { id } = req.params

Expand Down Expand Up @@ -96,6 +123,15 @@ export async function deleteSupplier(req: Request, res: Response) {
}
}

/**
* Get Supplier by ID.
*
* @export
* @async
* @param {Request} req
* @param {Response} res
* @returns {unknown}
*/
export async function getSupplier(req: Request, res: Response) {
const { id } = req.params

Expand Down Expand Up @@ -124,6 +160,15 @@ export async function getSupplier(req: Request, res: Response) {
}
}

/**
* Get Suppliers.
*
* @export
* @async
* @param {Request} req
* @param {Response} res
* @returns {unknown}
*/
export async function getSuppliers(req: Request, res: Response) {
try {
const page = Number.parseInt(req.params.page)
Expand Down Expand Up @@ -167,6 +212,15 @@ export async function getSuppliers(req: Request, res: Response) {
}
}

/**
* Get all Suppliers.
*
* @export
* @async
* @param {Request} req
* @param {Response} res
* @returns {unknown}
*/
export async function getAllSuppliers(req: Request, res: Response) {
try {
let data = await User.aggregate(
Expand Down

0 comments on commit d7264b5

Please sign in to comment.