mirror of
				https://github.com/D4M13N-D3V/comissions-app-core-api.git
				synced 2025-10-31 09:35:25 +00:00 
			
		
		
		
	fix: added new endpoints for getting portfolio for a service
This commit is contained in:
		
							parent
							
								
									bb1ffe8578
								
							
						
					
					
						commit
						e8c0b86cc0
					
				| @ -180,6 +180,65 @@ public class DiscoveryController : Controller | |||||||
|         return Ok(result); |         return Ok(result); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     [HttpGet] | ||||||
|  |     [Route("Sellers/{sellerId:int}/Services/{serviceId:int}/Portfolio")] | ||||||
|  |     public async Task<IActionResult> GetSellerServicePortfolio(int sellerId, int serviceId, int offset = 0, int pageSize = 10) | ||||||
|  |     { | ||||||
|  |         var seller = await _dbContext.UserSellerProfiles | ||||||
|  |             .Include(x=>x.User) | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|  |         if(seller==null) | ||||||
|  |             return NotFound("Seller not found."); | ||||||
|  |         var sellerService = await _dbContext.SellerServices | ||||||
|  |             .Include(x=>x.PortfolioPieces) | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|  |         if(sellerService==null) | ||||||
|  |             return NotFound("Seller service not found."); | ||||||
|  |         var result = sellerService.PortfolioPieces.Select(x=>x.ToModel()).ToList(); | ||||||
|  |         return Ok(result); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     [HttpGet] | ||||||
|  |     [Route("Sellers/{sellerId:int}/Services/{serviceId:int}/Portfolio/Count")] | ||||||
|  |     public async Task<IActionResult> GetSellerServicePortfolioCount(int sellerId, int serviceId) | ||||||
|  |     { | ||||||
|  |         var seller = await _dbContext.UserSellerProfiles | ||||||
|  |             .Include(x=>x.User) | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|  |         if(seller==null) | ||||||
|  |             return NotFound("Seller not found."); | ||||||
|  |         var sellerService = await _dbContext.SellerServices | ||||||
|  |             .Include(x=>x.PortfolioPieces) | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|  |         if(sellerService==null) | ||||||
|  |             return NotFound("Seller service not found."); | ||||||
|  |         var result = sellerService.PortfolioPieces.Count; | ||||||
|  |         return Ok(result); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     [HttpGet] | ||||||
|  |     [Route("Sellers/{sellerId:int}/Services/{serviceId:int}/Portfolio/{portfolioId:int}")] | ||||||
|  |     public async Task<IActionResult> GetSellerServicePortfolioPiece(int sellerId, int serviceId, int portfolioId) | ||||||
|  |     { | ||||||
|  |         var seller = await _dbContext.UserSellerProfiles | ||||||
|  |             .Include(x=>x.User) | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|  |         if(seller==null) | ||||||
|  |             return NotFound("Seller not found."); | ||||||
|  |         var sellerService = await _dbContext.SellerServices | ||||||
|  |             .Include(x=>x.PortfolioPieces) | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|  |         if(sellerService==null) | ||||||
|  |             return NotFound("Seller service not found."); | ||||||
|  |         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|  |             .FirstOrDefaultAsync(x=>x.Id==portfolioId); | ||||||
|  |         if(sellerPortfolio==null) | ||||||
|  |             return NotFound("Portfolio piece not found."); | ||||||
|  |          | ||||||
|  |         var content = await _storageService.DownloadImageAsync(sellerPortfolio.FileReference); | ||||||
|  |         return new FileStreamResult(content, "application/octet-stream"); | ||||||
|  |     }    | ||||||
|  |      | ||||||
|     [HttpGet] |     [HttpGet] | ||||||
|     [Route("Sellers/{sellerId:int}/Services/{serviceId:int}/Reviews")] |     [Route("Sellers/{sellerId:int}/Services/{serviceId:int}/Reviews")] | ||||||
|     public async Task<IActionResult> GetSellerServiceReviews(int sellerId, int serviceId, int offset = 0, int pageSize = 10) |     public async Task<IActionResult> GetSellerServiceReviews(int sellerId, int serviceId, int offset = 0, int pageSize = 10) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Damien Ostler
						Damien Ostler