mirror of
				https://github.com/D4M13N-D3V/comissions-app-core-api.git
				synced 2025-10-31 09:35:25 +00:00 
			
		
		
		
	removed random strings in api
This commit is contained in:
		
							parent
							
								
									d9f01cc96c
								
							
						
					
					
						commit
						29fc36e612
					
				| @ -53,7 +53,7 @@ public class AdminOrdersController:ControllerBase | |||||||
|             .FirstOrDefaultAsync(x=>x.Id==orderId); |             .FirstOrDefaultAsync(x=>x.Id==orderId); | ||||||
| 
 | 
 | ||||||
|         if (order == null) |         if (order == null) | ||||||
|             return NotFound("Order not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         return Ok(order); |         return Ok(order); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ public class AdminSellersController:ControllerBase | |||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
| 
 | 
 | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         return Ok(seller); |         return Ok(seller); | ||||||
|     } |     } | ||||||
| @ -57,7 +57,7 @@ public class AdminSellersController:ControllerBase | |||||||
|             .FirstOrDefault(x=>x.Id==sellerId); |             .FirstOrDefault(x=>x.Id==sellerId); | ||||||
|          |          | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         var orders = await _dbContext.SellerServiceOrders.Where(x=>x.SellerId==sellerId).ToListAsync(); |         var orders = await _dbContext.SellerServiceOrders.Where(x=>x.SellerId==sellerId).ToListAsync(); | ||||||
|         return Ok(orders); |         return Ok(orders); | ||||||
| @ -69,10 +69,10 @@ public class AdminSellersController:ControllerBase | |||||||
|         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); |         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); | ||||||
|          |          | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
| 
 | 
 | ||||||
|         if (seller.Suspended) |         if (seller.Suspended) | ||||||
|             return BadRequest("Seller is already suspended."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         seller.Suspended = true; |         seller.Suspended = true; | ||||||
|         seller.SuspendedDate = DateTime.UtcNow; |         seller.SuspendedDate = DateTime.UtcNow; | ||||||
| @ -91,10 +91,10 @@ public class AdminSellersController:ControllerBase | |||||||
|         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); |         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); | ||||||
|          |          | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
| 
 | 
 | ||||||
|         if (!seller.Suspended) |         if (!seller.Suspended) | ||||||
|             return BadRequest("Seller is not suspended."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         seller.Suspended = false; |         seller.Suspended = false; | ||||||
|         seller.SuspendedDate = null; |         seller.SuspendedDate = null; | ||||||
| @ -113,10 +113,10 @@ public class AdminSellersController:ControllerBase | |||||||
|         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); |         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); | ||||||
|          |          | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
| 
 | 
 | ||||||
|         if (!seller.Suspended) |         if (!seller.Suspended) | ||||||
|             return BadRequest("Seller is not suspended."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         _dbContext.UserSellerProfiles.Remove(seller); |         _dbContext.UserSellerProfiles.Remove(seller); | ||||||
|         await _dbContext.SaveChangesAsync(); |         await _dbContext.SaveChangesAsync(); | ||||||
| @ -129,10 +129,10 @@ public class AdminSellersController:ControllerBase | |||||||
|         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); |         var seller = _dbContext.UserSellerProfiles.FirstOrDefault(x=>x.Id==sellerId); | ||||||
|          |          | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
| 
 | 
 | ||||||
