Spaces:
Running
Running
Download apps/api/dist/network/network.controller.js from Benaah/MicProtocol: direct link, hf CLI and curl.
- Browser
- Download file 18.8 kB
-
https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/apps/api/dist/network/network.controller.js
- Command line
-
hf download hf://spaces/Benaah/MicProtocol/apps/api/dist/network/network.controller.js
-
curl -L -o network.controller.js https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/apps/api/dist/network/network.controller.js
18.8 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); } | |
| }; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.NetworkController = void 0; | |
| const common_1 = require("@nestjs/common"); | |
| const swagger_1 = require("@nestjs/swagger"); | |
| const throttler_1 = require("@nestjs/throttler"); | |
| const better_auth_guard_1 = require("../auth/better-auth.guard"); | |
| const podcast_access_guard_1 = require("../common/guards/podcast-access.guard"); | |
| const network_service_1 = require("./network.service"); | |
| const network_dto_1 = require("./network.dto"); | |
| let NetworkController = class NetworkController { | |
| networkService; | |
| constructor(networkService) { | |
| this.networkService = networkService; | |
| } | |
| async searchGuests(query) { | |
| return this.networkService.searchProfiles(query); | |
| } | |
| async getTrending(region, limit) { | |
| return this.networkService.getTrending(region, limit || 10); | |
| } | |
| async getProfile(vanityUrl) { | |
| return this.networkService.getProfileByVanityUrl(vanityUrl); | |
| } | |
| async trackView(body) { | |
| return this.networkService.trackView(body); | |
| } | |
| async createProfile(req, body) { | |
| return this.networkService.createProfile(req.userId, body); | |
| } | |
| async updateMyProfile(req, body) { | |
| return this.networkService.updateProfile(req.userId, body); | |
| } | |
| async getMyProfile(req) { | |
| return this.networkService.getMyProfile(req.userId); | |
| } | |
| async getViewStats(req, id, days) { | |
| return this.networkService.getProfileViewStats(req.userId, id, days || 30); | |
| } | |
| async createBookmark(body, req) { | |
| return this.networkService.createBookmark(body, req.userId); | |
| } | |
| async updateBookmark(req, id, body) { | |
| return this.networkService.updateBookmark(req.userId, id, body); | |
| } | |
| async removeBookmark(req, id) { | |
| return this.networkService.removeBookmark(req.userId, id); | |
| } | |
| async listBookmarks(req, podcastId, status) { | |
| return this.networkService.listBookmarks(podcastId, req.userId, status); | |
| } | |
| async createBookingRequest(body, req) { | |
| return this.networkService.createBookingRequest(body, req.userId); | |
| } | |
| async respondToBookingRequest(req, id, body) { | |
| return this.networkService.respondToBookingRequest(id, req.userId, body.status); | |
| } | |
| async listBookingRequests(req, profileId, status) { | |
| return this.networkService.listBookingRequests(req.userId, profileId, status); | |
| } | |
| async listSentBookingRequests(req, podcastId, status) { | |
| return this.networkService.listSentBookingRequests(req.userId, podcastId, status); | |
| } | |
| async submitReview(req, body) { | |
| return this.networkService.submitReview(req.userId, body); | |
| } | |
| async getReputationInsights(req, id) { | |
| return this.networkService.getReputationInsights(req.userId, id); | |
| } | |
| async recalculateReputation(req, id) { | |
| return this.networkService.recalculateReputation(req.userId, id); | |
| } | |
| async getRecommendations(req, id, limit) { | |
| return this.networkService.getRecommendations(req.userId, id, limit || 5); | |
| } | |
| async getProfileNetworkStats(req, id) { | |
| return this.networkService.getProfileNetworkStats(req.userId, id); | |
| } | |
| async getPodcastNetworkStats(podcastId, req) { | |
| return this.networkService.getPodcastNetworkStats(podcastId, req.userId); | |
| } | |
| async verifyProfile(req, profileId, body) { | |
| return this.networkService.verifyProfile(req.userId, profileId, body.status); | |
| } | |
| }; | |
| exports.NetworkController = NetworkController; | |
| __decorate([ | |
| (0, common_1.Get)("guests/search"), | |
| (0, throttler_1.Throttle)({ default: { limit: 30, ttl: 60000 } }), | |
| (0, swagger_1.ApiOperation)({ summary: "Search the guest network" }), | |
| (0, swagger_1.ApiResponse)({ status: 200, description: "Search results" }), | |
| __param(0, (0, common_1.Query)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [network_dto_1.GuestNetworkSearchDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "searchGuests", null); | |
| __decorate([ | |
| (0, common_1.Get)("guests/trending"), | |
| (0, swagger_1.ApiOperation)({ summary: "Get trending guest voices" }), | |
| (0, swagger_1.ApiQuery)({ name: "region", required: false, example: "east-africa" }), | |
| (0, swagger_1.ApiQuery)({ name: "limit", required: false, example: 10 }), | |
| __param(0, (0, common_1.Query)("region")), | |
| __param(1, (0, common_1.Query)("limit")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String, Number]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getTrending", null); | |
| __decorate([ | |
| (0, common_1.Get)("guests/:vanityUrl"), | |
| (0, swagger_1.ApiOperation)({ summary: "Get public guest profile by vanity URL" }), | |
| (0, swagger_1.ApiParam)({ name: "vanityUrl", example: "john-nduati" }), | |
| __param(0, (0, common_1.Param)("vanityUrl")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getProfile", null); | |
| __decorate([ | |
| (0, common_1.Post)("views"), | |
| (0, swagger_1.ApiOperation)({ summary: "Track a profile view" }), | |
| __param(0, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [network_dto_1.TrackProfileViewDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "trackView", null); | |
| __decorate([ | |
| (0, common_1.Post)("profiles"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Create your public guest profile" }), | |
| (0, swagger_1.ApiResponse)({ status: 201, description: "Profile created" }), | |
| (0, swagger_1.ApiResponse)({ status: 409, description: "Profile already exists" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, network_dto_1.CreateGuestPublicProfileDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "createProfile", null); | |
| __decorate([ | |
| (0, common_1.Put)("profiles/me"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Update your public guest profile" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, network_dto_1.UpdateGuestPublicProfileDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "updateMyProfile", null); | |
| __decorate([ | |
| (0, common_1.Get)("profiles/me"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Get your public profile with analytics" }), | |
| __param(0, (0, common_1.Req)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getMyProfile", null); | |
| __decorate([ | |
| (0, common_1.Get)("profiles/:id/views"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Get profile view statistics" }), | |
| (0, swagger_1.ApiParam)({ name: "id" }), | |
| (0, swagger_1.ApiQuery)({ name: "days", required: false, example: 30 }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __param(2, (0, common_1.Query)("days")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, Number]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getViewStats", null); | |
| __decorate([ | |
| (0, common_1.Post)("bookmarks"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Bookmark a guest profile" }), | |
| __param(0, (0, common_1.Body)()), | |
| __param(1, (0, common_1.Req)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [network_dto_1.CreateNetworkBookmarkDto, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "createBookmark", null); | |
| __decorate([ | |
| (0, common_1.Put)("bookmarks/:id"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Update a bookmark" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __param(2, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, network_dto_1.UpdateNetworkBookmarkDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "updateBookmark", null); | |
| __decorate([ | |
| (0, common_1.Delete)("bookmarks/:id"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Remove a bookmark" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "removeBookmark", null); | |
| __decorate([ | |
| (0, common_1.Get)("bookmarks"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "List bookmarked guest profiles" }), | |
| (0, swagger_1.ApiQuery)({ name: "podcastId", required: true }), | |
| (0, swagger_1.ApiQuery)({ name: "status", required: false }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Query)("podcastId")), | |
| __param(2, (0, common_1.Query)("status")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "listBookmarks", null); | |
| __decorate([ | |
| (0, common_1.Post)("booking-requests"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Send a booking request to a guest" }), | |
| (0, swagger_1.ApiResponse)({ status: 201, description: "Booking request created" }), | |
| __param(0, (0, common_1.Body)()), | |
| __param(1, (0, common_1.Req)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [network_dto_1.CreateNetworkBookingRequestDto, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "createBookingRequest", null); | |
| __decorate([ | |
| (0, common_1.Put)("booking-requests/:id/respond"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Accept or decline a booking request" }), | |
| (0, swagger_1.ApiParam)({ name: "id" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __param(2, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, network_dto_1.RespondToBookingRequestDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "respondToBookingRequest", null); | |
| __decorate([ | |
| (0, common_1.Get)("booking-requests/received"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "List received booking requests" }), | |
| (0, swagger_1.ApiQuery)({ name: "profileId", required: true }), | |
| (0, swagger_1.ApiQuery)({ name: "status", required: false }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Query)("profileId")), | |
| __param(2, (0, common_1.Query)("status")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "listBookingRequests", null); | |
| __decorate([ | |
| (0, common_1.Get)("booking-requests/sent"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "List sent booking requests" }), | |
| (0, swagger_1.ApiQuery)({ name: "podcastId", required: true }), | |
| (0, swagger_1.ApiQuery)({ name: "status", required: false }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Query)("podcastId")), | |
| __param(2, (0, common_1.Query)("status")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "listSentBookingRequests", null); | |
| __decorate([ | |
| (0, common_1.Post)("reviews"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Submit a host review for a guest" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, network_dto_1.CreateHostReviewDto]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "submitReview", null); | |
| __decorate([ | |
| (0, common_1.Get)("profiles/:id/reputation"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Get reputation insights for a profile" }), | |
| (0, swagger_1.ApiParam)({ name: "id" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getReputationInsights", null); | |
| __decorate([ | |
| (0, common_1.Post)("profiles/:id/reputation/recalculate"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Recalculate reputation score for a profile" }), | |
| (0, swagger_1.ApiParam)({ name: "id" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "recalculateReputation", null); | |
| __decorate([ | |
| (0, common_1.Get)("profiles/:id/recommendations"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Get guest recommendations based on network graph" }), | |
| (0, swagger_1.ApiParam)({ name: "id" }), | |
| (0, swagger_1.ApiQuery)({ name: "limit", required: false, example: 5 }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __param(2, (0, common_1.Query)("limit")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, Number]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getRecommendations", null); | |
| __decorate([ | |
| (0, common_1.Get)("profiles/:id/network-stats"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Get social network statistics for a profile" }), | |
| (0, swagger_1.ApiParam)({ name: "id" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("id")), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getProfileNetworkStats", null); | |
| __decorate([ | |
| (0, common_1.Get)("stats/:podcastId"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard, podcast_access_guard_1.PodcastAccessGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Get network usage statistics for a podcast" }), | |
| (0, swagger_1.ApiParam)({ name: "podcastId" }), | |
| __param(0, (0, common_1.Param)("podcastId")), | |
| __param(1, (0, common_1.Req)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [String, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "getPodcastNetworkStats", null); | |
| __decorate([ | |
| (0, common_1.Put)("admin/verify/:profileId"), | |
| (0, common_1.UseGuards)(better_auth_guard_1.BetterAuthGuard), | |
| (0, swagger_1.ApiBearerAuth)(), | |
| (0, swagger_1.ApiOperation)({ summary: "Verify a guest profile (admin)" }), | |
| (0, swagger_1.ApiParam)({ name: "profileId" }), | |
| __param(0, (0, common_1.Req)()), | |
| __param(1, (0, common_1.Param)("profileId")), | |
| __param(2, (0, common_1.Body)()), | |
| __metadata("design:type", Function), | |
| __metadata("design:paramtypes", [Object, String, Object]), | |
| __metadata("design:returntype", Promise) | |
| ], NetworkController.prototype, "verifyProfile", null); | |
| exports.NetworkController = NetworkController = __decorate([ | |
| (0, swagger_1.ApiTags)("Network"), | |
| (0, common_1.Controller)("network"), | |
| __metadata("design:paramtypes", [network_service_1.NetworkService]) | |
| ], NetworkController); | |
| //# sourceMappingURL=network.controller.js.map |