Spaces:
Running
Running
Download apps/api/dist/integrations/integrations.controller.js from Benaah/MicProtocol: direct link, hf CLI and curl.
- Browser
- Download file 6.89 kB
-
https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/apps/api/dist/integrations/integrations.controller.js
- Command line
-
hf download hf://spaces/Benaah/MicProtocol/apps/api/dist/integrations/integrations.controller.js
-
curl -L -o integrations.controller.js https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/apps/api/dist/integrations/integrations.controller.js
6.89 kB
| ; | |
| 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); } | |
| }; | |
| var IntegrationsController_1; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.IntegrationsController = void 0; | |
| const common_1 = require("@nestjs/common"); | |
| const integrations_service_1 = require("./integrations.service"); | |
| let IntegrationsController = IntegrationsController_1 = class IntegrationsController { | |
| integrationsService; | |
| logger = new common_1.Logger(IntegrationsController_1.name); | |
| constructor(integrationsService) { | |
| this.integrationsService = integrationsService; | |
| } | |
| async googleCallback(code, state, error, res) { | |
| if (error) { | |
| this.logger.warn(`Google OAuth error: ${error}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=google_calendar&status=error`); | |
| } | |
| try { | |
| const result = await this.integrationsService.handleOAuthCallback(code, state); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=${result.provider}&status=${result.success ? "connected" : "error"}`); | |
| } | |
| catch (err) { | |
| this.logger.error(`Google OAuth callback failed: ${err.message}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=google_calendar&status=error`); | |
| } | |
| } | |
| async outlookCallback(code, state, error, res) { | |
| if (error) { | |
| this.logger.warn(`Outlook OAuth error: ${error}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=outlook&status=error`); | |
| } | |
| try { | |
| const result = await this.integrationsService.handleOAuthCallback(code, state); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=${result.provider}&status=${result.success ? "connected" : "error"}`); | |
| } | |
| catch (err) { | |
| this.logger.error(`Outlook OAuth callback failed: ${err.message}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=outlook&status=error`); | |
| } | |
| } | |
| async zoomCallback(code, state, error, res) { | |
| if (error) { | |
| this.logger.warn(`Zoom OAuth error: ${error}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=zoom&status=error`); | |
| } | |
| try { | |
| const result = await this.integrationsService.handleOAuthCallback(code, state); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=${result.provider}&status=${result.success ? "connected" : "error"}`); | |
| } | |
| catch (err) { | |
| this.logger.error(`Zoom OAuth callback failed: ${err.message}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=zoom&status=error`); | |
| } | |
| } | |
| async riversideCallback(code, state, error, res) { | |
| if (error) { | |
| this.logger.warn(`Riverside OAuth error: ${error}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=riverside&status=error`); | |
| } | |
| try { | |
| const result = await this.integrationsService.handleOAuthCallback(code, state); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=${result.provider}&status=${result.success ? "connected" : "error"}`); | |
| } | |
| catch (err) { | |
| this.logger.error(`Riverside OAuth callback failed: ${err.message}`); | |
| return res.redirect(`${process.env.WEBAPP_URL || "http://localhost:3000"}/settings?integration=riverside&status=error`); | |
| } | |
| } | |
| }; | |
| exports.IntegrationsController = IntegrationsController; | |
| __decorate([ | |
| (0, common_1.Get)("google/callback"), | |
| __param(0, (0, common_1.Query)("code")), | |
| __param(1, (0, common_1.Query)("state")), | |
| __param(2, (0, common_1.Query)("error")), | |
| __param(3, (0, common_1.Res)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String, String, String, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], IntegrationsController.prototype, "googleCallback", null); | |
| __decorate([ | |
| (0, common_1.Get)("outlook/callback"), | |
| __param(0, (0, common_1.Query)("code")), | |
| __param(1, (0, common_1.Query)("state")), | |
| __param(2, (0, common_1.Query)("error")), | |
| __param(3, (0, common_1.Res)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String, String, String, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], IntegrationsController.prototype, "outlookCallback", null); | |
| __decorate([ | |
| (0, common_1.Get)("zoom/callback"), | |
| __param(0, (0, common_1.Query)("code")), | |
| __param(1, (0, common_1.Query)("state")), | |
| __param(2, (0, common_1.Query)("error")), | |
| __param(3, (0, common_1.Res)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String, String, String, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], IntegrationsController.prototype, "zoomCallback", null); | |
| __decorate([ | |
| (0, common_1.Get)("riverside/callback"), | |
| __param(0, (0, common_1.Query)("code")), | |
| __param(1, (0, common_1.Query)("state")), | |
| __param(2, (0, common_1.Query)("error")), | |
| __param(3, (0, common_1.Res)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String, String, String, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], IntegrationsController.prototype, "riversideCallback", null); | |
| exports.IntegrationsController = IntegrationsController = IntegrationsController_1 = __decorate([ | |
| (0, common_1.Controller)("api/integrations"), | |
| __metadata("design:paramtypes", [integrations_service_1.IntegrationsService]) | |
| ], IntegrationsController); | |
| //# sourceMappingURL=integrations.controller.js.map |