Your IP : 216.73.216.220


Current Path : /home/deltalab/PMS/logistic-backend/dist/models/pickup-points/
Upload File :
Current File : //home/deltalab/PMS/logistic-backend/dist/models/pickup-points/pickup-point.controller.js

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PickupPointController = void 0;
const openapi = require("@nestjs/swagger");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const pickup_point_schema_1 = require("./pickup-point.schema");
const pickup_point_service_1 = require("./pickup-point.service");
let PickupPointController = class PickupPointController {
    constructor(pickupPointService) {
        this.pickupPointService = pickupPointService;
    }
    async createProduct(response, pickupPoint) {
        const newPickupPoint = await this.pickupPointService.create(pickupPoint);
        return response.status(common_1.HttpStatus.CREATED).json(newPickupPoint);
    }
    async fetchAll(response) {
        const pickupPoints = await this.pickupPointService.readAll();
        return response.status(common_1.HttpStatus.OK).json(pickupPoints);
    }
    async findById(response, id) {
        const pickupPoint = await this.pickupPointService.readById(id);
        return response.status(common_1.HttpStatus.OK).json(pickupPoint);
    }
    async update(response, id, pickupPoint) {
        const updatedPickupPoint = await this.pickupPointService.update(id, pickupPoint);
        return response.status(common_1.HttpStatus.OK).json(updatedPickupPoint);
    }
    async delete(response, id) {
        const deletedPickupPoint = await this.pickupPointService.delete(id);
        return response.status(common_1.HttpStatus.OK).json(deletedPickupPoint);
    }
};
__decorate([
    (0, common_1.Post)(),
    openapi.ApiResponse({ status: 201, type: require("./pickup-point.schema").PickupPoint }),
    __param(0, (0, common_1.Res)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, pickup_point_schema_1.PickupPoint]),
    __metadata("design:returntype", Promise)
], PickupPointController.prototype, "createProduct", null);
__decorate([
    (0, common_1.Get)(),
    openapi.ApiResponse({ status: 200, type: [require("./pickup-point.schema").PickupPoint] }),
    __param(0, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], PickupPointController.prototype, "fetchAll", null);
__decorate([
    (0, common_1.Get)('/:id'),
    openapi.ApiResponse({ status: 200, type: require("./pickup-point.schema").PickupPoint }),
    __param(0, (0, common_1.Res)()),
    __param(1, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", Promise)
], PickupPointController.prototype, "findById", null);
__decorate([
    (0, common_1.Put)('/:id'),
    openapi.ApiResponse({ status: 200, type: require("./pickup-point.schema").PickupPoint }),
    __param(0, (0, common_1.Res)()),
    __param(1, (0, common_1.Param)('id')),
    __param(2, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, pickup_point_schema_1.PickupPoint]),
    __metadata("design:returntype", Promise)
], PickupPointController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)('/:id'),
    openapi.ApiResponse({ status: 200, type: require("./pickup-point.schema").PickupPoint }),
    __param(0, (0, common_1.Res)()),
    __param(1, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", Promise)
], PickupPointController.prototype, "delete", null);
PickupPointController = __decorate([
    (0, swagger_1.ApiTags)('Pickup points'),
    (0, common_1.Controller)({ path: 'pickup-points', version: '1' }),
    __metadata("design:paramtypes", [pickup_point_service_1.PickupPointService])
], PickupPointController);
exports.PickupPointController = PickupPointController;
//# sourceMappingURL=pickup-point.controller.js.map