Spaces:
Runtime error
Runtime error
| import express from "express"; | |
| import { Router } from 'express'; | |
| import { setVendorConfig, getVendorConfig, getAllVendorConfigs } from '../controllers/settings/vendorConfig.controller'; | |
| import { jwtMiddleware } from '../middlewares/authMiddleware'; | |
| const vendorConfigRouter = express.Router(); | |
| /** | |
| * @swagger | |
| * tags: | |
| * name: VendorConfig | |
| * description: API for managing vendor configurations. | |
| */ | |
| vendorConfigRouter.use(jwtMiddleware); | |
| /** | |
| * @swagger | |
| * /api/vendor-config: | |
| * get: | |
| * summary: Get all vendor configurations | |
| * tags: [VendorConfig] | |
| * responses: | |
| * 200: | |
| * description: Successfully retrieved all vendor configurations. | |
| * content: | |
| * application/json: | |
| * schema: | |
| * type: array | |
| * items: | |
| * type: object | |
| * properties: | |
| * id: | |
| * type: integer | |
| * vendor_ID: | |
| * type: integer | |
| * single_line_item: | |
| * type: boolean | |
| * 500: | |
| * description: Internal server error. | |
| */ | |
| vendorConfigRouter.get('/', getAllVendorConfigs); | |
| /** | |
| * @swagger | |
| * /api/vendor-config: | |
| * post: | |
| * summary: Set or update vendor configuration | |
| * tags: [VendorConfig] | |
| * requestBody: | |
| * required: true | |
| * content: | |
| * application/json: | |
| * schema: | |
| * type: object | |
| * properties: | |
| * vendor_id: | |
| * type: integer | |
| * description: The ID of the vendor. | |
| * single_line_item: | |
| * type: boolean | |
| * description: Indicates if the bill split items should be a single line item. | |
| * required: | |
| * - vendor_id | |
| * - single_line_item | |
| * responses: | |
| * 200: | |
| * description: Vendor configuration set or updated successfully. | |
| * content: | |
| * application/json: | |
| * schema: | |
| * type: object | |
| * properties: | |
| * vendorConfig: | |
| * type: object | |
| * description: The vendor configuration. | |
| * properties: | |
| * vendor_id: | |
| * type: integer | |
| * single_line_item: | |
| * type: boolean | |
| * created: | |
| * type: boolean | |
| * 500: | |
| * description: Internal server error. | |
| */ | |
| vendorConfigRouter.post('/', setVendorConfig); | |
| /** | |
| * @swagger | |
| * /api/vendor-config/{vendor_id}: | |
| * get: | |
| * summary: Get vendor configuration by ID | |
| * tags: [VendorConfig] | |
| * parameters: | |
| * - in: path | |
| * name: vendor_id | |
| * schema: | |
| * type: integer | |
| * required: true | |
| * description: The ID of the vendor. | |
| * responses: | |
| * 200: | |
| * description: Successfully retrieved vendor configuration. | |
| * content: | |
| * application/json: | |
| * schema: | |
| * type: object | |
| * properties: | |
| * id: | |
| * type: integer | |
| * vendor_id: | |
| * type: integer | |
| * single_line_item: | |
| * type: boolean | |
| * 404: | |
| * description: Vendor configuration not found. | |
| * 500: | |
| * description: Internal server error. | |
| */ | |
| vendorConfigRouter.get('/:vendor_id', getVendorConfig); | |
| export default vendorConfigRouter; | |