98 lines
4.1 KiB
JavaScript
98 lines
4.1 KiB
JavaScript
"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.AuthController = void 0;
|
||
|
|
const common_1 = require("@nestjs/common");
|
||
|
|
const auth_service_1 = require("./auth.service");
|
||
|
|
const auth_dto_1 = require("./dto/auth.dto");
|
||
|
|
const auth_decorators_1 = require("../common/decorators/auth.decorators");
|
||
|
|
const current_user_decorator_1 = require("../common/decorators/current-user.decorator");
|
||
|
|
let AuthController = class AuthController {
|
||
|
|
authService;
|
||
|
|
constructor(authService) {
|
||
|
|
this.authService = authService;
|
||
|
|
}
|
||
|
|
health() {
|
||
|
|
return { ok: true, service: 'fabric-trade-api' };
|
||
|
|
}
|
||
|
|
requestOtp(dto) {
|
||
|
|
return this.authService.requestOtp(dto);
|
||
|
|
}
|
||
|
|
verifyOtp(dto) {
|
||
|
|
return this.authService.verifyOtp(dto);
|
||
|
|
}
|
||
|
|
adminLogin(dto) {
|
||
|
|
return this.authService.adminLogin(dto);
|
||
|
|
}
|
||
|
|
me(user) {
|
||
|
|
return this.authService.me(user.id, user.type);
|
||
|
|
}
|
||
|
|
updateProfile(user, dto) {
|
||
|
|
return this.authService.updateProfile(user.id, dto);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
exports.AuthController = AuthController;
|
||
|
|
__decorate([
|
||
|
|
(0, auth_decorators_1.Public)(),
|
||
|
|
(0, common_1.Get)('health'),
|
||
|
|
__metadata("design:type", Function),
|
||
|
|
__metadata("design:paramtypes", []),
|
||
|
|
__metadata("design:returntype", void 0)
|
||
|
|
], AuthController.prototype, "health", null);
|
||
|
|
__decorate([
|
||
|
|
(0, auth_decorators_1.Public)(),
|
||
|
|
(0, common_1.Post)('auth/otp/request'),
|
||
|
|
__param(0, (0, common_1.Body)()),
|
||
|
|
__metadata("design:type", Function),
|
||
|
|
__metadata("design:paramtypes", [auth_dto_1.RequestOtpDto]),
|
||
|
|
__metadata("design:returntype", void 0)
|
||
|
|
], AuthController.prototype, "requestOtp", null);
|
||
|
|
__decorate([
|
||
|
|
(0, auth_decorators_1.Public)(),
|
||
|
|
(0, common_1.Post)('auth/otp/verify'),
|
||
|
|
__param(0, (0, common_1.Body)()),
|
||
|
|
__metadata("design:type", Function),
|
||
|
|
__metadata("design:paramtypes", [auth_dto_1.VerifyOtpDto]),
|
||
|
|
__metadata("design:returntype", void 0)
|
||
|
|
], AuthController.prototype, "verifyOtp", null);
|
||
|
|
__decorate([
|
||
|
|
(0, auth_decorators_1.Public)(),
|
||
|
|
(0, common_1.Post)('admin/auth/login'),
|
||
|
|
__param(0, (0, common_1.Body)()),
|
||
|
|
__metadata("design:type", Function),
|
||
|
|
__metadata("design:paramtypes", [auth_dto_1.AdminLoginDto]),
|
||
|
|
__metadata("design:returntype", void 0)
|
||
|
|
], AuthController.prototype, "adminLogin", null);
|
||
|
|
__decorate([
|
||
|
|
(0, auth_decorators_1.AuthType)('any'),
|
||
|
|
(0, common_1.Get)('auth/me'),
|
||
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
||
|
|
__metadata("design:type", Function),
|
||
|
|
__metadata("design:paramtypes", [Object]),
|
||
|
|
__metadata("design:returntype", void 0)
|
||
|
|
], AuthController.prototype, "me", null);
|
||
|
|
__decorate([
|
||
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
||
|
|
(0, common_1.Patch)('auth/profile'),
|
||
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
||
|
|
__param(1, (0, common_1.Body)()),
|
||
|
|
__metadata("design:type", Function),
|
||
|
|
__metadata("design:paramtypes", [Object, auth_dto_1.UpdateProfileDto]),
|
||
|
|
__metadata("design:returntype", void 0)
|
||
|
|
], AuthController.prototype, "updateProfile", null);
|
||
|
|
exports.AuthController = AuthController = __decorate([
|
||
|
|
(0, common_1.Controller)(),
|
||
|
|
__metadata("design:paramtypes", [auth_service_1.AuthService])
|
||
|
|
], AuthController);
|
||
|
|
//# sourceMappingURL=auth.controller.js.map
|