|         if (!seller.Suspended) |         if (!seller.Suspended) | ||||||
|             return BadRequest("Seller is not suspended."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         seller.Biography = biography; |         seller.Biography = biography; | ||||||
|         _dbContext.UserSellerProfiles.Update(seller); |         _dbContext.UserSellerProfiles.Update(seller); | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
| 
 | 
 | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         return Ok(user); |         return Ok(user); | ||||||
|     } |     } | ||||||
| @ -54,7 +54,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.Include(x=>x.Orders).FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.Include(x=>x.Orders).FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         return Ok(user.Orders); |         return Ok(user.Orders); | ||||||
|     } |     } | ||||||
| @ -65,7 +65,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         user.Suspended = true; |         user.Suspended = true; | ||||||
|         user.SuspendedDate = DateTime.UtcNow; |         user.SuspendedDate = DateTime.UtcNow; | ||||||
| @ -83,7 +83,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         user.Suspended = false; |         user.Suspended = false; | ||||||
|         user.SuspendedDate = null; |         user.SuspendedDate = null; | ||||||
| @ -101,7 +101,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         user.Banned = true; |         user.Banned = true; | ||||||
|         user.BannedDate = DateTime.UtcNow; |         user.BannedDate = DateTime.UtcNow; | ||||||
| @ -119,7 +119,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         user.Banned = false; |         user.Banned = false; | ||||||
|         user.BannedDate = null; |         user.BannedDate = null; | ||||||
| @ -137,7 +137,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         user.DisplayName = displayName; |         user.DisplayName = displayName; | ||||||
|         _dbContext.Users.Update(user); |         _dbContext.Users.Update(user); | ||||||
| @ -151,7 +151,7 @@ public class AdminUsersController:ControllerBase | |||||||
|         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); |         var user = await _dbContext.Users.FirstOrDefaultAsync(x=>x.Id==userId); | ||||||
|          |          | ||||||
|         if (user == null) |         if (user == null) | ||||||
|             return NotFound("User not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         user.Biography = biography; |         user.Biography = biography; | ||||||
|         _dbContext.Users.Update(user); |         _dbContext.Users.Update(user); | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var result = seller.ToDiscoveryModel(); |         var result = seller.ToDiscoveryModel(); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|     } |     } | ||||||
| @ -58,7 +58,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces |         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|             .Where(x=>x.SellerProfileId==sellerId) |             .Where(x=>x.SellerProfileId==sellerId) | ||||||
|             .Skip(offset).Take(pageSize).ToListAsync(); |             .Skip(offset).Take(pageSize).ToListAsync(); | ||||||
| @ -74,7 +74,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces |         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|             .Where(x=>x.SellerProfileId==sellerId) |             .Where(x=>x.SellerProfileId==sellerId) | ||||||
|             .CountAsync(); |             .CountAsync(); | ||||||
| @ -89,7 +89,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces |         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==portfolioId); |             .FirstOrDefaultAsync(x=>x.Id==portfolioId); | ||||||
|         if(sellerPortfolio==null) |         if(sellerPortfolio==null) | ||||||
| @ -107,7 +107,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerReviews = await _dbContext.SellerServiceOrderReviews |         var sellerReviews = await _dbContext.SellerServiceOrderReviews | ||||||
|             .Where(x=>x.SellerService.SellerProfileId==sellerId) |             .Where(x=>x.SellerService.SellerProfileId==sellerId) | ||||||
|             .Skip(offset).Take(pageSize).ToListAsync(); |             .Skip(offset).Take(pageSize).ToListAsync(); | ||||||
| @ -128,7 +128,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerReviews = await _dbContext.SellerServiceOrderReviews |         var sellerReviews = await _dbContext.SellerServiceOrderReviews | ||||||
|             .Where(x=>x.SellerService.SellerProfileId==sellerId) |             .Where(x=>x.SellerService.SellerProfileId==sellerId) | ||||||
|             .CountAsync(); |             .CountAsync(); | ||||||
| @ -154,7 +154,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerServices = await _dbContext.SellerServices |         var sellerServices = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.Reviews) |             .Include(x=>x.Reviews) | ||||||
|             .Where(x=>x.SellerProfileId==sellerId && !x.Archived) |             .Where(x=>x.SellerProfileId==sellerId && !x.Archived) | ||||||
| @ -171,12 +171,12 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerService = await _dbContext.SellerServices |         var sellerService = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.Reviews) |             .Include(x=>x.Reviews) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
|         var result = sellerService.ToModel(); |         var result = sellerService.ToModel(); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|     } |     } | ||||||
| @ -189,7 +189,7 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerServices = await _dbContext.SellerServices |         var sellerServices = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.Reviews) |             .Include(x=>x.Reviews) | ||||||
|             .Where(x=>x.SellerProfileId==sellerId && !x.Archived) |             .Where(x=>x.SellerProfileId==sellerId && !x.Archived) | ||||||
| @ -206,12 +206,12 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerService = await _dbContext.SellerServices |         var sellerService = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.PortfolioPieces) |             .Include(x=>x.PortfolioPieces) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
|         var result = sellerService.PortfolioPieces.Select(x=>x.ToModel()).ToList(); |         var result = sellerService.PortfolioPieces.Select(x=>x.ToModel()).ToList(); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|     } |     } | ||||||
| @ -224,12 +224,12 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerService = await _dbContext.SellerServices |         var sellerService = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.PortfolioPieces) |             .Include(x=>x.PortfolioPieces) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
|         var result = sellerService.PortfolioPieces.Count; |         var result = sellerService.PortfolioPieces.Count; | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|     } |     } | ||||||
| @ -242,12 +242,12 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerService = await _dbContext.SellerServices |         var sellerService = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.PortfolioPieces) |             .Include(x=>x.PortfolioPieces) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
|         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces |         var sellerPortfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==portfolioId); |             .FirstOrDefaultAsync(x=>x.Id==portfolioId); | ||||||
|         if(sellerPortfolio==null) |         if(sellerPortfolio==null) | ||||||
| @ -265,12 +265,12 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerService = await _dbContext.SellerServices |         var sellerService = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.Reviews).ThenInclude(x=>x.Reviewer) |             .Include(x=>x.Reviews).ThenInclude(x=>x.Reviewer) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
|         var result = sellerService.Reviews.Select(x=> new DiscoveryReviewModel() |         var result = sellerService.Reviews.Select(x=> new DiscoveryReviewModel() | ||||||
|         { |         { | ||||||
|             Rating = x.Rating, |             Rating = x.Rating, | ||||||
| @ -288,12 +288,12 @@ public class DiscoveryController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         var sellerService = await _dbContext.SellerServices |         var sellerService = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.Reviews).ThenInclude(x=>x.Reviewer) |             .Include(x=>x.Reviews).ThenInclude(x=>x.Reviewer) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
|         var result = sellerService.Reviews.Count; |         var result = sellerService.Reviews.Count; | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -109,21 +109,21 @@ public class OrderController : Controller | |||||||
|             .Include(x=>x.User) |             .Include(x=>x.User) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==sellerId); |             .FirstOrDefaultAsync(x=>x.Id==sellerId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("Seller not found."); |             return NotFound(); | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return NotFound("Seller is suspended."); |             return NotFound(); | ||||||
|          |          | ||||||
|         var service = await _dbContext.SellerServices |         var service = await _dbContext.SellerServices | ||||||
|             .Include(x=>x.Reviews) |             .Include(x=>x.Reviews) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==serviceId); |             .FirstOrDefaultAsync(x=>x.Id==serviceId); | ||||||
|         if(service==null) |         if(service==null) | ||||||
|             return NotFound("Service not found."); |             return NotFound(); | ||||||
|          |          | ||||||
|         if(service.Archived) |         if(service.Archived) | ||||||
|             return BadRequest("Service is archived."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         if(_dbContext.SellerServiceOrders.Where(x=>x.BuyerId==userId && x.Status!=EnumOrderStatus.Completed && x.Status!=EnumOrderStatus.Declined).Count()>=3) |         if(_dbContext.SellerServiceOrders.Where(x=>x.BuyerId==userId && x.Status!=EnumOrderStatus.Completed && x.Status!=EnumOrderStatus.Declined).Count()>=3) | ||||||
|             return BadRequest("You already have an order in progress. There is a limit of three at a time."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         var order = new SellerServiceOrder() |         var order = new SellerServiceOrder() | ||||||
|         { |         { | ||||||
| @ -152,11 +152,11 @@ public class OrderController : Controller | |||||||
|             .Include(x=>x.SellerService) |             .Include(x=>x.SellerService) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId); |             .FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId); | ||||||
|         if(order==null) |         if(order==null) | ||||||
|             return NotFound("/Order not found."); |             return NotFound(); | ||||||
|         if(order.BuyerId!=userId) |         if(order.BuyerId!=userId) | ||||||
|             return BadRequest("You are not the buyer of this order."); |             return BadRequest(); | ||||||
|         if(order.Status==EnumOrderStatus.Completed) |         if(order.Status==EnumOrderStatus.Completed) | ||||||
|             return BadRequest("/Order is not in a cancellable state."); |             return BadRequest(); | ||||||
|         order.Status = EnumOrderStatus.Declined; |         order.Status = EnumOrderStatus.Declined; | ||||||
|         order.EndDate = DateTime.UtcNow; |         order.EndDate = DateTime.UtcNow; | ||||||
|         order = _dbContext.SellerServiceOrders.Update(order).Entity; |         order = _dbContext.SellerServiceOrders.Update(order).Entity; | ||||||
| @ -177,13 +177,13 @@ public class OrderController : Controller | |||||||
|             .Include(x=>x.Seller) |             .Include(x=>x.Seller) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId); |             .FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId); | ||||||
|         if(order==null) |         if(order==null) | ||||||
|             return NotFound("/Order not found."); |             return NotFound(); | ||||||
|         if(order.Seller.UserId!=userId) |         if(order.Seller.UserId!=userId) | ||||||
|             return BadRequest("You are not the seller of this order."); |             return BadRequest(); | ||||||
|         if(order.Status==EnumOrderStatus.Completed) |         if(order.Status==EnumOrderStatus.Completed) | ||||||
|             return BadRequest("/Order is already complete."); |             return BadRequest(); | ||||||
|         if(order.Status!=EnumOrderStatus.WaitingForPayment) |         if(order.Status!=EnumOrderStatus.WaitingForPayment) | ||||||
|             return BadRequest("/Order does not need to be paid for."); |             return BadRequest(); | ||||||
|         if (order.PaymentUrl != null) |         if (order.PaymentUrl != null) | ||||||
|             return Ok(order.PaymentUrl); |             return Ok(order.PaymentUrl); | ||||||
|         var url = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price); |         var url = _paymentService.ChargeForService(order.Id, order.Seller.StripeAccountId, order.Price); | ||||||
| @ -205,13 +205,13 @@ public class OrderController : Controller | |||||||
|             .Include(x=>x.SellerService) |             .Include(x=>x.SellerService) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId); |             .FirstOrDefaultAsync(x=>x.Id==orderId && x.BuyerId==userId); | ||||||
|         if(order==null) |         if(order==null) | ||||||
|             return NotFound("/Order not found."); |             return NotFound(); | ||||||
|         if(order.BuyerId!=userId) |         if(order.BuyerId!=userId) | ||||||
|             return BadRequest("You are not the buyer of this order."); |             return BadRequest(""); | ||||||
|         if(order.Status!=EnumOrderStatus.Completed) |         if(order.Status!=EnumOrderStatus.Completed) | ||||||
|             return BadRequest("/Order is not complete."); |             return BadRequest(""); | ||||||
|         if(order.Reviews.Any(x=>x.SellerServiceOrderId==orderId)) |         if(order.Reviews.Any(x=>x.SellerServiceOrderId==orderId)) | ||||||
|             return BadRequest("/Order has already been reviewed."); |             return BadRequest(""); | ||||||
|         var review = new SellerServiceOrderReview() |         var review = new SellerServiceOrderReview() | ||||||
|         { |         { | ||||||
|             SellerServiceOrderId = orderId, |             SellerServiceOrderId = orderId, | ||||||
|  | |||||||
| @ -60,20 +60,20 @@ public class SellerOrderController : Controller | |||||||
|         var userId = User.GetUserId(); |         var userId = User.GetUserId(); | ||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x=>x.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x=>x.UserId==userId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("User it not a seller."); |             return NotFound(); | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var order = await _dbContext.SellerServiceOrders |         var order = await _dbContext.SellerServiceOrders | ||||||
|             .Include(x=>x.SellerService) |             .Include(x=>x.SellerService) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==orderId && x.Seller.UserId==userId); |             .FirstOrDefaultAsync(x=>x.Id==orderId && x.Seller.UserId==userId); | ||||||
|         if(order==null) |         if(order==null) | ||||||
|             return NotFound("Order not found."); |             return NotFound(); | ||||||
|         if(order.Status==EnumOrderStatus.Completed || order.Status== EnumOrderStatus.Declined) |         if(order.Status==EnumOrderStatus.Completed || order.Status== EnumOrderStatus.Declined) | ||||||
|             return BadRequest("Order is already complete."); |             return BadRequest(); | ||||||
|         if(order.BuyerId!=userId) |         if(order.BuyerId!=userId) | ||||||
|             return BadRequest("You are not the buyer of this order."); |             return BadRequest(); | ||||||
|         if(order.Status!=EnumOrderStatus.Completed && order.Status!= EnumOrderStatus.Declined) |         if(order.Status!=EnumOrderStatus.Completed && order.Status!= EnumOrderStatus.Declined) | ||||||
|             return BadRequest("Order is not in a cancellable state."); |             return BadRequest(); | ||||||
|         order.Status = EnumOrderStatus.Declined; |         order.Status = EnumOrderStatus.Declined; | ||||||
|         order.EndDate = DateTime.UtcNow; |         order.EndDate = DateTime.UtcNow; | ||||||
|         order = _dbContext.SellerServiceOrders.Update(order).Entity; |         order = _dbContext.SellerServiceOrders.Update(order).Entity; | ||||||
| @ -90,22 +90,22 @@ public class SellerOrderController : Controller | |||||||
|         var userId = User.GetUserId(); |         var userId = User.GetUserId(); | ||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x => x.UserId == userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x => x.UserId == userId); | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("User it not a seller."); |             return NotFound(); | ||||||
|         if (seller.Suspended) |         if (seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var order = await _dbContext.SellerServiceOrders |         var order = await _dbContext.SellerServiceOrders | ||||||
|             .Include(x => x.SellerService) |             .Include(x => x.SellerService) | ||||||
|             .FirstOrDefaultAsync(x => x.Id == orderId && x.Seller.UserId == userId); |             .FirstOrDefaultAsync(x => x.Id == orderId && x.Seller.UserId == userId); | ||||||
|         if (order == null) |         if (order == null) | ||||||
|             return NotFound("Order not found."); |             return NotFound(); | ||||||
|         if (order.Status == EnumOrderStatus.Completed || order.Status == EnumOrderStatus.Declined) |         if (order.Status == EnumOrderStatus.Completed || order.Status == EnumOrderStatus.Declined) | ||||||
|             return BadRequest("Order is already complete."); |             return BadRequest(); | ||||||
|         if (order.BuyerId != userId) |         if (order.BuyerId != userId) | ||||||
|             return BadRequest("You are not the buyer of this order."); |             return BadRequest(); | ||||||
|         if (order.Status != EnumOrderStatus.PendingAcceptance) |         if (order.Status != EnumOrderStatus.PendingAcceptance) | ||||||
|             return BadRequest("Order has already been accepted."); |             return BadRequest(); | ||||||
|         if (order.Status == EnumOrderStatus.Declined) |         if (order.Status == EnumOrderStatus.Declined) | ||||||
|             return BadRequest("Order has already been declined."); |             return BadRequest(); | ||||||
|         order.Status = EnumOrderStatus.WaitingForPayment; |         order.Status = EnumOrderStatus.WaitingForPayment; | ||||||
|         order = _dbContext.SellerServiceOrders.Update(order).Entity; |         order = _dbContext.SellerServiceOrders.Update(order).Entity; | ||||||
|         await _dbContext.SaveChangesAsync(); |         await _dbContext.SaveChangesAsync(); | ||||||
| @ -121,20 +121,20 @@ public class SellerOrderController : Controller | |||||||
|         var userId = User.GetUserId(); |         var userId = User.GetUserId(); | ||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x => x.UserId == userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x => x.UserId == userId); | ||||||
|         if (seller == null) |         if (seller == null) | ||||||
|             return NotFound("User it not a seller."); |             return NotFound(); | ||||||
|         if (seller.Suspended) |         if (seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var order = await _dbContext.SellerServiceOrders |         var order = await _dbContext.SellerServiceOrders | ||||||
|             .Include(x => x.SellerService) |             .Include(x => x.SellerService) | ||||||
|             .FirstOrDefaultAsync(x => x.Id == orderId && x.Seller.UserId == userId); |             .FirstOrDefaultAsync(x => x.Id == orderId && x.Seller.UserId == userId); | ||||||
|         if (order == null) |         if (order == null) | ||||||
|             return NotFound("Order not found."); |             return NotFound(); | ||||||
|         if (order.Status == EnumOrderStatus.Completed || order.Status == EnumOrderStatus.Declined) |         if (order.Status == EnumOrderStatus.Completed || order.Status == EnumOrderStatus.Declined) | ||||||
|             return BadRequest("Order is already complete."); |             return BadRequest(); | ||||||
|         if (order.BuyerId != userId) |         if (order.BuyerId != userId) | ||||||
|             return BadRequest("You are not the buyer of this order."); |             return BadRequest(); | ||||||
|         if (order.Status != EnumOrderStatus.PendingAcceptance) |         if (order.Status != EnumOrderStatus.PendingAcceptance) | ||||||
|             return BadRequest("Order has already been accepted or declined."); |             return BadRequest(); | ||||||
|         order.Status = EnumOrderStatus.Declined; |         order.Status = EnumOrderStatus.Declined; | ||||||
|         order = _dbContext.SellerServiceOrders.Update(order).Entity; |         order = _dbContext.SellerServiceOrders.Update(order).Entity; | ||||||
|         await _dbContext.SaveChangesAsync(); |         await _dbContext.SaveChangesAsync(); | ||||||
| @ -155,19 +155,19 @@ public class SellerOrderController : Controller | |||||||
|             .FirstOrDefaultAsync(x=>x.Id==orderId && x.Seller.UserId==userId); |             .FirstOrDefaultAsync(x=>x.Id==orderId && x.Seller.UserId==userId); | ||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x=>x.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(x=>x.UserId==userId); | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return NotFound("User it not a seller."); |             return NotFound(); | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         if(order==null) |         if(order==null) | ||||||
|             return NotFound("Order not found."); |             return NotFound(); | ||||||
|         if(order.Seller.UserId!=userId) |         if(order.Seller.UserId!=userId) | ||||||
|             return BadRequest("You are not the seller of this order."); |             return BadRequest(); | ||||||
|         if(order.Status==EnumOrderStatus.Completed || order.Status== EnumOrderStatus.Declined) |         if(order.Status==EnumOrderStatus.Completed || order.Status== EnumOrderStatus.Declined) | ||||||
|             return BadRequest("Order is already complete."); |             return BadRequest(); | ||||||
|         if(order.Status<EnumOrderStatus.InProgress) |         if(order.Status<EnumOrderStatus.InProgress) | ||||||
|             return BadRequest("Order has not been started."); |             return BadRequest(); | ||||||
|         if(order.Status>EnumOrderStatus.InProgress) |         if(order.Status>EnumOrderStatus.InProgress) | ||||||
|             return BadRequest("Order is pending review already."); |             return BadRequest(); | ||||||
|         order.Status = EnumOrderStatus.Completed; |         order.Status = EnumOrderStatus.Completed; | ||||||
|         order = _dbContext.SellerServiceOrders.Update(order).Entity; |         order = _dbContext.SellerServiceOrders.Update(order).Entity; | ||||||
|         await _dbContext.SaveChangesAsync(); |         await _dbContext.SaveChangesAsync(); | ||||||
|  | |||||||
| @ -40,8 +40,8 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         var result = sellerProfile.ToModel(); |         var result = sellerProfile.ToModel(); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
| @ -57,8 +57,8 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         var updatedSellerProfile = model.ToModel(existingSellerProfile); |         var updatedSellerProfile = model.ToModel(existingSellerProfile); | ||||||
|         updatedSellerProfile = _dbContext.UserSellerProfiles.Update(updatedSellerProfile).Entity; |         updatedSellerProfile = _dbContext.UserSellerProfiles.Update(updatedSellerProfile).Entity; | ||||||
| @ -76,7 +76,7 @@ public class SellerProfileController : Controller | |||||||
|         var existingSellerProfile = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); |         var existingSellerProfile = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); | ||||||
|         if (existingSellerProfile != null) |         if (existingSellerProfile != null) | ||||||
|         { |         { | ||||||
|             return Unauthorized("Account is already a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId); |         var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId); | ||||||
| @ -104,11 +104,11 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         var portfolio = await _dbContext.SellerProfilePortfolioPieces |         var portfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|             .FirstAsync(x => x.SellerProfileId == existingSellerProfile.Id && x.Id==portfolioId); |             .FirstAsync(x => x.SellerProfileId == existingSellerProfile.Id && x.Id==portfolioId); | ||||||
| @ -127,11 +127,11 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var portfolio = await _dbContext.SellerProfilePortfolioPieces.Where(x=>x.SellerProfileId==existingSellerProfile.Id).ToListAsync(); |         var portfolio = await _dbContext.SellerProfilePortfolioPieces.Where(x=>x.SellerProfileId==existingSellerProfile.Id).ToListAsync(); | ||||||
|         var result = portfolio.Select(x=>x.ToModel()).ToList(); |         var result = portfolio.Select(x=>x.ToModel()).ToList(); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
| @ -148,12 +148,12 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var url = await _storageService.UploadImageAsync(file, Guid.NewGuid().ToString()); |         var url = await _storageService.UploadImageAsync(file, Guid.NewGuid().ToString()); | ||||||
|         var portfolio = new SellerProfilePortfolioPiece() |         var portfolio = new SellerProfilePortfolioPiece() | ||||||
|         { |         { | ||||||
| @ -178,16 +178,16 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var portfolio = await _dbContext.SellerProfilePortfolioPieces.FirstOrDefaultAsync(x=>x.Id==portfolioId); |         var portfolio = await _dbContext.SellerProfilePortfolioPieces.FirstOrDefaultAsync(x=>x.Id==portfolioId); | ||||||
|         if(portfolio==null) |         if(portfolio==null) | ||||||
|             return NotFound("Portfolio piece not found."); |             return NotFound(); | ||||||
|         if(portfolio.SellerProfileId!=existingSellerProfile.Id) |         if(portfolio.SellerProfileId!=existingSellerProfile.Id) | ||||||
|             return BadRequest("Portfolio piece does not belong to this seller."); |             return BadRequest(); | ||||||
|         _dbContext.SellerProfilePortfolioPieces.Remove(portfolio); |         _dbContext.SellerProfilePortfolioPieces.Remove(portfolio); | ||||||
|         await _dbContext.SaveChangesAsync(); |         await _dbContext.SaveChangesAsync(); | ||||||
|         return Ok(); |         return Ok(); | ||||||
| @ -204,14 +204,14 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         if(existingSellerProfile.StripeAccountId!=null) |         if(existingSellerProfile.StripeAccountId!=null) | ||||||
|             return BadRequest("Account already have a payment account."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         var accountId = _paymentService.CreateSellerAccount(); |         var accountId = _paymentService.CreateSellerAccount(); | ||||||
|         existingSellerProfile.StripeAccountId = accountId; |         existingSellerProfile.StripeAccountId = accountId; | ||||||
| @ -232,13 +232,13 @@ public class SellerProfileController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         if(existingSellerProfile.StripeAccountId==null) |         if(existingSellerProfile.StripeAccountId==null) | ||||||
|             return BadRequest("Account does not have a payment account."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         var result = _paymentService.CreateSellerAccountOnboardingUrl(existingSellerProfile.StripeAccountId); |         var result = _paymentService.CreateSellerAccountOnboardingUrl(existingSellerProfile.StripeAccountId); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
|  | |||||||
| @ -36,10 +36,10 @@ public class SellerServiceController : Controller | |||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); | ||||||
|          |          | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return BadRequest("Account is not a seller."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         var sellerServices = await _dbContext.SellerServices.Where(x=>x.Archived==false).Include(x=>x.Reviews) |         var sellerServices = await _dbContext.SellerServices.Where(x=>x.Archived==false).Include(x=>x.Reviews) | ||||||
|             .Skip(offset).Take(pageSize).ToListAsync(); |             .Skip(offset).Take(pageSize).ToListAsync(); | ||||||
| @ -56,10 +56,10 @@ public class SellerServiceController : Controller | |||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); | ||||||
|          |          | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return BadRequest("Account is not a seller."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         var sellerServices = await _dbContext.SellerServices.Where(x=>x.Archived==false).Include(x => x.Reviews).ToListAsync(); |         var sellerServices = await _dbContext.SellerServices.Where(x=>x.Archived==false).Include(x => x.Reviews).ToListAsync(); | ||||||
|         var result = sellerServices.Count; |         var result = sellerServices.Count; | ||||||
| @ -74,16 +74,16 @@ public class SellerServiceController : Controller | |||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); | ||||||
|          |          | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return BadRequest("Account is not a seller."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if(seller.StripeAccountId==null) |         if(seller.StripeAccountId==null) | ||||||
|             return BadRequest("Account does not have a payment account."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if (_paymentService.SellerAccountIsOnboarded(seller.StripeAccountId) == false) |         if (_paymentService.SellerAccountIsOnboarded(seller.StripeAccountId) == false) | ||||||
|             return BadRequest("Account has not finished onboarding."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         var sellerService = new SellerService() |         var sellerService = new SellerService() | ||||||
|         { |         { | ||||||
| @ -107,15 +107,15 @@ public class SellerServiceController : Controller | |||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); | ||||||
|          |          | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return BadRequest("Account is not a seller."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         var sellerService = await _dbContext.SellerServices.FirstOrDefaultAsync(sellerService=>sellerService.Id==sellerServiceId); |         var sellerService = await _dbContext.SellerServices.FirstOrDefaultAsync(sellerService=>sellerService.Id==sellerServiceId); | ||||||
|          |          | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
| 
 | 
 | ||||||
|         sellerService.Name = model.Name; |         sellerService.Name = model.Name; | ||||||
|         sellerService.Description = model.Description; |         sellerService.Description = model.Description; | ||||||
| @ -136,15 +136,15 @@ public class SellerServiceController : Controller | |||||||
|         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); |         var seller = await _dbContext.UserSellerProfiles.FirstOrDefaultAsync(sellerProfile=>sellerProfile.UserId==userId); | ||||||
|          |          | ||||||
|         if(seller==null) |         if(seller==null) | ||||||
|             return BadRequest("Account is not a seller."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         if(seller.Suspended) |         if(seller.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
| 
 | 
 | ||||||
|         var sellerService = await _dbContext.SellerServices.FirstOrDefaultAsync(sellerService=>sellerService.Id==sellerServiceId); |         var sellerService = await _dbContext.SellerServices.FirstOrDefaultAsync(sellerService=>sellerService.Id==sellerServiceId); | ||||||
|          |          | ||||||
|         if(sellerService==null) |         if(sellerService==null) | ||||||
|             return NotFound("Seller service not found."); |             return NotFound(); | ||||||
| 
 | 
 | ||||||
|         sellerService.Archived = true; |         sellerService.Archived = true; | ||||||
|         _dbContext.SellerServices.Update(sellerService); |         _dbContext.SellerServices.Update(sellerService); | ||||||
| @ -164,11 +164,11 @@ public class SellerServiceController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var portfolio = await _dbContext.SellerProfilePortfolioPieces.Where(x=>x.SellerProfileId==existingSellerProfile.Id && x.SellerServiceId==sellerServiceId).ToListAsync(); |         var portfolio = await _dbContext.SellerProfilePortfolioPieces.Where(x=>x.SellerProfileId==existingSellerProfile.Id && x.SellerServiceId==sellerServiceId).ToListAsync(); | ||||||
|         var result = portfolio.Select(x=>x.ToModel()).ToList(); |         var result = portfolio.Select(x=>x.ToModel()).ToList(); | ||||||
|         return Ok(result); |         return Ok(result); | ||||||
| @ -186,12 +186,12 @@ public class SellerServiceController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         var portfolio = await _dbContext.SellerProfilePortfolioPieces |         var portfolio = await _dbContext.SellerProfilePortfolioPieces | ||||||
|             .FirstAsync(x => x.SellerProfileId == existingSellerProfile.Id |             .FirstAsync(x => x.SellerProfileId == existingSellerProfile.Id | ||||||
| @ -211,12 +211,12 @@ public class SellerServiceController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|          |          | ||||||
|         var url = await _storageService.UploadImageAsync(file, Guid.NewGuid().ToString()); |         var url = await _storageService.UploadImageAsync(file, Guid.NewGuid().ToString()); | ||||||
|         var portfolio = new SellerProfilePortfolioPiece() |         var portfolio = new SellerProfilePortfolioPiece() | ||||||
| @ -243,16 +243,16 @@ public class SellerServiceController : Controller | |||||||
|         { |         { | ||||||
|             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); |             var sellerProfileRequest = await _dbContext.SellerProfileRequests.FirstOrDefaultAsync(request=>request.UserId==userId && request.Accepted==false); | ||||||
|             if(sellerProfileRequest!=null) |             if(sellerProfileRequest!=null) | ||||||
|                 return BadRequest("Account has requested to be a seller and not been approved yet."); |                 return BadRequest(); | ||||||
|             return Unauthorized("Account is not a seller."); |             return Unauthorized(); | ||||||
|         } |         } | ||||||
|         if(existingSellerProfile.Suspended) |         if(existingSellerProfile.Suspended) | ||||||
|             return BadRequest("Seller is suspended."); |             return BadRequest(); | ||||||
|         var portfolio = await _dbContext.SellerProfilePortfolioPieces.FirstOrDefaultAsync(x=>x.Id==portfolioId); |         var portfolio = await _dbContext.SellerProfilePortfolioPieces.FirstOrDefaultAsync(x=>x.Id==portfolioId); | ||||||
|         if(portfolio==null) |         if(portfolio==null) | ||||||
|             return NotFound("Portfolio piece not found."); |             return NotFound(); | ||||||
|         if(portfolio.SellerProfileId!=existingSellerProfile.Id) |         if(portfolio.SellerProfileId!=existingSellerProfile.Id) | ||||||
|             return BadRequest("Portfolio piece does not belong to this seller."); |             return BadRequest(); | ||||||
|         _dbContext.SellerProfilePortfolioPieces.Remove(portfolio); |         _dbContext.SellerProfilePortfolioPieces.Remove(portfolio); | ||||||
|         await _dbContext.SaveChangesAsync(); |         await _dbContext.SaveChangesAsync(); | ||||||
|         return Ok(); |         return Ok(); | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ using System.Reflection; | |||||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("comissions.app.database.migrator")] | [assembly: System.Reflection.AssemblyCompanyAttribute("comissions.app.database.migrator")] | ||||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+39c13a24ce87e41d0a98d64f71a8873e6e0fb7f2")] | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d9f01cc96c3f3488ff1ffabc8c18ff2ed9192d31")] | ||||||
| [assembly: System.Reflection.AssemblyProductAttribute("comissions.app.database.migrator")] | [assembly: System.Reflection.AssemblyProductAttribute("comissions.app.database.migrator")] | ||||||
| [assembly: System.Reflection.AssemblyTitleAttribute("comissions.app.database.migrator")] | [assembly: System.Reflection.AssemblyTitleAttribute("comissions.app.database.migrator")] | ||||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| 17d901dc318786e00800140359f2c1fd4726c24e195f53230c47f722959e350f | c6d58bbb171a5f23ad416c7cc86ea9dc93efccc8a6b6525298ad1e8fa000718c | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| 17076145079561012 | 17077084151680581 | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Damien Ostler
						Damien Ostler